1. Change yum source To Netease source to increase speed
Vi/etc/yum. repos. d/CentOS-Base.repo
The changes are as follows:
# CentOS-Base.repo
#
# This file uses a new release list system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and
# Update status of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You shoshould use this for CentOS updates
# Unless you are manually picking other mirrors.
#
# If the specified list = does not work for you, as a fall back you can try
# Remarked out baseurl = line instead.
#
#
[Base]
Name = CentOS-$ releasever-Base
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
# Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/
Baseurl = http://mirrors.163.com/centos/?releasever/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Released updates
[Updates]
Name = CentOS-$ releasever-Updates
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
# Baseurl = http://developer.centos.org/centos/?releasever/updates/?basearch/
Baseurl = http://mirrors.163.com/centos/?releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Packages used/produced in the build but not released
[Addons]
Name = CentOS-$ releasever-Addons
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = addons
# Baseurl = http://developer.centos.org/centos/?releasever/addons/?basearch/
Baseurl = http://mirrors.163.com/centos/?releasever/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that may be useful
[Extras]
Name = CentOS-$ releasever-Extras
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = extras
# Baseurl = http://developer.centos.org/centos/?releasever/extras/?basearch/
Baseurl = http://mirrors.163.com/centos/?releasever/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-$ releasever-Plus
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
# Baseurl = http://developer.centos.org/centos/?releasever/centosplus/?basearch/
Baseurl = http://mirrors.163.com/centos/?releasever/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
Ii. update yum
Yum-y update
3. Use the yum Command provided by CentOS Linux to install and upgrade the required Library
LANG = C
Yum-y install gcc-c ++ autoconf libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses- devel curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn-devel openssl-devel openldap-devel nss_ldap openldap-clients openldap-servers
4. install php and mysql
Yum-y install php mysql-server mysql-devel php-mysql php-cgi php-mbstring php-gd php-fastcgi
5. Install nginx
Because centos does not have the default nginx package, you need to enable the REHL attachment package.
Rpm-Uvh http://download.Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Yum-y install nginx
Set startup
Chkconfig nginx on
6. Install spawn-fcgi to run php-cgi
Yum install spawn-fcgi
7. Download the startup script of spawn-fcgi
Wget http://bash.cyberciti.biz/dl/419.sh.zip
Unzip 419.sh.zip
Mv 419.sh/etc/init. d/php_cgi
Chmod + x/etc/init. d/php_cgi
Start php_cgi
/Etc/init. d/php_cgi start
View Processes
Netstat-tulpn | grep: 9000
If the following occurs, everything is normal.
Tcp 0 0 127.0.0.1: 9000 0.0.0.0: * LISTEN 4352/php-cgi
8. Configure nginx. For detailed configuration, see nginx. conf)
Location ~ . Php $ {
Root html;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/usr/share/nginx/html $ fastcgi_script_name;
Include fastcgi_params;
}
IX. View phpinfo
Write scripts
Phpinfo ();
10. Install phpmyadmin
The permission for modifying/var/lib/php/session is the same as that for nginx and php_cgi.
Chown-R www. www/var/lib/php/session