CentOS/AWS编译安装LNMP环境

本文可看作AWS/CENTOS搭建LAMP环境的姊妹篇。

1、启用额外的库(参照racksapce,aws的默认ami库里面东西很全,基本上都可以yum到,可以忽略这部分)

centos5没有自带的nginx和php-fpm,因此从别的库拿来。导入RHEL EPEL

wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

编辑remi的repo

sudo vim /etc/yum.repos.d/remi.repo

如下:

[remi]
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority

后来我发现这样子的话安装的nginx版本太古老,安装remi库用于安装phpfpm,另外用nginx.repo安装最新版的nginx,方法

编辑

/etc/yum.repos.d/nginx.repo

如下

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/5/$basearch/
gpgcheck=0
enabled=1

2、安装

yum install mysql mysql-server nginx php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy php-pecl-apc

安装完之后

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
chkconfig --levels 235 php-fpm on
/etc/init.d/php-fpm start

继续阅读CentOS/AWS编译安装LNMP环境