Disable SELINUX
Vi/etc/selinux/config
# SELINUX = enforcing # comment out
# SELINUXTYPE = targeted # comment out
SELINUX = disabled # Add
: Wq! # Save and exit
Setenforce 0 # Make the configuration take effect immediately
Install mysql 5.5.28
Installation path:/usr/local/mysql
Database path:/usr/local/mysql/data/
Mysql starts from Version 5.5 and does not use./configure for compilation. Instead, it uses the cmake compiler. For specific cmake compilation parameters, refer to the mysql official website documentation.
Http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html
Add MYSQL users and groups
[Root @ localhost tools] # groupadd mysql
[Root @ localhost tools] # useradd mysql-g mysql-s/sbin/nologin
[Root @ localhost tools] # yum install cmake make-y
[Root @ localhost tools] # yum-y install gcc-c ++ autoconf bison automake zlib * fiex * libxml * ncurses-devel libmcrypt * libtool-ltdl-devel * # install Dependencies package
[Root @ localhosttools] # cd mysql-5.5.28-linux2.6-i686
Configure compilation Parameters
[Root @ localhost tools] # cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_DATADIR =/usr/local/mysql/data /\
-DMYSQL_TCP_PORT = 3306
[Root @ localhost tools] # CMake Error: The source directory "/root/tools/mysql-5.5.28-linux2.6-x86_64" does not appear to contain CMakeLists.txt.
The above error occurs during compilation and installation. After a GOOGLE error is found, the downloaded package is faulty. Go to http://downloads.mysql.com/archives/community/to download the source code, and select 5.5.28,
Select Platform: Select Source Code here, and find Generic Linux (Architecture Independent) and Compressed TAR archive(mysql-5.28.tar.gz) at the bottom to download
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd/usr/local
[Root @ localhost tools] # chown mysql. mysql-R mysql # Set MYSQL Directory Permissions
[Root @ localhost tools] # cd mysql
[Root @ localhost tools] # cp support-files/my-medium.cnf/etc/my. cnf # copy the configuration file
[Root @ localhost tools] #./scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data/
[Root @ localhost tools] # cp support-files/mysql. server/etc/init. d/mysqld
[Root @ localhost tools] # chkconfig mysqld on # Set startup
[Root @ localhost tools] # service mysqld start # start the mysql service
[Root @ localhost tools] #/usr/local/mysql/bin/mysqladmin-u root password '000000' # Set the mysql root User password
Delete records with empty root passwords
[Root @ localhost tools] #/usr/local/mysql/bin/mysql-u root-p # enter the password you just set
Mysql> use mysql;
Mysql> delete from user where password = '';
Mysql> flush privileges; # update Permissions
Mysql> grant all privileges on *. * to root @ '%' identified by "root"; # Allow Remote Login by the ROOT user
Mysql> flush privileges;
Mysql> quit
Installation of php-5.3.28
Install dependency packages
[Root @ localhost tools] # yum-y install 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
[Root @ localhost tools] # yum-y install gd-devel libjpeg-devel libpng-devel freeetype-devel libxml2-devel curl-devel freetype-devel
# Nginx
[Root @ localhost tools] # yum-y install pcre-devel
# Download PHP library files
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
Wget http://nchc.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2
# Nginx
Wget http://nginx.org/download/nginx-1.5.10.tar.gz
# Nginx (pcre)
Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz
Decompress the downloaded library folder
[Root @ localhosttools] # cd libiconv-1.14
[Root @ localhost tools] #./configure -- prefix =/usr/local
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ../
[Root @ localhosttools] # cd libmcrypt-2.5.8
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] #/sbin/ldconfig # cache all library files to ld. so. cache to avoid missing library files during compilation.
[Root @ localhost tools] # cd ../
[Root @ localhost tools] # cd libltdl
[Root @ localhost tools] #./configure -- enable-ltdl-install
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ../../
[Root @ localhosttools] # cd mhash-0.9.9.9
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ../
[Root @ localhost tools] # ln-s/usr/local/lib/libmcrypt. la/usr/lib/libmcrypt. la
[Root @ localhost tools] # ln-s/usr/local/lib/libmcrypt. so/usr/lib/libmcrypt. so
[Root @ localhost tools] # ln-s/usr/local/lib/libmcrypt. so.4/usr/lib/libmcrypt. so.4
[Root @ localhost tools] # ln-s/usr/local/lib/libmcrypt. so.4.4.8/usr/lib/libmcrypt. so.4.4.8
[Root @ localhost tools] # ln-s/usr/local/lib/libmhash. a/usr/lib/libmhash.
[Root @ localhost tools] # ln-s/usr/local/lib/libmhash. la/usr/lib/libmhash. la
[Root @ localhost tools] # ln-s/usr/local/lib/libmhash. so/usr/lib/libmhash. so
[Root @ localhost tools] # ln-s/usr/local/lib/libmhash. so.2/usr/lib/libmhash. so.2
[Root @ localhost tools] # ln-s/usr/local/lib/libmhash. so.2.0.1/usr/lib/libmhash. so.2.0.1
[Root @ localhost tools] # ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
[Root @ localhost tools] # ln-s/usr/local/mysql/lib/libmysqlclient. so/usr/lib/
[Root @ localhost tools] # ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib/libmysqlclient. so.18
[Root @ localhosttools] # cd mcrypt-2.6.8
[Root @ localhost tools] #/sbin/ldconfig
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ../
[Root @ localhosttools] # cd php-5.3.28
[Root @ localhost tools] #. /configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-mysql =/usr/local/mysql -- with-mysqli =/usr/local/mysql/bin/mysql_config -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-libxml -dir =/usr -- enable-xml -- disable-rpath -- enable-discard-path -- enable-safe-mode -- enable-bcmath -- enable-shmop -- enable-sysvsem -- enable- inline-optimization -- with-curl -- with-curlwrappers -- enable-mbregex -- enable-fastcgi -- enable-fpm -- enable-force-cgi-redirect -- enable-mbstring -- with-mcrypt -- with-gd -- enable-gd-native-ttf -- with-openssl -- with-mhash -- enable-pcntl -- enable-sockets -- with-ldap-sasl --- xmlrpc -- enable-zip -- enable-soap
[Root @ localhost tools] # make & make install
[Root @ localhost tools] #
[Root @ localhost tools] # cp php. ini-production/usr/local/php/etc/php. ini
[Root @ localhost tools] # ln-s/usr/local/php/etc/php. ini/etc/php. ini
[Root @ localhost tools] # cp sapi/fpm/init. d. php-fpm/etc/init. d/php-fpm
[Root @ localhost tools] # chmod a + x/etc/init. d/php-fpm
[Root @ localhost tools] # chkconfig php-fpm on
[Root @ localhost tools] # cd/usr/local/php/etc/
[Root @ localhost tools] # cp php-fpm.conf.default php-fpm.conf
[Root @ localhost tools] # vi php-fpm.conf
Remove; pid = run/the semicolon before the php-fpm.pid => pid = run/php-fpm.pid
Change user = nobody to user = www
Change group = nobody to group = www
Save and exit
[Root @ localhost tools] # cd/root/tool
[Root @ localhost tools] # tar-xjvf eaccelerator-0.9.6.1.tar.bz2
[Root @ localhosttools] # cd eaccelerator-0.9.6.1
[Root @ localhost tools] #/usr/local/php/bin/phpize
[Root @ localhost tools] #./configure -- enable-eaccelerator = shared -- with-php-config =/usr/local/php/bin/php-config
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # mkdir/tmp/eaccelerator
[Root @ localhost tools] # chmod 0777/tmp/eaccelerator
[Root @ localhost tools] # vi/etc/php. ini
Modify; extension_dir = "./" to extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626"
Add at the end
[Eaccelerator]
Zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator. so"
Eaccelerator. shm_size = "128"
Eaccelerator. cache_dir = "/tmp/eaccelerator"
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "3600"
Eaccelerator. shm_prune_period = "3600"
Eaccelerator. shm_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"
: X save and exit
Restart PHP
[Root @ localhost tools] #/etc/rc. d/init. d/php-fpm restart
Install NGINX 1.2.9
[Root @ localhosttools] # cd pcre-8.34
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ..
[Root @ localhosttools] # cd nginx-1.2.9
[Root @ localhost tools] #./configure -- prefix =/usr/local/nginx -- user = www -- group = www -- with-http_ssl_module -- with-http_realip_module -- with-http_gzip_static_module -- with-http_stub_status_module -- with-pcre
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # ulimit-shn65535
[Root @ localhost tools] # ln-s/usr/local/lib/libpcre. so.1/lib # solve the problem that libpcre. so.1 cannot be found at startup.
[Root @ localhost tools] # vi/usr/local/nginx/conf/nginx. conf
# Nginx Configuration File Content
User www;
Worker_processes 1;
Error_log logs/error. log;
# Error_log logs/error. log notice;
# Error_log logs/error. log info;
Pid logs/nginx. pid;
Worker_rlimit_nofile 65535;
Events {
Use epoll;
Worker_connections 65535;
}
Http {
Include mime. types;
Default_type application/octet-stream;
# Log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request "'
# '$ Status $ body_bytes_sent "$ http_referer "'
# '"$ Http_user_agent" "$ http_x_forwarded_for "';
Access_log logs/access. log;
Charset UTF-8;
Server_names_hash_bucket_size 128; # size of the hash table with the server name
Client_header_buffer_size 32 k; # Set the size of the header buffer of the client request header
Large_client_header_buffers 4 64 k; # used to specify the maximum number and size of message headers cached in client requests
Client_max_body_size 8 m; # sets the maximum number of bytes for a single file that can be requested by the client.
Sendfile on; # enable the efficient File Transfer Mode
Tcp_nopush on; # prevent network congestion
Tcp_nodelay on; # prevent network congestion
Keepalive_timeout 60; # long connection timeout time, in seconds
# FastCGI parameters are used to improve website performance: reduce resource usage and increase access speed. The following parameters can be understood literally.
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
Fastcgi_buffer_size 64 k;
Fastcgi_buffers 4 64 k;
Fastcgi_busy_buffers_size 128 k;
Fastcgi_temp_file_write_size 128 k;
# Gzip Module Settings
Gzip on; # enable gzip compression output
Gzip_min_length 1 k; # minimum compressed file size
Gzip_buffers 4 16 k; # compression Buffer
# Gzip_http_version 1.0; # compression version (1.1 by default, use 1.0 if squid2.5 is the frontend)
Gzip_comp_level 2; # compression level
Gzip_types text/plain application/x-javascript text/css application/xml;
Gzip_vary on;
Server {
Listen 80;
Server_name www.test.com test.com 192.168.1.33;
Root/home/web/test;
# Charset UTF-8;
Access_log logs/test. access. log;
Index. php index.html index.htm;
Location /{
Root/home/web/test;
Index. php index.html index.htm;
}
# Error_page 404/404 .html;
# Redirect server error pages to the static page/50x.html
#
Error_page 500 502 503 x.html;
Location =/50x.html {
Root html;
}
# Proxy the PHP scripts to Apache listening on 127.0.0.1: 80
#
# Location ~ \. Php $ {
# Proxy_pass http: // 127.0.0.1;
#}
# Pass the PHP scripts to FastCGI server listening on Fig: 9000
#
Location ~ \. Php $ {
# Root html;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
# Fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name;
Include fastcgi. conf;
}
Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf) $
{
Expires 30d;
}
Location ~ . * \. (Js | css )? $
{
Expires 1 h;
}
# Deny access to. htaccess files, if Apache's document root
# Concurs with nginx's one
#
# Location ~ /\. Ht {
# Deny all;
#}
}
}
[Root @ localhost tools] # service iptables stop # disable the firewall. Otherwise, the website directory cannot be accessed.
Install memcache and imagemagick php Extension
Wget http://monkey.org /~ Provos/libevent-2.0.12-stable.tar.gz
Wget http://www.memcached.org/files/memcached-1.4.17.tar.gz
Wget http://pecl.php.net/get/memcache-3.0.8.tgz
Wget http://www.imagemagick.org/download/ImageMagick.tar.gz
Wget http://pecl.php.net/get/imagick-3.1.2.tgz
[Root @ localhosttools] # cd libevent-2.0.12-stable
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ..
[Root @ localhosttools] # cd memcached-1.4.17
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ..
[Root @ localhost tools] # ldconfig/usr/local/lib
[Root @ localhost tools] #/usr/local/bin/memcached-d-m 128-l 192.168.1.33-p 11211-u www # d daemon to daemon) run memcached-l listening address-m memory
[Root @ localhost tools] # cd memcache-3.0.8 # install PHP extensions
[Root @ localhost tools] #/usr/local/php/bin/phpize
[Root @ localhost tools] #./configure -- with-php-config =/usr/local/php/bin/php-config
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ..
Install imagemagick, image processing program and pdo php extension in linux
[Root @ localhosttools] # cd ImageMagick-6.8.9-0
[Root @ localhost tools] #./configure
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ..
[Root @ localhost tools] # cd imagick-3.1.2 # Install extensions under PHP
[Root @ localhost tools] #/usr/local/php/bin/phpize
[Root @ localhost tools] #./configure -- with-php-config =/usr/local/php/bin/php-config
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # cd ..
[Root @ localhost tools] # cd php-5.3.28/ext/pdo_mysql
[Root @ localhost tools] #/usr/local/php/bin/phpize
[Root @ localhost tools] #. /configure -- with-php-config =/usr/local/php/bin/php-config -- with-pdo-mysql =/usr/local/mysql/
[Root @ localhost tools] # make & make install
[Root @ localhost tools] # vi/etc/php. ini
Add extension = memcache. so
Extension = imagick. so
Extension = pdo_mysql.so