Ubuntu14.04 64bit 编译安装nginx1.7+php5.4+mysql5.6
我的操作系统是Ubuntu14.04,其它linux系统的操作流程类似。
主要安装的软件是nginx1.7+php5.4+mysql5.6
1. 创建必要目录
sudo mkdir ~/setup
sudo mkdir /opt/software
sudo chmod 777 /opt/software
2. 下载必要软件
cd ~/Downloads wget http://am1.php.net/distributions/php-5.4.29.tar.gz
tar zxvf ~/Downloads/php-5.4.29.tar.gz -C ~/setup/ wget http://nginx.org/download/nginx-1.7.1.tar.gz
tar 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.gz
tar 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.gz
tar zxvf ~/Downloads/pcre-8.33.tar.gz -C ~/setup/ wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
tar zxvf ~/Downloads/jpegsrc.v9.tar.gz -C ~/setup/ wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz ~/Downloads
tar zxvf ~/Downloads/libpng-1.6.2.tar.gz -C ~/setup/ wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
tar zxvf ~/Downloads/freetype-2.4.12.tar.gz -C ~/setup/ wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz
tar zxvf ~/Downloads/mhash-0.9.9.9.tar.gz -C ~/setup/ wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
tar zxvf ~/Downloads/libmcrypt-2.5.8.tar.gz -C ~/setup/ wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz
tar zxvf ~/Downloads/mcrypt-2.6.8.tar.gz -C ~/setup/ wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
tar zxvf ~/Downloads/termcap-1.3.1.tar.gz -C ~/setup/ wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar zxvf ~/Downloads/autoconf-latest.tar.gz -C ~/setup/ wget http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz
tar zxvf ~/Downloads/m4-latest.tar.gz -C ~/setup/ wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf ~/Downloads/memcache-2.2.7.tgz -C ~/setup/
以上软件我已经打包好放到百度网盘,相关链接:http://pan.baidu.com/s/1o6DL4EI
3. 安装nginx
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install libssl-dev openssl libcurl4-openssl-dev
sudo apt-get install build-essential sudo /usr/sbin/groupadd www
sudo /usr/sbin/useradd -g www www cd ~/setup/pcre-8.33/
./configure --prefix=/opt/software/pcre
sudo make && sudo make install cd ../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_module
sudo make && sudo make install
4. 安装MySQL
cd ~/setup
sudo mv mysql-5.6.19-linux-glibc2.5-x86_64 /opt/software/mysql
sudo mkdir -p /opt/software/mysql/data sudo apt-get install libaio-dev sudo /usr/sbin/groupadd mysql
sudo /usr/sbin/useradd -g mysql mysql /opt/software/mysql/scripts/mysql_install_db --basedir=/opt/software/mysql --datadir=/opt/software/mysql/data --user=mysql
sed -i "s#/usr/local/mysql#/opt/software/mysql#g" /opt/software/mysql/bin/mysqld_safe #启动mysql进程
/opt/software/mysql/bin/mysqld --basedir=/opt/software/mysql --datadir=/opt/software/mysql/data > /dev/null 2>&1
#设置root的密码为123456
/opt/software/mysql/bin/mysqladmin -u root password '123456'
5. 安装PHP依赖库
cd ~/setup
sudo mkdir -p /opt/software/libs/ cd jpeg-9/
./configure --prefix=/opt/software/libs --enable-shared --enable-static --prefix=/opt/software/libs
sudo make && sudo make install cd ../libpng-1.6.2/
./configure --prefix=/opt/software/libs
sudo make && sudo make install cd ../freetype-2.4.12/
./configure --prefix=/opt/software/libs
sudo make && sudo make install cd ../libmcrypt-2.5.8/
./configure --prefix=/opt/software/libs
sudo make && sudo make install #注意这里不是返回上级目录,而是在当前目录
cd libltdl/
./configure --prefix=/opt/software/libs --enable-ltdl-install
sudo make && sudo make install cd ../../mhash-0.9.9.9/
./configure --prefix=/opt/software/libs
sudo make && sudo make install
6. 设置类库加载路径
sudo vim /etc/ld.so.conf.d/opt-software-libs.conf
输入
/opt/software/libs/lib
然后
sudo ldconfig cd ../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/libs
sudo make && sudo make install cd ../termcap-1.3.1/
./configure --prefix=/opt/software/libs
sudo make && sudo make install
7. 安装PHP
sudo apt-get install libxml2-dev
export 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-soap sudo ln -s /opt/software/mysql/lib/libmysqlclient.so.18 /usr/lib/ wget http://pear.php.net/go-pear.phar
sudo mv go-pear.phar /opt/software/php/bin sudo make && sudo make install sudo cp php.ini-development /opt/software/php/etc/php.ini
sudo ln -s /opt/software/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo cp /opt/software/php/etc/php-fpm.conf.default /opt/software/php/etc/php-fpm.conf
8. 安装PHP扩展
cd ../m4-1.4.17/
./configure --prefix=/opt/software/libs
sudo make && sudo make install
export PATH=/home/davidhhuan/setup/m4-1.4.17:$PATH cd ../autoconf-2.69/
./configure --prefix=/opt/software/libs
sudo make && sudo make install cd ../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-config
sudo make && sudo make install
9. 设置开机自启动
Nginx
sudo vim /etc/init.d/nginx
内容如下
#! /bin/sh ### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/software/nginx/sbin/nginx
NAME=nginx
DESC=nginx DAEMON_OPTS='' test -x $DAEMON || exit 0 # Include nginx defaults if available
#if [ -f /etc/default/nginx ] ; then
# . /etc/default/nginx
#fi set -e . /lib/lsb/init-functions #test_nginx_config() {
# if $DAEMON -t $DAEMON_OPTS
# then
# return 0
# else
# return $?
# fi
#} case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --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 /var/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
;;
esac exit 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-fpm
sudo groupadd nobody
sudo touch /opt/software/php/var/run/php-fpm.pid
sudo update-rc.d php-fpm defaults
vim /etc/init.d/php-fpm
替换如下内容
prefix=@prefix@
exec_prefix=@exec_prefix@ php_fpm_BIN=@sbindir@/php-fpm
php_fpm_CONF=@sysconfdir@/php-fpm.conf
php_fpm_PID=@localstatedir@/run/php-fpm.pid
变成
prefix=/opt/software/php
exec_prefix=/opt/software/php/bin php_fpm_BIN=/opt/software/php/sbin/php-fpm
php_fpm_CONF=/opt/software/php/etc/php-fpm.conf
php_fpm_PID=/opt/software/php/var/run/php-fpm.pid
MySQL
sudo cp /opt/software/mysql/support-files/mysql.server /etc/init.d/mysqld
sudo vim /etc/init.d/mysqld
#找到
basedir=
datadir=
#变成
basedir=/opt/software/mysql
datadir=/opt/software/mysql/data sudo update-rc.d mysqld defaults
10. 加入环境变量
sudo vim /etc/profile
加入
export PATH=$PATH:/opt/software/mysql/bin:/opt/software/php/bin:/opt/software/php/sbin:/opt/software/mysql/bin
加载
source /etc/profile
至此,基本上就可以使用了。
Ubuntu14.04 64bit 编译安装nginx1.7+php5.4+mysql5.6的更多相关文章
- [Ubuntu] Ubuntu14.04 64bit 编译安装nginx1.7+php5.4+mysql5.6
我的操作系统是Ubuntu14.04,其它linux系统的操作流程类似. 主要安装的软件是nginx1.7+php5.4+mysql5.6 1. 创建必要目录 sudo mkdir ~/setup s ...
- ubuntu14.04下编译安装ambari-2.4.2.0
ubuntu14.04下编译安装ambari-2.4.2.0 编译前的准备工作 准备工作有: 系统参数 系统依赖(编译环境) 离线安装包 java环境 maven环境 Nodejs环境 git环境 a ...
- Ubuntu14.04 64bit编译u-boot-2016.07提示 Your dtc is too old, please upgrade to dtc 1.4 or newer
Author:AP0904225版权声明:本文为博主原创文章,转载请标明出处. Ubuntu14.04 64bit环境下编译u-boot-2016.07提示如下错误: CHK include/conf ...
- 自己编写的:centos6.6上编译安装apache2.4+php5.6+mysql5.6【亲自】
在centos6.6上安装apache2.4+php5.6+mysql5.6 关于wget的安装 将之前装系统的.iso文件挂载到光驱 由于我在/home/jinnan/下建立了一个cdrom文件夹 ...
- ubuntu 12.04下编译安装nginx-1.9.3
1,下载nginx-1.9.3.tar.gz 两种方式: (1).ubuntu 下终端中(ctrl+alt+t) 运行命令: wget http://nginx.org/download/nginx- ...
- Ubuntu14.04下编译安装或apt-get方式安装搭建Apache或Httpd服务(图文详解)
不多说,直接上干货! 写在前面的话 对于 在Ubuntu系统上,编译安装Apache它默认路径是在/usr/local/apache2/htdocs 或者编译安装httpd它默认路径是在/usr/lo ...
- Ubuntu14.04 静态编译安装Qt4.8.6
./configure -static -nomake demos -nomake examples -nomake tools -no-exceptions -prefix /usr/local/Q ...
- ubuntu14.04上编译安装python3.7.3
首先先去python官网www.python.org下载python3.7.3的官方压缩包Python-3.7.3.tgz 一.先安装需要的包zlib1g,libffi apt-get update ...
- Ubuntu14.04下Ambari安装搭建部署大数据集群(图文分五大步详解)(博主强烈推荐)
不多说,直接上干货! 写在前面的话 (1) 最近一段时间,因担任我团队实验室的大数据环境集群真实物理机器工作,至此,本人秉持负责.认真和细心的态度,先分别在虚拟机上模拟搭建ambari(基于CentO ...
随机推荐
- 自定义nsoperation的用法
#import <Foundation/Foundation.h> typedef void (^DownloadCompletionBlock)(UIImage *image); @in ...
- binary search tree study
今天又写了delete的部分,时间就这么被一天天地浪费了,我感到十分惋惜呀 #pragma once #include "stdio.h" struct Node { Node(i ...
- 【Oracle 】tablespace 表空间创建和管理
1.表空间的概述 1. 表空间是数据库的逻辑组成部分. 2. 从物理上讲,数据库数据存放在数据文件中: 3. 从逻辑上讲,数据库是存放在表空间中,表空间由一个或者多个数据文件组成. 2.oracle的 ...
- intellij idea 双击选中一个变量而不是单词
在keymap 里搜索 select Word at caret ,然后双击并在弹出选项里选add mouse shortcut,然后选double click,再在下面click pad 区域点一下 ...
- 跟我学SharePoint 2013视频培训课程——签出、签入文档(9)
课程简介 第9天,怎样在SharePoint 2013中签出.签入文档 视频 SharePoint 2013 交流群 41032413
- Java读取excel的示例
一.引用的jar包,apache的POI // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml compile group: ' ...
- Hive sql 查询数据库查询 top-n
数据库查询*分组排序取top n要求:按照课程分组,查找每个课程最高的两个成绩. 数据文件如下: 第一列no为学号,第二列course为课程,第三列score为分数 mysql> select ...
- MySQL自成一派的查询提示
[查询提示] MySQL中可以给select语句各种提示,比如告诉它“查询的结果集特别大,请直接用磁盘临时表”,“请让这条select优先执行” .... [查询提示:与结果集相关] 与结果集相关的查 ...
- python 取整的两种方法
问题简介: 要把一个浮点数(float)整数部分提取出来.比如把“2.1”变成“2”的这一过程:现在我们给这个过程起一个名字叫“取整”.那么它 在python中大致可以有两种写法 写法1)类型转换: ...
- JavaScript 循环:如何处理 async/await
如何串行或者并行运行异步循环? 在使用循环处理异步的魔法之前,我们先来看下我们是怎么处理同步循环的. 同步循环 很久以前我写的循环是这样的: for (var i = 0; i < array. ...