最後更新日:2005/10/13

安裝 Gallery2 相簿管理程式

        期待已久的 Gallery2 相簿管理程式終於正式在 2005\09\13 Release 出來,有別於 Gallery1.x 版,新版的 Gallery2 結合了資料庫
,因此使得整體內容管理更加豐富,但相對系統資源也吃得比以 Gallery1/x 重,因此有興趣升級的朋友可裝來玩玩,小弟同樣於 FreeBSD Server 中安裝 Gallery2,不改過去的安裝方式皆採 ports 安裝採用 ports 安裝方便的地方在於它讓我不用到處找軟體只要下 make install 就幫裝好所有相依的套件,這也是我為什麼這麼喜歡 FreeBSD 的原因,因為 ports 實在是太方便使用了 ~~

Environment :

硬體:i386 PC Intel P3 550
記憶體網卡:512M RAM + Intel 網卡
作業系統:FreeBSD 5.4 Release

Setp 1.

安裝 Mysql40
#cd /usr/ports/database/mysql40-server
#make install

安裝 Apache20
#cd /sur/ports/www/apache20
#make install

安裝 PHP4
#cd /usr/ports/lang/php4      

#make install
     #  會跳出選單只選 apache2

[X] APACHE2    Use apache 2.x instead of apache 1.3.x
[ ] DEBUG      Enable debug        
[ ] MULTIBYTE  Enable zend multibyte support              
[ ] IPV6       Enable ipv6 support                        
[ ] OPENSSL    Build static OpenSSL extension

安裝 php4 的延伸套件模組
#cd /usr/ports/lang/php4-extensions
#make config     #  會跳出所有的延伸套件供你選擇,我只挑了下列幾項:

[X] CTYPE ctype functions
[X] GD GD library support
[X] GETTEXT gettext library support
[X] ICONV iconv support
[X] IMAGICK ImageMagick support
[X] MYSQL MySQL database support
[X] OVERLOAD user-space object overloading support
[X] PCRE Perl Compatible Regular Expression support
[X] POSIX POSIX-like functions
[X] SESSION session support
[X] TOKENIZER tokenizer support
[X] XML XML support
[X] ZIP ZIP support
[X] ZLIB ZLIB support

#make install


安裝 Gallery2
#cd /usr/ports/www/gallery2
#make install clean



Setp 2.

#vi /usr/local/etc/apache2/httpd.conf
     #  設定 apache2 的設定檔

AddDefaultCharset big5
DefaultLanguage zh-TW

DirectoryIndex index.php index.html index.html.var

<VirtualHost 88.88.88.88>
        ServerAdmin admin@ntut.idv.tw
        DocumentRoot /usr/local/www/data-dist/gallery2
        ServerName photos.ntut.idv.tw
        ErrorLog /var/log/error_log
        CustomLog /var/log/access_log common
<Directory /usr/local/www/data-dist/gallery2>
        AllowOverride Options FileInfo
</Directory>
</VirtualHost>

#vi /usr/local/etc/php.ini

memory_limit = 16M      ; Maximum amount of memory a script may consume (8MB)    
#  由 8M 改為 16M
register_globals = On      
#  由 Off 改 On

#vi /etc/rc.conf  
   #  設定重開機時自動開啟 mysql 跟 apache2 服務

mysql_enable="YES"
apache2_enable="YES" 

#reboot

Setp 3.

#cd /data        
#  建立一個存放相片的目錄空間,這個空間最好別放在跟 apache 網頁空間不同的目錄,如:/usr/local/www/data-dist 下即為 apache 網頁空間。
#mkdir g2data
#chmod 777 g2data
 
#mysqladmin -u root -p create gallery2    
#  建立一個 gallery2 的資料庫 table
#mysql gallery2 -u root -p -e"GRANT ALL ON gallery2.* TO username@localhost IDENTIFIED BY 'password'"    #  建立允許一個可使用 gallery2 這個資料庫的使用者跟密碼

最後開個瀏覽器跟著一步一步安裝即可完成
http://photos.ntut.idv.tw

如果要遷移 Gallery1.x 到 Gallery2 可參考官網上的說明:http://codex.gallery2.org/index.php/Gallery2:migration