Ubuntu14.04 64bit compile and install nginx1.7+php5.4+mysql5.6

Source: Internet
Author: User
Tags fpm mcrypt parent directory pear syslog

My operating system is Ubuntu14.04, and other Linux systems operate in a similar process.

The main software installed is nginx1.7+php5.4+mysql5.6

1. Create the necessary directories
sudo mkdir ~/setupsudo mkdir/opt/softwaresudo chmod 777/opt/software

2. Download the necessary software
CD ~/downloadswget Http://am1.php.net/distributions/php-5.4.29.tar.gztar zxvf ~/downloads/php-5.4.29.tar.gz-c ~/ Setup/wget http://nginx.org/download/nginx-1.7.1.tar.gztar zxvf ~/downloads/nginx-1.7.1.tar.gz-c ~/setup/wget http ://cdn.mysql.com/downloads/mysql-5.6/mysql-5.6.19-linux-glibc2.5-x86_64.tar.gztar zxvf ~/Downloads/ Mysql-5.6.19-linux-glibc2.5-x86_64.tar.gz-c ~/setup/wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ Pcre-8.33.tar.gztar zxvf ~/downloads/pcre-8.33.tar.gz-c ~/setup/wget Http://www.ijg.org/files/jpegsrc.v9.tar.gztar ZXVF ~/downloads/jpegsrc.v9.tar.gz-c ~/setup/wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz ~/ Downloadstar zxvf ~/downloads/libpng-1.6.2.tar.gz-c ~/setup/wget http://download.savannah.gnu.org/releases/ Freetype/freetype-2.4.12.tar.gztar zxvf ~/downloads/freetype-2.4.12.tar.gz-c ~/setup/wget/http Downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gztar ZXVF ~/downloads/mhash-0.9.9.9.tar.gz-c ~/setup/wget http ://downloaDs.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gztar zxvf ~/downloads/libmcrypt-2.5.8.tar.gz-c ~/setup/wget/http Downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gztar zxvf ~/downloads/mcrypt-2.6.8.tar.gz-c ~/setup/wget ftp:// Ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gztar zxvf ~/downloads/termcap-1.3.1.tar.gz-c ~/setup/wget/http Ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gztar zxvf ~/downloads/autoconf-latest.tar.gz-c ~/setup/wget/http Ftp.gnu.org/gnu/m4/m4-latest.tar.gztar zxvf ~/downloads/m4-latest.tar.gz-c ~/setup/wget http://pecl.php.net/get/ Memcache-2.2.7.tgztar ZXVF ~/downloads/memcache-2.2.7.tgz-c ~/setup/

The above software I have already packaged to put in Baidu Net disk, related link: Http://pan.baidu.com/s/1o6DL4EI

3. Installing Nginx
sudo apt-get install libpcre3 libpcre3-devsudo apt-get install Libssl-dev OpenSSL libcurl4-openssl-devsudo apt-get instal L Build-essentialsudo/usr/sbin/groupadd wwwsudo/usr/sbin/useradd-g www wwwcd ~/setup/pcre-8.33/./configure--prefix= /opt/software/pcresudo make && sudo make installcd. /nginx-1.7.1/./configure--user=www--group=www--prefix=/opt/software/nginx--with-http_stub_status_module-- With-http_ssl_module--with-pcre=~/setup/pcre-8.33--with-http_realip_modulesudo make && sudo make install

4. Install MySQL
CD ~/setupsudo MV Mysql-5.6.19-linux-glibc2.5-x86_64/opt/software/mysqlsudo mkdir-p/opt/software/mysql/datasudo Apt-get install libaio-devsudo/usr/sbin/groupadd mysqlsudo/usr/sbin/useradd-g mysql mysql/opt/software/mysql/ scripts/mysql_install_db--basedir=/opt/software/mysql--datadir=/opt/software/mysql/data--user=mysqlsed-i "s#/ Usr/local/mysql#/opt/software/mysql#g "/opt/software/mysql/bin/mysqld_safe# start the MySQL process/opt/software/mysql/bin/ Mysqld--basedir=/opt/software/mysql--datadir=/opt/software/mysql/data >/dev/null 2>&1# Set the root password to 123456 /opt/software/mysql/bin/mysqladmin-u root password ' 123456 '

5. Installing PHP Dependent libraries
CD ~/setupsudo mkdir-p/opt/software/libs/cd jpeg-9/./configure--prefix=/opt/software/libs--enable-shared-- Enable-static--prefix=/opt/software/libssudo make && sudo make installcd. /libpng-1.6.2/./configure--prefix=/opt/software/libssudo make && sudo make installcd. /freetype-2.4.12/./configure--prefix=/opt/software/libssudo make && sudo make installcd. /libmcrypt-2.5.8/./configure--prefix=/opt/software/libssudo make && sudo make install# Note this is not a return to the parent directory, But in the current directory CD libltdl/./configure--prefix=/opt/software/libs--enable-ltdl-installsudo make && sudo make Installcd. /.. /mhash-0.9.9.9/./configure--prefix=/opt/software/libssudo make && sudo make install

6. Setting the class library load path
sudo vim/etc/ld.so.conf.d/opt-software-libs.conf input/opt/software/libs/lib and then sudo ldconfigcd. /mcrypt-2.6.8/export ldflags= "-l/opt/software/libs/lib-l/usr/lib" Export cflags= "-i/opt/software/libs/include-i/ Usr/include "Touch malloc.h./configure--prefix=/opt/software/libs--with-libmcrypt-prefix=/opt/software/libssudo Make && sudo make installcd. /termcap-1.3.1/./configure--prefix=/opt/software/libssudo make && sudo make install

7. Install PHP
sudo apt-get install libxml2-devexport libs= "-lm-ltermcap-lresolv" Export dyld_library_path= "/opt/software/mysql/lib /:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64 "Export ld_library_path="/opt/software/ Mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64 "CD. /php-5.4.29/./configure--prefix=/opt/software/php--with-config-file-path=/opt/software/php/etc--with-mysql=/ Opt/software/mysql--with-mysqli=/opt/software/mysql/bin/mysql_config--with-iconv-dir--with-freetype-dir=/opt/ Software/libs--with-jpeg-dir=/opt/software/libs--with-png-dir=/opt/software/libs--with-zlib--with-libxml-dir=/ usr--enable-xml--disable-rpath--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization-- With-curl--enable-mbregex--enable-fpm--enable-mbstring--with-mcrypt=/opt/software/libs--WITH-GD-- Enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip-- Enable-soapsudo ln-s/opt/soFtware/mysql/lib/libmysqlclient.so.18/usr/lib/wget Http://pear.php.net/go-pear.pharsudo MV go-pear.phar/opt/ Software/php/binsudo make && sudo make installsudo cp Php.ini-development/opt/software/php/etc/php.inisudo LN- S/opt/software/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylibsudo cp/opt/software/php/etc/ Php-fpm.conf.default/opt/software/php/etc/php-fpm.conf

8. Installing PHP Extensions
Cd.. /m4-1.4.17/./configure--prefix=/opt/software/libssudo make && sudo make installexport path=/home/davidhhuan/ setup/m4-1.4.17: $PATHCD. /autoconf-2.69/./configure--prefix=/opt/software/libssudo make && sudo make installcd. /memcache-2.2.7/export php_autoconf= "/opt/software/libs/bin/autoconf" Export php_autoheader= "/opt/software/libs/ Bin/autoheader "/opt/software/php/bin/phpize./configure--with-php-config=/opt/software/php/bin/php-configsudo Make && sudo make install

9. Set up boot from boot

Nginx

sudo vim/etc/init.d/nginx

The contents are as follows

#! /bin/sh### BEGIN INIT info# provides:nginx# required-start: $local _fs $remote _fs $network $syslog # required-s Top: $local _fs $remote _fs $network $syslog # default-start:2 3 4 AA default-stop:0 1 6# short-description:s Tarts the Nginx Web server# description:starts nginx using start-stop-daemon### END INIT infopath=/usr/local/sbin:/ Usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bindaemon=/opt/software/nginx/sbin/nginxname=nginxdesc=nginxdaemon_ opts= ' Test-x $DAEMON | | Exit 0# Include Nginx defaults if available#if [-f/etc/default/nginx]; then#. /etc/default/nginx#fiset-e./lib/lsb/init-functions#test_nginx_config () {# if $DAEMON-t $DAEMON _opts# then# return 0# else# return $?# fi#}case "$" in start) echo-n "Starting $DESC:" Start-stop-daemon--start--qui ET--pidfile/var/run/$NAME. PID--exec $DAEMON | |        True echo "$NAME."  ;; Stop) echo-n "stopping $DESC:" Start-stop-daemOn--stop--quiet--pidfile/var/run/$NAME. PID--exec $DAEMON | |        True echo "$NAME."  ;;                 Restart|force-reload) Echo-n "Restarting $DESC:" Start-stop-daemon--stop--quiet--pidfile /var/run/$NAME. PID--exec $DAEMON | | True sleep 1 Start-stop-daemon--start--quiet--pidfile/var/run/$NAME. PID--exec $DAEMON | |        True echo "$NAME."  ;; Reload) echo-n "Reloading $DESC configuration:" Start-stop-daemon--stop--signal HUP--quiet--pidfile/v ar/run/$NAME. PID--exec $DAEMON | |        True echo "$NAME."  ;; Status) status_of_proc-p/var/run/$NAME. pid "$DAEMON" Nginx && exit 0 | |        Exit $?  ;; *) echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2 exit 1;; Esacexit 0

sudo update-rc.d nginx defaults

php-fpm

sudo cp/opt/setup/php-5.4.29/sapi/fpm/init.d.php-fpm.in/etc/init.d/php-fpmsudo groupadd nobodysudo touch/opt/ Software/php/var/run/php-fpm.pidsudo UPDATE-RC.D php-fpm Defaults
vim/etc/init.d/php-fpm

Replace the following:

[Email protected]@[email protected][email protected][email protected]@/php-fpm[email protected]@/php-fpm.conf[email Protected]@/run/php-fpm.pid

Become

Prefix=/opt/software/phpexec_prefix=/opt/software/php/binphp_fpm_bin=/opt/software/php/sbin/php-fpmphp_fpm_ Conf=/opt/software/php/etc/php-fpm.confphp_fpm_pid=/opt/software/php/var/run/php-fpm.pid

Mysql

sudo cp/opt/software/mysql/support-files/mysql.server/etc/init.d/mysqldsudo vim/etc/init.d/mysqld# find basedir= datadir= #变成basedir =/opt/software/mysqldatadir=/opt/software/mysql/datasudo update-rc.d mysqld Defaults

10. Adding environment variables
sudo vim/etc/profile

Join

Export path= $PATH:/opt/software/mysql/bin:/opt/software/php/bin:/opt/software/php/sbin:/opt/software/mysql/bin

Load

Source/etc/profile

At this point, it's basically ready to use.

Ubuntu14.04 64bit compile and install nginx1.7+php5.4+mysql5.6

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.