一、自动选择最快的源更新
yum -y install yum-fastestmirror yum -y update添加源,在/etc/yum.repo.d目录(centos 6.*为/etc/yum.repos.d目录)下创建一个文件alt.ru.repo,添加如下内容:
[CentALT] name=CentALT Packages for Enterprise Linux 5 - $basearch baseurl=http:/centos.alt.ru/repository/centos/5/$basearch/ enabled=1 gpgcheck=0
二、安装mysql
yum -y install mysql mysql-server mysql-devel
三、安装PHP
yum -y install php php-devel php-mysql php-cgi php-mbstring php-gd php-pear php-pear-DB php-fpm php-cli php-pdo php-mcrypt php-xml php-xmlrpc php-pecl-memcache php-eaccelerator
安装过程中可能会出现如下错误:
Error: Missing Dependency: libt1.so.5()(64bit) is needed by package ***
解决办法是运行如下命令:
rpm -Uvh http:/rpms.arrfab.net/centos/5/x86_64/t1lib-5.1.0-9.el5.af.x86_64.rpm
打开/etc/php.ini,将cgi.fix_pathinfo=1前的注释去掉,并将值改为0:
cgi.fix_pathinfo=0四、安装nginx
yum -y install nginx
五、将服务加入系统启动项
chkconfig mysqld on chkconfig php-fpm on chkconfig nginx on