SimpleAlbum 的安裝過程小記錄


SimpleAlbum 是最近寫的小玩具.
用了已經差不多忘記的 Perl 來寫.
另外還有就是 Dancer.pm 這個輕量級框架.
記錄一下全新安裝到之前那台 Debian 主機上的過程與問題.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 開發環境版本為 v5.17.8
# 以 Github 的作準.發表後這不更新了

# 安裝 curl, sqlite3, tree, libgd
apt-get install curl
apt-get install sqlite3
apt-get install tree
apt-get install libgd2-xpm-dev

# 安裝 cpanm
curl -L http://cpanmin.us | perl - --sudo App::cpanminus

# 打開 Apache 模組
vim /usr/local/apache2/conf/httpd.conf

LoadModule proxy_module modules/mod_proxy.so

# 啟動域名
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

<virtualhost *:80>
ServerName psa.example.com
ServerAlias www.psa.example.com

DocumentRoot /home/username/psa.example.com/public

<proxy *>
Order deny,allow
Allow from allow
</proxy>

ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
</virtualhost>

# 重啟 Apache
/usr/local/apache2/bin/apachectl -k restart

# 建立程式和相應的目錄
git clone git://github.com/usernameoo/perl-simple-album.git psa.example.com
cd psa.example.com

# 初始化目錄
make initial

# 初始化 Database
make database

# 將初始化的檔案與目錄都改成自己的
chwon -Rf username:username {sessions,logs,database,public/attachments}

# 當有更新時可使用以下方式更新程式
make update

# 安裝所需要的模組
make dependents

# 產生 Production 環境中的使用 Assets
make assets

# 重新產生 Database Schema
make db-schema

# 重新產生縮圖
make thumb

# 修改 production.yml 的內容
plugins:
DBIC:
default:
dsn: "dbi:SQLite:dbname=/home/username/psa.example.com/database/SimpleAlbum.sqlite"
schema_class: "SimpleAlbum::DB::Schema"

# 修改 .zshrc
vim ~/.zshrc

unsetopt hup 或者 setopt nohup 好像也可以

# 啟動程式並加入到 /etc/rc.local
nohup sudo -u username plackup -S Starman --workers=2 -p 5000 -R /home/username/psa.example.com/lib -E production --access-log=/home/username/psa.example.com/logs/production.log -a /home/username/psa.example.com/bin/app.pl >> /home/username/psa.example.com/logs/production-error.log 2>&1 &

==============================================

# 錯誤問題::1
SuexecUserGroup configured, but suEXEC is disabled: Invalid owner or file mode for /usr/local/apache2/bin/suexec

# 解決方法::1
chmod 4750 /usr/local/apache2/bin/suexec

# 錯誤問題::2
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.

# 解決方法::2
apt-get install libgd2-xpm-dev

# 查看 suexec 的資料
/usr/local/apache2/bin/suexec -V

# 安裝 GD.pm (如 Image::Size 無法安裝)
wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.46.tar.gz
tar zxvf GD-2.46.tar.gz
cd GD-2.46
perl Makefile.PL

# 關於 zsh 在用戶登出時會殺掉指令.可使用
- &! or &| 取代原來的 &.
- nohup [shell command]

參考: