本文用Unbutu 10.04+Nginx1.0+PHP5.3.6+Mysql5.5.11构建LNMP(X64)平台。

  文档以上次写的[CentOS 5.6(X64)下编译安装LNMP平台(Nginx1.0+PHP5.3.6+Mysql5.5.11)]为基础,将相关内容修改成了Unbutu的方式。

  一、获取相关开源程序

  1、本文基本以源码编译为主,首先需要安装基础编译环境所需要的软件和库。本文安装Ubuntu系统时只安装最基础的包(安装时软件套件都未选择),下面的所需要的包可根据自己系统环境情况自行调整。

  安装编译所需的基础环境


apt-get -y install gcc g++ autoconf \
libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 \
libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 \
libbz2-dev libzip-dev libncurses5-dev libncurses5 curl libcurl3 libcurl4-openssl-dev e2fsprogs \
libkrb5-3 libkrb5-dev libidn11 libidn11-dev openssl  libtool \
libevent-dev libevent-1.4-2 slapd ldap-utils libnss-ldap \
libguile-ltdl-1 libltdl-dev bison libsasl2-dev ctags

  2、下载最新的Nginx、Mysql、PHP程序及相关库的源码包

mkdir -p /data0/software
cd /data0/software

wget http://nginx.org/download/nginx-1.0.0.tar.gz
wget http://cn.php.net/get/php-5.3.6.tar.gz/from/this/mirror
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.11.tar.gz/from/http://mysql.ntu.edu.tw/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0"
wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0"
wget http://pecl.php.net/get/memcache-2.2.6.tgz
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick-6.6.9-10.tar.gz
wget http://pecl.php.net/get/imagick-3.0.0.tgz
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

  二、安装MySQL 5.5.11

  1、首先安装CMAKE(Mysql5.5.11已经采用CMAKE编译)

tar zxvf cmake-2.8.4.tar.gz
cd cmake-2.8.4
./configure --prefix=/usr
make
make install
cd ..

  2、安装MySQL 5.5.11

  a)新建一个用于运行MySQL的用户

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql

  b)解包并编译安装MySQL

tar xvf mysql-5.5.11.tar.gz 
cd mysql-5.5.11

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql/ \
-DMYSQL_DATADIR=/data0/mysql/data \
-DMYSQL_UNIX_ADDR=/data0/mysql/mysqld.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_TCP_PORT=3306 \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_UNIX_ADDR=/data0/mysql/mysql.sock \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DWITH_SSL=yes \
-DSYSCONFDIR=/data0/mysql

make
make install
cd ..

  c)将MySQL安装目录的权限赋予mysql用户

chmod +w /usr/local/webserver/mysql
chown -R mysql:mysql /usr/local/webserver/mysql

  d)创建MySQL数据库存放目录

mkdir -p /data0/mysql/data/
mkdir -p /data0/mysql/binlog/
mkdir -p /data0/mysql/relaylog/
chown -R mysql:mysql /data0/mysql/

  e)以mysql用户帐号的身份建立数据表

/usr/local/webserver/mysql/scripts/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/data0/mysql/data --user=mysql


无觅相关文章插件,快速提升流量

Pages: 1 2 3 4 5 6 7 8 9

Comments

One Response to “Unbutu 10.04(X64)下编译安装LNMP平台(Nginx1.0+PHP5.3.6+Mysql5.5.11)”

Leave a Reply

You must be logged in to post a comment.

传奇 似水流年 绽放 风筝 八月照相馆