close

Zenphoto (http://www.zenphoto.org/) 是一個好用的相簿伺服器軟體

用它的好處是分享圖片時不用忍受外部相簿煩人的廣告

 

以下介紹一下如何在 Ubuntu 12.04 上架設 Photo server Zenphoto

 

首先你要有一台 Server 灌的是 Ubuntu

如果連這個都不會幹你娘請關掉網頁

 

Step 1: 安裝 Apache Server

sudo apt-get install apache2

裝完後去 http://your.ip.address 就可以看到 it works 的網頁,表示安裝成功

 

 

Step 2: 安裝 mysql

sudo apt-get install mysql-server
sudo apt-get install mysql-client

安裝時遇到問題這樣回答

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

接著用以下指令查一下 mysql 有沒有跑起來

sudo netstat -tap | grep mysql

沒有的話就去 restart 他

sudo service apache2 restart

 

Step 3: 安裝 php5

sudo apt-get install php5 libapache2-mod-php5

裝完後重啟 apache

sudo /etc/init.d/apache2 restart

撰寫一個 info.php 取得 php 資訊

sudo vim /var/www/info.php
<?php
phpinfo();
?>

寫完後連到 http://your.ip.address/info.php 就可以看到 Server 上 php 的資訊

 

Step 4: 安裝 MySQL support for php5

讓 php5 可以使用 mySQL 的套件

sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear \
php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps \
php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

裝完後重啟 apache

sudo /etc/init.d/apache2 restart

 

Step 5: 安裝 phpMyAdmin

sudo apt-get install phpmyadmin

安裝時遇到問題這樣回答

Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

接著要去做 link 動作

sudo ln -s /usr/share/phpmyadmin /var/www/

如此便可從 http://your.ip.address/phpmyadmin/ 連到 phyMyAdmin 的首頁

 

Step 6:  開啟 UserDir 讓 user 可以分享網頁

sudo a2endmod userdir

接著去編輯 php5.conf

sudo vim /etc/apache2/mods-available/php5.conf

把 php_admin_value engine Off 這行註解掉


 <IfModule mod_userdir.c>
 <Directory /home/*/public_html>
 # php_admin_value engine Off
 </Directory>
 </IfModule>

裝完後重啟 apache

sudo /etc/init.d/apache2 restart

如此一來便可在 /home/user 下建立一個 public_html

放在裡面的網頁可以透過  http://your.ip.address/~user/ 連接方式存取

 

Step 7: 修改上傳檔案的大小限制

利用剛剛的 info.php 去找到 php.ini 的位置

sudo vim /etc/php5/apache2/php.ini

以下改為:

max_execution_time = 600

max_input_time = 600

memory_limit = 64M

post_max_size = 64M

裝完後重啟 apache

sudo /etc/init.d/apache2 restart

 

Step 8: 建立一個 mysql 帳戶,並給予權限

mysql -u root -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

 

Step 9: 架設 ZenPhoto

下載軟體並解壓縮到 ~/public_html/zenphoto/ 下

http://www.zenphoto.org/

tar xzf zenphoto-*.tar.gz zenphoto

建立 Database for Zenphoto

mysql -u newuser -p
create database zenphoto;
tar xzf zenphoto-*.tar.gz zenphoto

重設資料夾權限給 apache ( 利用 ps aux | grep apache 看最左欄)

cd ~/public_html/zenphoto/
chown -R www-data:www-data .

開啟 http://yout.ip.address/zenphoto 開始安裝

安裝時要輸入剛剛建立的資料入 user name, passward, 和 table name 等

裝完後需設定一組管理者帳號,設完就可以用啦!

之後要回到管理者登入頁面連結如下

http://your.ip.address/~user/zenphoto/zp-core/admin.php

 

Step 10: 上傳照片

把 ~/public_html/zenphoto/albums 權限設為 0777

sudo chmod 777 ~/public_html/zenphoto/albums

把要分享的照片連同資料夾拖到 albums 目錄下

把連結 http://your.ip.address/~user/zenphoto 分享給朋友,他們就可以看到相片啦

 

Step 11: 安裝 keyboardnav-extended plugin

為了讓瀏覽相片時可以使用鍵盤的左右鍵增加方便性,必須自行安裝 plugin

https://github.com/acrylian/keyboardnav-extended

將 keyboardnav-extended.php 放到 plugins fodler 下

sudo chown www-data:www-data keyboardnav-extended.php

再登入 Zenphoto的管理頁面,找到 Plugins 這個 Tab

將下面的 keyboardnav-extended v1.0.1 這個選項打勾

回到相簿,發現既可以使用鍵盤的左右鍵來快速瀏覽啦~~

 

 

 

 

References:

http://askubuntu.com/questions/486259/problem-apache-server-re-installation

http://askubuntu.com/questions/174138/how-to-install-mysql

https://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-12.04-lts-lamp

http://askubuntu.com/questions/387062/how-to-solve-the-phpmyadmin-not-found-issue-after-upgrading-php-and-apache

http://www.techytalk.info/enable-userdir-apache-module-ubuntu-debian-based-linux-distributions/

http://aachi0707.blogspot.tw/2010/10/phpini.html

http://ubuntuserverguide.com/2012/10/how-to-enable-and-configure-apache2-userdir-module-in-ubuntu-server-12-04.html

http://www.liquidweb.com/kb/create-a-mysql-user-on-linux-via-command-line/

https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

http://newtoypia.blogspot.tw/2012/08/piwigo-zenphoto.html

arrow
arrow
    全站熱搜

    擒猿小舖 發表在 痞客邦 留言(0) 人氣()