It is not an experience, but a personal summary.
Problems encountered during setup, and record them.
Friends who have just started learning to set up the environment are less likely to make detours.
There are no too many parameters, and it is not the deployment of high-performance websites.
I have limited experience. I would like to share some questions here.
Operating Environment
Operating System: Mac OS lion
VM: VMWare Fusion
Virtual System: centos 5.5 +
Operation User: Root
Objective: To build an lnmp environment.
Install dependency libraries and development environments
# Dependent libraries and development tools
Yum-y install GCC 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 openldap-devel nss_ldap openldap-clients openldap-servers
# Nginx
Yum-y install PCRE-devel zlib-devel
# PHP
Yum-y install Gd-devel libjpeg-devel libpng-devel FreeType-devel libxml2-devel curl-devel FreeType-devel
# MySQL
Yum-y install bison GCC gcc-C ++ Autoconf automake zlib * libxml * ncurses-devel libtool-ltdl-devel *Mysql-devel
Download Software Package
# Creating a directory
Mkdir/Web
CD/Web
# Php5.3.7
Wget http://cn.php.net/distributions/php-5.3.8.tar.bz2
# PHP Library File
Wget http://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
Wget http://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
Wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
# Nginx1.0.9
Wget http://www.nginx.org/download/nginx-1.0.9.tar.gz
# Nginx (PCRE)
Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz
# Mysql5.5.17
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/http://mysql.ntu.edu.tw/
# MySQL (cmake)
Wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
Install MySQL
# Install cmake
Tar-zxvf cmake-2.8.6.tar.gz
CD cmake-2.8.6/
./Configure
Gmake & gmake install & CD ../
# Add a MySQL user
/Usr/sbin/groupadd MySQL
/Usr/sbin/useradd-G MySQL
Mkdir-P/data/MySQL
Chown-r MYSQL: MySQL/data/MySQL
# Install MySQL
Tar-zxvf mysql-5.5.17.tar.gz
CD mysql-5.5.17
Cmake.-dcmake_install_prefix =/usr/local/MySQL-dmysql_datadir =/data/MySQL-dsysconfdir =/etc/
Make && Make install
# Set MySQL
# The support-Files directory contains five configuration files:
# My-small.cnf (memory <= 64 m)
# My-medium.cnf (memory 128 m)
# My-large.cnf (memory 512 m)
# My-huge.cnf (memory 1 GB-2 GB)
# My-innodb-heavy-4G.cnf (memory 4 GB)
CD/usr/local/MySQL
CP./support-files/my-medium.cnf/etc/My. CNF
VI/etc/My. CNF
# Add in [mysqld]
Datadir =/data/MySQL
Wait-Timeout = 30
Max_connections = 512
Default-storage-engine = MyISAM
# Modify in the [mysqld] Section
Max_allowed_packet = 16 m
# Generating an authorization table
CD/usr/local/MySQL
. /Scripts/mysql_install_db -- user = MySQL
# Change Password
/UsR/local/MySQL/bin/mysqglad Min-u Root Password 123456
# Enable MySQL
/Usr/Loc Al/MySQL/bin/mysqld_sa Fe &
# Test connection to MySQL
/Usr/loca L/MySQL/bin/MySQL-u root-P 123456
Show databases;
Exit;
# Set startup
VI/etc/rc. d/rc. Local
# Join
/Usr/local/MySQL/bin/mysqld_safe &
Install PHP
# 1
Tar-zxvf libiconv-1.14.tar.gz & libiconv-1.14/CD/
./Configure -- prefix =/usr/local
Make & make install & CD ../
# 2
Tar-zxvf libmcrypt-2.5.8.tar.gz & libmcrypt-2.5.8/CD/
./Configure & make install
/Sbin/ldconfig & CD libltdl/&./configure -- enable-ltdl-install
Make & make install & CD ../
# 3
Tar-zxvf mhash-0.9.9.9.tar.gz & CD mhash-0.9.9.9/&./configure
Make & make install & CD ../
# 4
Ln-S/usr/local/lib/libmcrypt. La/usr/lib/libmcrypt. La
Ln-S/usr/local/lib/libmcrypt. So/usr/lib/libmcrypt. So
Ln-S/usr/local/lib/libmcrypt. so.4/usr/lib/libmcrypt. so.4
Ln-S/usr/local/lib/libmcrypt. so.4.4.8/usr/lib/libmcrypt. so.4.4.8
Ln-S/usr/local/lib/libmhash. A/usr/lib/libmhash.
Ln-S/usr/local/lib/libmhash. La/usr/lib/libmhash. La
Ln-S/usr/local/lib/libmhash. So/usr/lib/libmhash. So
Ln-S/usr/local/lib/libmhash. so.2/usr/lib/libmhash. so.2
Ln-S/usr/local/lib/libmhash. so.2.0.1/usr/lib/libmhash. so.2.0.1
Ln-S/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
# 5
Tar-zxvf mcrypt-2.6.8.tar.gz & mcrypt-2.6.8/CD/
/Sbin/ldconfig
./Configure
Make & make install & CD ../
# 6
Tar-xjvf php-5.3.8.tar.bz2
CD php-5.3.8
./Configure -- prefix =/usr/local/PHP \
-- With-config-file-Path =/usr/local/PHP/etc \
-- With-iconv-Dir =/usr/local/-- With-FreeType-Dir \
-- With-mysql =/usr/local/MySQL \
-- With-mysqli =/usr/local/MySQL/bin/mysql_config \
-- With-JPEG-dir -- With-PNG-dir -- With-zlib \
-- With-mhash -- enable-sockets -- enable-FTP \
-- With-libxml-dir -- enable-XML -- disable-rpath \
-- Enable-safe-mode -- 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-LDAP-sasl \
-- Enable-FPM \
-- With-XMLRPC -- enable-zip -- Enable-soap \
-- Without-pear \
Make zend_extra_libs = '-liconv'
# Note that make: *** [EXT/phar. php] Error 127 may occur.
# Mysql client Solution
# Ln-S/usr/local/MySQL/lib/libmysqlclient. So/usr/lib/
# Ln-S/usr/local/MySQL/lib/libmysqlclient. so.18/usr/lib/libmysqlclient. so.18
# Or chmod: unable to access "ext/phar. phar": No file or directory
# Make: [EXT/phar. phar] Error 1 (ignore)
# Solution: add the -- without-pear parameter during compilation.
#If not, do not add the zend_extra_libs = '-liconv' parameter to make.
Make install
# Select the php. ini configuration file
Cp php. ini-production/usr/local/PHP/etc/PHP. ini
Change PHP-FPM
# Add a WWW user
/Usr/sbin/groupadd WWW &/usr/sbin/useradd-G WWW
Mkdir-P/var/log/nginx & chmod + w/var/log/nginx & chown-r www: www/var/log/nginx
Mkdir-P/data/WWW & chmod + w/data/WWW & chown-r www: www/data/WWW
CP/usr/local/PHP/etc/PHP-FPM. Conf. Default/usr /Local/PHP/etc/php-fpm.conf
6/usr/local/PHP/etc/php-fpm.conf
# Remove/modify the configuration file;
PM. max_children = 64
PM. start_servers = 20
PM. min_spare_servers = 5
PM. max_spare_servers = 35
PM. max_requests = 1024
User = WWW
Group = WWW
# Check whether the syntax is correct
/Usr/local/PHP/sbin/PHP-FPM-T
# Notice: configuration file/usr/local/PHP/etc/php-fpm.conf test is successful test successful
/Usr/local/PHP/sbin/PHP-FPM &
# Set startup
VI/etc/rc. d/rc. Local
# Add at the end of a row
/Usr/local/PHP/sbin/PHP-FPM &
# Return to the installation package directory
CD/Web
Install nginx
# Install the PCRE Library
Tar-zxvf pcre-8.13.tar.gz & CD pcre-8.13/&./configure
Make & make install & CD ../
# Install nginx
Tar-zxvf nginx-1.0.9.tar.gz & CD nginx-1.0.9 &&
./Configure -- user = WWW -- group = www \
-- Prefix =/usr/local/nginx \
-- Sbin-Path =/usr/local/nginx/sbin/nginx \
-- Conf-Path =/usr/local/nginx/CONF/nginx. conf \
With-http_stub_status_module \
With-http_ssl_module \
-- With-PCRE \
-- Loc K-Path =/var/run/nginx. Lock \
-- PID-Path =/var/run/NGI NX. PID
Make & make install & CD ../
# Change configuration
VI/usr/local/nginx/CONF/nginx. conf
# Modify some parameters. do not replace the file directly. This is only part of it.
User WWW
Events {
Use epoll;
Worker_connections 1024;
}
Location ~ \. Php $ {
Root HTML;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename $ document_root $ fastcgi_script_name;
Include fastcgi_params;
}
# Note:
# $ Document_root $ fastcgi_script_name;
# check the configuration file
/usr/local/nginx/sbin/nginx-T
# A message indicating success
# nginx: the configuration file/usr/local/nginx/CONF/nginx. conf syntax is OK
# nginx: configuration file/usr/local/nginx/CONF/nginx. conf test is successful
# enable nginx
/usr/local/nginx/sbin/nginx &
#Restart nginx smoothly
/Usr/local/nginx/sbin/nginx-s reload
# Add boot start
VI/etc/rc. d/rc. Local
# Final transfer
/Usr/local/nginx/sbin/nginx
#Test
CD/usr/local/nginx/html/
Touch index. php
VI/usr/local/nginx/html/index. php
<? PHP
Phpinfo ();
?>
Allow anyone to repost and help more people to solve problems:
Original article link: http://www.cnblogs.com/wubaiqing/archive/2011/11/08/2241195.html
Author: Wu Xiaoqing