CentOS 6.5 compiled with nginx1.6.0+mysql5.6.19+php5.5.14 installed

Source: Internet
Author: User
Tags create directory curl fpm gettext install php install openssl openssl



CentOS 6.5 compiled with nginx1.6.0+mysql5.6.19+php5.5.14 installed
---------------------------------------------------------------------------------------------



Installation package:http://pan.baidu.com/s/1jG8iose



Securecrt:http://pan.baidu.com/s/1kttnfkv



Flashfxp:http://pan.baidu.com/s/1hq2gigw



---------------------------------------------------------------------------------------------






--------------------Configure the firewall to turn on 80 port, 3306 port----Start--------------------
Vi / etc / sysconfig / iptables #Edit firewall configuration files
# Add the following two lines
# -A input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT
# -A input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT





################################################### ###################
# Firewall configuration written by System-config-firewall
# Manual Customization of this file are not recommended.
* filter
: INPUT ACCEPT [0: 0]
: FORWARD ACCEPT [0: 0]
: OUTPUT ACCEPT [0: 0]
-A input-m state--state established, related-j ACCEPT
-A input-p icmp-j ACCEPT
-A input-i lo-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
-A input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
COMMIT
################################################### ###################
: wq! #Save and exit





Service iptables Restart # Restart firewall
Chkconfig iptables on # enabled after permanent shutdown
-------------------- Configure the firewall to turn on port 80, 3306 port ---- End -------------- ------





-------------------- Turn off selinux ---- start --------------------
Vi / etc / selinux / config





#SELINUX = enforcing #comment out
Selinux = disabled #Increase
: wq! #Save and exit
Setenforce 0 #Make configuration take effect immediately (temporarily off, or restart)
-------------------- Close the SELinux ---- End --------------------






Mkdir-p / data / tgz #Installation package directory
Cd / data / tgz
Yum Install wget





# Installation Dependencies
Yum install-y apr * autoconf automake bison bzip2 bzip2 * cloog-ppl compat * cpp Curl Curl-devel fontconfig Fontconfig-devel FreeType freetype * freetype-devel gcc gcc-c ++ gtk + -devel gd gettext gettext-devel glibc kernel kernel-headers keyutils ke Yutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg * libsepol-devel libselinux-devel libstdc ++-Devel libtool * libgomp libxml2 libxml2-devel libxpm * libtiff libtiff * make MPFR ncurses * ntp OpenSSL openssl-devel Cre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib * nasm nasm * wget zlib-devel






-------------------- install MySQL ---- start --------------------
# Install CMake
Cd / data / tgz
Tar zxvf cmake-2.8.11.2.tar.gz
CD cmake-2.8.11.2
./configure
Gmake
Gmake Install



# install MySQL
Groupadd MySQL #Add mysql group
Useradd-g mysql-m mysql-s / sbin / nologin #Create user without creating user directory mysql and join to mysql group, MySQL users are not allowed to log in directly to the system
Mkdir-p / data / data / mysql #Create a MySQL database storage directory
Chown-r Mysql: mysql / data / data / mysql #Set MySQL database storage directory permissions
Mkdir-p / data / apps / mysql #Create a MySQL installation directory
Cd / data / tgz #Enter the package storage directory
Tar zxvf mysql-5.6.19.tar.gz #Unzip
CD mysql-5.6.19 #Enter the directory
CMake. -Dcmake_install_prefix = / data / apps / mysql-dmysql_datadir = / data / data / mysql-dsysconfdir = / etc #Configuration
Gmake #compile
Gmake Install #install
RM-RF / ETC / MY.CNF #Delete the system default configuration file (if not removed by default)
Cd / data / apps / mysql #Enter the MySQL installation directory
./scripts/mysql_install_db--user=mysql--basedir=/data/apps/mysql--datadir=/data/data/mysql #Generate the mysql system database
Ln-s / data / apps / mysql / my.cnf / etc / my.cnf #Add to / etc directory soft connection
CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQLD #Add Mysql to the system and start
chmod 755 / etc / init.d / mysqld #Add execute permission
Chkconfig mysqld on #Join startup
Vi / etc / rc.d / init.d / mysqld #Edit
####################################
Basedir = / data / apps / mysql #MySQL program installation path
Datadir = / data / data / mysql #MySQl database storage directory
####################################
Service mysqld Start #Start
Vi / etc / profile #Add the mysql service to the system environment variables: Add the following line at the end
Export path = $ PATH: / data / apps / mysql / bin
Source / etc / profile
# The following two lines link the MYSLQ library file to the default location of the system, so you can compile software like PHP without specifying the MySQL library file address.
Ln-s / data / apps / mysql / lib / mysql / usr / lib / mysql
Ln-s / data / apps / mysql / include / mysql / usr / include / mysql
Mkdir / var / lib / mysql #create directory
Ln-s / tmp / mysql.sock / var / lib / mysql / mysql.sock #Add soft link
Mysql_secure_installation #Set Mysql password


































, press Y to enter the password 2 times according to the prompt


-----------The test installation is successful-----------
# mysql-u Root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1
Server version:5.5.22 Source Distribution
Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
# mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.07 sec)
# mysql> exit;
Bye
--------------------install MySQL----end--------------------






--------------------Installing the Nginx----start--------------------



# Install Pcre
Cd/data/tgz
Mkdir/data/apps/pcre
Tar zxvf pcre-8.35.tar.gz
CD pcre-8.35
./configure--prefix=/data/apps/pcre
Make
Make install



# Install OpenSSL
Cd/data/tgz
Mkdir/data/apps/openssl
Tar zxvf openssl-1.0.1h.tar.gz
CD openssl-1.0.1h
./config--prefix=/data/apps/openssl
Make
Make install
Vi/etc/profile
Export path= $PATH:/data/apps/openssl/bin
: wq!
Source/etc/profile



# Install Zlib
Cd/data/tgz
Mkdir/data/apps/zlib
Tar zxvf zlib-1.2.8.tar.gz
CD zlib-1.2.8
./configure--prefix=/data/apps/zlib
Make
Make install



# Install Nginx
Groupadd www
Useradd-g www-m www-s/sbin/nologin
Cd/usr/local/src
Tar zxvf nginx-1.6.0.tar.gz
CD nginx-1.6.0
./configure--prefix=/data/apps/nginx--without-http_memcached_module--user=www--group=www--with-http_stub_ Status_module--with-http_ssl_module--with-http_gzip_static_module--with-openssl=/data/tgz/openssl-1.0.1h-- with-zlib=/data/tgz/zlib-1.2.8--with-pcre=/data/tgz/pcre-8.35
Make
Make install
/data/apps/nginx/sbin/nginx #启动nginx



Vi/etc/rc.d/init.d/nginx #添加下面脚本, attention to modify nginx and nginx_conf_file content
##################################################################
#!/bin/sh
#
# Nginx-this script starts and stops the Nginx daemon
#
# Chkconfig:-85 15
# Description:nginx is an HTTP (s) server, HTTP (s) reverse \
# Proxy and IMAP/POP3 proxy server
# Processname:nginx
# config:/etc/nginx/nginx.conf
# config:/etc/sysconfig/nginx
# Pidfile:/var/run/nginx.pid



# Source function library.
. /etc/rc.d/init.d/functions



# Source Networking configuration.
. /etc/sysconfig/network



# Check that networking are up.
["$NETWORKING" = "no"] && exit 0



nginx= "/data/apps/nginx/sbin/nginx"
prog=$ (basename $nginx)



Nginx_conf_file= "/data/apps/nginx/conf/nginx.conf"



[-f/etc/sysconfig/nginx] &&. /etc/sysconfig/nginx



Lockfile=/var/lock/subsys/nginx



Make_dirs () {
# Make required Directories
User= ' $nginx-v 2>&1 | grep "Configure arguments:" | Sed ' s/[^*]*--user=\ ([^]*\). */\1/g '-'
If [-Z ' grep $user/etc/passwd ']; Then
Useradd-m-s/bin/nologin $user
Fi
Options= ' $nginx-v 2>&1 | grep ' Configure arguments: '
for opt in $options; Do
If [' Echo $opt | grep '. *-temp-path ']; Then
Value= ' echo $opt | Cut-d "="-F 2 '
if [!-D "$value"]; Then
# echo "Creating" $value
Mkdir-p $value && chown-r $user $value
Fi
Fi
Done
}



Start () {
[-X $nginx] | | Exit 5
[-F $NGINX _conf_file] | | Exit 6
Make_dirs
Echo-n $ "Starting $prog:"
Daemon $nginx-C $NGINX _conf_file
Retval=$?
Echo
[$retval-eq 0] && Touch $lockfile
Return $retval
}



Stop () {
Echo-n $ "Stopping $prog:"
Killproc $prog-quit
Retval=$?
Echo
[$retval-eq 0] && rm-f $lockfile
Return $retval
}



Restart () {
Configtest | | Return $?
Stop
Sleep 1
Start
}



Reload () {
Configtest | | Return $?
Echo-n $ "Reloading $prog:"
Killproc $nginx-hup
Retval=$?
Echo
}



Force_reload () {
Restart
}



Configtest () {
$nginx-T-C $NGINX _conf_file
}



Rh_status () {
Status $prog
}



Rh_status_q () {
Rh_status >/dev/null 2>&1
}



Case "$" in
Start
Rh_status_q && Exit 0
$
;;
Stop
Rh_status_q | | Exit 0
$
;;
Restart|configtest)
$
;;
Reload
Rh_status_q | | Exit 7
$
;;
Force-reload)
Force_reload
;;
Status
Rh_status
;;
Condrestart|try-restart)
Rh_status_q | | Exit 0
;;
*)
echo $ "Usage: $ {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
Exit 2
Esac
##################################################################
Chkconfig nginx on #Set up nginx boot
Service Nginx Restart #Restart nginx





-------------------- Installing the Nginx ---- End --------------------





-------------------- Install PHP ---- Start --------------------
# Install Yasm
Cd / data / tgz
Tar zxvf yasm-1.2.0.tar.gz
CD yasm-1.2.0
./configure
Make
Make install





# Install Libmcrypt
Cd / data / tgz
Tar zxvf libmcrypt-2.5.8.tar.gz
CD libmcrypt-2.5.8
./configure
Make
Make install





# Install LIBVPX
Cd / data / tgz
Tar xvf libvpx-v1.3.0.tar.bz2
CD libvpx-v1.3.0
./configure--PREFIX=/DATA/APPS/LIBVPX--enable-shared--ENABLE-VP9
Make
Make install





# Install TIFF
Cd / data / tgz
Tar zxvf tiff-4.0.3.tar.gz
CD tiff-4.0.3
./configure--prefix=/data/apps/tiff--enable-shared
Make
Make install





# Install Libpng
Cd / data / tgz
Tar zxvf libpng-1.6.12.tar.gz
CD libpng-1.6.12
./configure--prefix=/data/apps/libpng--enable-shared
Make
Make install





# Install FreeType
Cd / data / tgz
Tar zxvf freetype-2.5.3.tar.gz
CD freetype-2.5.3
./configure--prefix=/data/apps/freetype--enable-shared
Make
Make install





# Install JPEG
Cd / data / tgz
Tar zxvf jpegsrc.v9a.tar.gz
CD jpeg-9a
./configure--prefix=/data/apps/jpeg--enable-shared
Make
Make install





# Install LIBGD
Cd / data / tgz
Tar zxvf libgd-2.1.0.tar.gz
CD libgd-2.1.0
./configure--PREFIX=/DATA/APPS/LIBGD--enable-shared--with-jpeg=/data/apps/jpeg--with-png=/Data/apps/libpng-- With-freetype = / data / apps / freetype--with-fontconfig = / data / apps / freetype--with-xpm = / data /-with-tiff = / Data / apps / TIFF--WITH-VPX = / DATA / APPS / LIBVPX
Make
Make install





# Install T1lib
Cd / data / tgz
Tar zxvf t1lib-5.1.2.tar.gz
CD t1lib-5.1.2
./configure--prefix=/data/apps/t1lib--enable-shared
Make Without_doc
Make install





# Install PHP
Note: If the system is 64-bit, please execute the following two commands, otherwise the installation of PHP will be wrong (32-bit system does not need to do)
Ln-s / usr / lib64 / libltdl.so / usr / lib / libltdl.so
\ cp-frp / usr / lib64 / libxpm.so * / usr / lib /



Cd / data / tgz
TAR-ZVXF php-5.5.14.tar.gz
CD php-5.5.14
Export Ld_library_path = / data / apps / libgd / lib
./configure--prefix=/data/apps/php--with-config-file-path=/data/apps/php/etc--with-mysql=/Data/apps/mysql-- With-mysqli = / data / apps / mysql / bin / mysql_config--with-mysql-sock = / tmp / mysql.sock--with-pdo-mysql = / Data / apps / MySQL--with-gd--with-png-dir = / data / apps / libpng--with-jpeg-dir = / data / apps / jpeg--with-freetype-dir = / data / apps / FreeType--with-xpm-dir = / data /-with-vpx -dir = / data / apps / libvpx /-with-zlib-dir = / data / apps / zlib--with-t1lib = / Data / apps / t1lib--with-iconv--enable-libxml--enable- xml--enable-bcmath--enable-shmop--enable-sysvsem-- Enable-inline-optimization--enable-opcache--enable-mbregex--enable-fpm--enable-mbstring--enable-ftp-- Enable-gd-native-ttf--with-openssl--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap-- Without-pear--with-gettext--enable -session--with-mcrypt--with-curl--enable-ctype #Configuration
Gmake #compile
Gmake Install #install



CP Php.ini-production / data / apps / php / etc / php.ini #Copy the php configuration file to the installation directory
Rm-rf / etc / php.ini #Delete the system's own configuration file
Ln-s / data / apps / php / etc / php.ini / etc / php.ini #Add soft link to / etc Directory
cp / data / apps / php / etc / php-fpm.conf.default / data / apps / php / etc / php-fpm.conf #Copy the template file as php-fpm configuration file
Ln-s / data / apps / php / etc / php-fpm.conf / etc / php-fpm.conf #Add soft link to / etc Directory





Vi / data / apps / php / etc / php-fpm.conf #edit
###################################################
user = www #setting php-fpm run account is www
Group = www #Set php-fpm run Group is www
PID = Run / php-fpm.pid #Cancel the preceding semicolon
###################################################
: wq! #Save and exit





#Set php-fpm boot up
CP / DATA / TGZ / PHP-5.5.14 / SAPI / FPM / INIT.D.PHP-FPM / ETC / RC.D / INIT.D / PHP-FPM #Copy php-fpm to startup directory
chmod + x / etc / rc.d / init.d / php-fpm #Add execute permission
Chkconfig PHP-FPM on #



Vi / data / apps / php / etc / php.ini #Edit configuration file
###################################################
Found: Disable_functions =
Modified to: Disable_functions = Passthru, exec, system, chroot, scandir, chgrp, chown, shell_exec, proc_open, proc_get_status, ini_alter, ini_alter, ini_restore, dl, openlog, syslog, readlink, symlink, popepassthru, stream_socket_server, Escapeshellcmd, dll popen, disk_free_space, checkdnsrr, checkdnsrr, getservbyname, getservbyport, disk_total_space, POSIX_CTERMID, POSIX_GET_LAST_ERROR, POSIX_GETCWD, Posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_ getgrnam, posix_getgroups, posix_getlogin, posix_getpgid, posix_getpgrp, posix_getpid, Posix_getppid, posix_getpwnam, Posix_getpwuid, Posix_getrlimit, Posix_getsid , posix_getuid, posix_isatty, Posix_kill, posix_mkfifo, posix_setegid, Posix_seteuid, posix_setgid, Posix_setpgid, posix_setsid, posix_setuid, posix_strerror, posix_times, posix_ttyname, Posix_u
#List the functions that PHP can disable, if some programs need to use this function, you can delete, cancel disable.
Found:; d Ate.timezone =
Modified to: Date.timezone = PRC #Set the time zone
Found: expose_php = On
Modified to: expose_php = Off #Suppress the display of PHP version information
Found: Short_open_tag = Off
Modified to: Short_open_tag = on #Support php short tags
Found: opcache.enable = 0
Modified to Opcache.enable = 1 #php supports opcode caching
Found: Opcache.enable_cli = 1
Modified to: Opca
che.enable_cli = 0 #php supports opcode caching
Added on last line: Zend_extension = opcache.so #Enable opcode caching
###################################################
: wq! #Save and exit
-------------------- Install the PHP ---- End --------------------









Configuring Nginx Support PHP
Vi / data / apps / nginx / conf / nginx.conf
Modify the / data / apps / nginx / conf / nginx.conf configuration file, you need to make the following changes
###################################################
User www www; #First line user remove the comment, modify the Nginx run group to www www; must be the same as the User, group configuration in / data / apps / php / etc / php-fpm.conf, or PHP will run in error
Index index.html index.htm index.php; #Add index. Php
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
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;
}
###################################################





Vi / data / apps / nginx / conf / fastcgi_params
To modify the / data / apps / nginx / conf / fastcgi_params configuration file, add the following
###################################################
Fastcgi_param script_filename $ document _root $ fastcgi_script_name;
###################################################





Service Nginx Restart #Restart nginx
Service php-fpm Restart #Start php-fpm





Test article
cd / data / apps / nginx / html / # Enter the nginx default website root directory
rm-rf / data / apps / nginx / html / * #Delete the default test page





VI index.php #New index. Php file
<? php
Phpinfo ();
?>





: wq! #Save and exit





Chown www.www / Data / apps / nginx / html / -R #Set directory owner
chmod 700 / data / apps / nginx / html / -R #Set directory permissions



Open the server IP address in the browser, you will see the following interface



At this point, the CentOS 6.5 compilation installation nginx1.6.0+mysql5.6.19+php5.5.14 tutorial is complete.






CentOS 6.5 compiled with nginx1.6.0+mysql5.6.19+php5.5.14 installed


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.