# 檢查編譯工具
rpm -q make gcc gcc-c++ zlib-devel libaio
# 缺失則安裝
yum install make gcc gcc-c++ zlib-devel libaio -y
# 移除可能衝突的預裝套件
rpm -q httpd mysql php
# 若存在則 rpm -e 卸載
./configure --prefix=/usr/local/libxml2/ && make && make install./configure --prefix=/usr/local/libmcrypt/ && make && make install./configure --prefix=/usr/local/zlib/ && make && make install./configure --prefix=/usr/local/libpng/ --enable-shared && make && make installmkdir -p /usr/local/jpeg/{bin,lib,include,man/man1}./configure --prefix=/usr/local/jpeg/ --enable-shared --enable-static && make && make install./configure --prefix=/usr/local/freetype/ --enable-shared && make && make install./configure && make && make install./configure --prefix=/usr/local/gd/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/ && make && make install./configure --prefix=/usr/local/apache/ --enable-so --enable-rewrite
make && make install
/usr/local/apache/bin/apachectl start
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
chmod +x /etc/init.d/httpd
chkconfig --add httpd
# 若提示不支援 chkconfig,編輯 /etc/rc.d/init.d/httpd 第二行加入:
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server
chkconfig --level 2345 httpd on
service httpd restart
或修改 /etc/rc.local 加入啟動命令。
groupadd mysql
useradd -r -g mysql mysql
cd /usr/local
ln -s /tmp/LAMP/mysql-5.5.15-linux2.6-x86_64 mysql
cd mysql
chown -R mysql . ; chgrp -R mysql .
./scripts/mysql_install_db --user=mysql
chown -R root . ; chown -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
service mysqld restart
/usr/local/mysql/bin/mysqladmin -u root password '123456'
/usr/local/mysql/bin/mysql -u root -p
./configure --prefix=/usr/local/php/ --with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-config-file-path=/usr/local/php/etc --with-zlib --with-libxml-dir=/usr \
--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem \
--enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex \
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \
--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap
make && make install
cp php.ini-production /usr/local/php/etc/php.ini