Ubuntu Server (PHP+MYSQL+Lighttpd 獨立安裝筆記)

PHPABC Lighttpd 851 次浏览 , , 没有评论

花了差不多一天時間整理的.
不過 lighttpd 部份的 config 還是沒有修改
看來下一篇寫的是相關的 config 修改吧..

################
# 基本環境安裝
################

# 更新並升級軟體庫
sudo apt-get update
sudo apt-get upgrade

# 安裝 GCC , G++, make, ZIP
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install make
sudo apt-get install unzip

# 安裝 termcap (MYSQL 編譯所需)
sudo apt-get install ncurses-dev

# 切換為 ROOT 方便之後工作
sudo su –

################
# 安裝 ProFTPD
################

wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.2.tar.gz
tar zxvf proftpd-1.3.2.tar.gz
cd proftpd-1.3.2
./configure –prefix=/usr/local/proftpd
make

(啟動方法)
/usr/local/proftpd/sbin/proftpd

################
# 安裝 MYSQL
################

wget wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.31.tar.gz/from/http://mysql.ntu.edu.tw/
tar zxvf mysql-5.1.31.tar.gz
cd mysql-5.1.31
./configure –prefix=/usr/local/mysql51
make
make install

(增加用戶 mysql)
useradd mysql

(改變權限)
(chown -R root:root /usr/local/mysql51)

(安裝 Database)
/usr/local/mysql51/bin/mysql_install_db –user=mysql

(複製啟動檔案到初始化時執行目錄)
cd support-files/
cp mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql

(啟動 MYSQL Server)
/etc/init.d/mysql start

(變更 root 密碼)
/usr/local/mysql51/bin/mysqladmin -u root password ‘new-password’

################
# 安裝 PHP
################

# 先安裝 zlib
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install

# 再安裝 zziplib
wget http://jaist.dl.sourceforge.net/sourceforge/zziplib/zziplib-0.13.50.tar.bz2
tar jxvf zziplib-0.13.50.tar.bz2
cd zziplib-0.13.50
./configure
make
make install

# 再安裝 LibPng
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.34.tar.gz
tar zxvf libpng-1.2.34.tar.gz
cd libpng-1.2.34
cp scripts/makefile.std makefile
make test
make install

# 再安裝 Freetype
wget http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.8.tar.gz
tar zxvf freetype-2.3.8.tar.gz
cd freetype-2.3.8
./configure –prefix=/usr/local/modules/freetype
make
make install

# 再安裝 LibConv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
tar zxvf libiconv-1.12.tar.gz
cd libiconv-1.12
./configure
make
make install

# 再安裝 JPEG Lib (JPEGSRC.V6B)
mkdir /usr/local/modules
mkdir /usr/local/modules/jpeg6
mkdir /usr/local/modules/jpeg6/bin
mkdir /usr/local/modules/jpeg6/lib
mkdir /usr/local/modules/jpeg6/include
mkdir /usr/local/modules/jpeg6/man
mkdir /usr/local/modules/jpeg6/man/man1

wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure –prefix=/usr/local/modules/jpeg6 –enable-shared –enable-static
make
make install

# 再安裝 GD
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure –prefix=/usr/local/modules/gd –with-jpeg=/usr/local/modules/jpeg6 –with-png –with-zlib –with-freetype=/usr/local/modules/freetype
make
make install

# 再安裝 Lib XML2 (以防 PHP 出現錯誤)
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
tar zxvf libxml2-2.7.3.tar.gz
cd libxml2-2.7.3
./configure
make
make install

# 再安裝 Lib CURL (以防 PHP 出現錯誤)
apt-get install curl
apt-get install libcurl4-openssl-dev

# 再安裝 Open SSL (這用舊版本,因為某原因)
wget http://www.openssl.org/source/openssl-0.9.7a.tar.gz
tar zxvf openssl-0.9.7a.tar.gz
cd openssl-0.9.7a
./config –openssldir=/usr/local/openssl
make
make install

# 最後安裝 PHP
wget http://hk.php.net/get/php-5.2.8.tar.gz/from/this/mirror
tar zxvf php-5.2.8.tar.gz
cd php-5.2.8
./configure –prefix=/usr/local/php5-fastcgi –enable-mbstring –enable-pcntl –with-mysql=/usr/local/mysql51 –enable-fastcgi –enable-force-cgi-redirect –with-gd=/usr/local/modules/gd –with-zlib –with-png-dir=/usr/local/lib –with-jpeg-dir=/usr/local/modules/jpeg6 –with-freetype-dir=/usr/local/modules/freetype –with-iconv=/usr/local/lib –enable-gd-native-ttf –enable-dbase –enable-exif –enable-ftp –enable-sqlite-utf8 –enable-sockets –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-shmop –with-curl –with-openssl=/usr/local/openssl
make
make install

sed -e ’s/\.\///’ php.ini-dist > /usr/local/php5-fastcgi/lib/php.ini
strip /usr/local/php5-fastcgi/bin/php

# 再來安裝 eaccelerator
wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.zip
unzip eaccelerator-0.9.5.3.zip
cd eaccelerator-0.9.5.3
/usr/local/php5-fastcgi/bin/phpize
./configure –enable-eaccelerator=shared –with-php-config=/usr/local/php5-fastcgi/bin/php-config
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator

(使用 VI , 移到最下)
vim /usr/local/php5-fastcgi/lib/php.ini

(加入內容)
extension=”eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

################
# 安裝 Lighttpd
################

# 先安裝 pcre
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.zip
unzip pcre-7.8.zip
cd pcre-7.8
./configure –enable-utf8 –enable-unicode-properties
make
make install

# 再安裝 bzip2
wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz
tar zxvf bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
make install

# 最後
wget http://www.lighttpd.net/download/lighttpd-1.4.20.tar.gz
tar zxvf lighttpd-1.4.20.tar.gz
cd lighttpd-1.4.20
./configure –prefix=/usr/local/lighttpd –with-openssl=/usr/local/openssl
make
make install

cd doc
mkdir /usr/local/lighttpd/conf
cp lighttpd.conf /usr/local/lighttpd/conf/
cp rc.lighttpd.redhat /etc/init.d/lighttpd

(修改開機啟動檔)
vim /etc/init.d/lighttpd

(修改兩位置, 主要是引住的那個位置)
LIGHTTPD_CONF_PATH=”/usr/local/lighttpd/conf/lighttpd.conf”
lighttpd=”/usr/local/lighttpd/sbin/lighttpd”

(最後是修改 Config 檔案要用到的目錄)
mkdir /usr/local/lighttpd/log/

(其他設定請參考說明)

来自:http://zeuik.com/studio/2009/02/11/ubuntu-server-phpmysqllighttpd- %E7%8D%A8%E7%AB%8B%E5%AE%89%E8%A3%9D%E7%AD%86%E8%A8%98/

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

Go