注意事項 :
預設把所有套件裝在 /usr/local/web/ 底下
不需要的設定請自行斟酌
下載的檔案都暫時先放在 /tmp
安裝步驟 :
開機放入 CentOS 5.2 iso DVD
安裝套件請不要選擇任何套件 (把 KDE 的選項拿掉)
按照設定安裝到完成後重開機 (把DVD移出)
重開機後
Firewall 把防火牆關掉
把以下不需要的Service 都停掉
apmd
autofs
bluetooth
autofs
bluetooth
cups
hidd
ip6table
isdn
ip6table
isdn
pcscd
pcmcia
sendmail
yum-updatesd
sendmail
yum-updatesd
設定完成後登入
找尋最快 yum server
yum install yum-fastestmirror -y
同步時間 , 如果沒有 ntpdate , 要先
yum install ntp -y
每小時同步時間
若要設定每天執行一次
vi /etc/cron.hourly/ntpdate.sh
新增指令檔 “ntpdate.sh”,內容如下:
#! /bin/bash
ntpdate time.stdtime.gov.tw
hwclock --systohc
ntpdate time.stdtime.gov.tw
hwclock --systohc
chmod 755 /etc/cron.hourly/ntpdate.sh
更新套件
yum update -y
設定 DNS Server
vi /etc/resolv.conf
nameserver 168.95.1.1
nameserver 139.175.55.244
安裝編譯工具
yum groupinstall 'Development Tools' -y
yum install gettext -y
yum install libxml2 libxml2-devel -y
mkdir /usr/local/web/
yum groupinstall 'Development Tools' -y
yum install gettext -y
yum install libxml2 libxml2-devel -y
mkdir /usr/local/web/
cd /tmp
wget http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.7.tar.gz
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
wget http://ftp.twaren.net/Unix/Web/apache/httpd/httpd-2.2.11.tar.gz
wget http://tw.php.net/distributions/php-5.2.8.tar.gz
wget http://ftp.twaren.net/Unix/Web/apache/httpd/httpd-2.2.11.tar.gz
wget http://tw.php.net/distributions/php-5.2.8.tar.gz
安裝jpeg6
cd /tmp
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
mkdir /usr/local/web/jpeg6
mkdir /usr/local/web/jpeg6/bin
mkdir /usr/local/web/jpeg6/lib
mkdir /usr/local/web/jpeg6/include
mkdir /usr/local/web/jpeg6/man
mkdir /usr/local/web/jpeg6/man/man1
./configure --prefix=/usr/local/web/jpeg6/ --enable-shared --enable-static
make ; make install
安裝 zlib
安裝 libpng
mkdir /usr/local/web/jpeg6
mkdir /usr/local/web/jpeg6/bin
mkdir /usr/local/web/jpeg6/lib
mkdir /usr/local/web/jpeg6/include
mkdir /usr/local/web/jpeg6/man
mkdir /usr/local/web/jpeg6/man/man1
./configure --prefix=/usr/local/web/jpeg6/ --enable-shared --enable-static
make ; make install
安裝 zlib
cd /tmp
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/web/zlib
make ; make install安裝 libpng
cd /tmp
tar zxvf libpng-1.2.34.tar.gz
cd libpng-1.2.34
./configure --prefix=/usr/local/web/libpng
make ; make install
安裝 freetype
cd /tmp
./configure --prefix=/usr/local/web/libpng
make ; make install
安裝 freetype
cd /tmp
tar zxvf freetype-2.3.7.tar.gz
cd freetype-2.3.7
./configure --prefix=/usr/local/web/freetype
make ; make install
安裝 gd
cd /tmp
make ; make install
安裝 gd
cd /tmp
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/web/gd --with-jpeg=/usr/local/web/jpeg6/ --with-png=/usr/local/web/libpng --with-zlib=/usr/local/web/zlib --with-freetype=/usr/local/web/freetype/
vi gd_png.c
把 include "png.h"改成 include "/usr/local/web/libpng/include/png.h"
make ; make install
安裝 freetds
cd /tmp
安裝 freetds
cd /tmp
tar zxvf freetds-stable.tgz
cd freetds-0.82
./configure --prefix=/usr/local/web/freetds --with-tdsver=8.0 --enable-msdblib
make ; make install
touch /usr/local/web/freetds/include/tds.h
touch /usr/local/web/freetds/lib/libtds.a
安裝 apache2
make ; make install
touch /usr/local/web/freetds/include/tds.h
touch /usr/local/web/freetds/lib/libtds.a
安裝 apache2
cd /tmp
tar zxvf httpd-2.2.11.tar.gz
cd httpd-2.2.11
./configure --prefix=/usr/local/web/apache2 --enable-so --enable-info --enable-rewrite --enable-mime-magic --with-mpm=worker
make ; make install
./configure --prefix=/usr/local/web/apache2 --enable-so --enable-info --enable-rewrite --enable-mime-magic --with-mpm=worker
make ; make install
(prefork 比較慢 , 不採用 , 除非有相容的問題)#./configure --prefix=/usr/local/web/apache2 --enable-so --enable-info --enable-rewrite --enable-mime-magic
安裝 php
cd /tmp
tar zxvf php-5.2.8.tar.gz
cd php-5.2.8
./configure --prefix=/usr/local/web/php --with-jpeg-dir=/usr/local/web/jpeg6 --with-zlib=/usr/local/web/zlib --with-png-dir=/usr/local/web/libpng --with-gd=/usr/local/web/gd --with-freetype-dir=/usr/local/web/freetype --with-mssql=/usr/local/web/freetds --enable-magic-quotes --with-apxs2=/usr/local/web/apache2/bin/apxs
make ; make install
修改 FreeTDS 設定 (也可以直接COPY設定好的機器
./configure --prefix=/usr/local/web/php --with-jpeg-dir=/usr/local/web/jpeg6 --with-zlib=/usr/local/web/zlib --with-png-dir=/usr/local/web/libpng --with-gd=/usr/local/web/gd --with-freetype-dir=/usr/local/web/freetype --with-mssql=/usr/local/web/freetds --enable-magic-quotes --with-apxs2=/usr/local/web/apache2/bin/apxs
make ; make install
修改 FreeTDS 設定 (也可以直接COPY設定好的機器
rsync -av -e ssh root@192.168.1.xx:/usr/local/web/freetds/etc/freetds.conf /usr/local/web/freetds/etc/freetds.conf )
vi /usr/local/web/freetds/etc/freetds.conf
最後面加上需要連結的 MSSQL Server
[31_db]
host = 192.168.1.xx
port = 1433
client charset = UTF-8
tds version = 8.0
[31_db]
host = 192.168.1.xx
port = 1433
client charset = UTF-8
tds version = 8.0
把 httpd.conf , vhost.conf 放到 /usr/local/web/apache2/conf
把 php.ini 放到 /usr/local/web/php/lib
編輯 vi /etc/rc.d/rc.local
新增一行
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
防禦 SYN 攻擊
重開機並啟動 apache 服務 /usr/local/web/apache2/bin/apachectl -k start
沒有留言:
張貼留言