ubuntu13.04编译安装lnmp

上上上...周,装了个windows7与ubuntu13.04双系统(我装好一个礼拜之后,系统提示升级成ubuntu13.10,囧)。

安装步骤参考张晏http://blog.s135.com/nginx_php_v7/。安装过程比较顺利

ubuntu13.04或13.10编译安装步骤如下:

版本:nginx-1.5.10 mysql-5.6.10 php-5.3.28 memcache-2.2.7
安装nginx
su -
mkdir -p /Data/tgz
cd /Data/tgz
apt-get install wget
apt-get install libpcre3 libpcre3-dev
apt-get install libssl-dev openssl
#添加www用户与用户组 
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
 
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz
tar zxvf pcre-8.33.tar.gz
cd pcre-8.33
./configure --prefix=/Data/apps/pcre
make && make install
cd ../

wget http://nginx.org/download/nginx-1.5.10.tar.gz
tar zxvf nginx-1.5.10.tar.gz
cd nginx-1.5.10
./configure --user=www --group=www 
--prefix=/Data/apps/nginx 
--with-http_stub_status_module 
--with-http_ssl_module 
--with-pcre=/Data/tgz/pcre-8.33 
--with-http_realip_module    
#(这里未有加载:--with-http_image_filter_module)
make
make install
cd ../
安装mysql
wget http://downloads.mysql.com/archives/mysql-5.6/mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
tar zxvf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.10-linux-glibc2.5-x86_64 /Data/apps/mysql
#添加mysql用户与用户组
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
mkdir -p /Data/data/mysql/data
apt-get install libaio-dev
/Data/apps/mysql/scripts/mysql_install_db --basedir=/Data/apps/mysql --datadir=/Data/data/mysql/data --user=mysql
 
sed -i "s#/usr/local/mysql#/Data/apps/mysql#g" /Data/apps/mysql/bin/mysqld_safe
cp /Data/apps/mysql/support-files/mysql.server /etc/init.d/mysql
/Data/apps/mysql/bin/mysqladmin -u root -p password "fuck" 	#(这里mysql root用户密码设为了fuck)
安装php依赖库:
#gd库与imagick依赖包 jpeg png freetype
mkdir -p /Data/apps/libs/
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz           
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --prefix=/Data/apps/libs --enable-shared --enable-static --prefix=/Data/apps/libs
make
make install
cd ../
 
wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz
tar zxvf libpng-1.6.2.tar.gz
cd libpng-1.6.2/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
 
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
tar zxvf freetype-2.4.12.tar.gz
cd freetype-2.4.12/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
 
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"
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"
 
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure --prefix=/Data/apps/libs
make
make install
cd libltdl/
./configure --prefix=/Data/apps/libs --enable-ltdl-install
make
make install
cd ../../
 
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure --prefix=/Data/apps/libs
make
make install
cd ../

vi /etc/ld.so.conf
#添加两行
/Data/apps/libs/lib
/Data/apps/mysql/lib
#然后:ldconfig
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
export LDFLAGS="-L/Data/apps/libs/lib -L/usr/lib"
export CFLAGS="-I/Data/apps/libs/include -I/usr/include"
touch malloc.h
./configure --prefix=/Data/apps/libs --with-libmcrypt-prefix=/Data/apps/libs
make
make install
cd ../
编译安装php-5.3.28(这里是php5.3.28)
wget http://www.php.net/get/php-5.3.28.tar.bz2/from/hk2.php.net/mirror
tar zxvf php-5.3.28.tar.bz2
cd php-5.3.28/
export LIBS="-lm -ltermcap -lresolv"
export DYLD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
export LD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
./configure 
--prefix=/Data/apps/php53 
--with-config-file-path=/Data/apps/php53/etc 
--with-mysql=/Data/apps/mysql 
--with-mysqli=/Data/apps/mysql/bin/mysql_config 
--with-iconv-dir 
--with-freetype-dir=/Data/apps/libs 
--with-jpeg-dir=/Data/apps/libs 
--with-png-dir=/Data/apps/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=/Data/apps/libs 
--with-gd 
--enable-gd-native-ttf 
--with-openssl 
--with-mhash 
--enable-pcntl 
--enable-sockets 
--with-xmlrpc 
--enable-zip 
--enable-soap
make
make install
cp php.ini-development /Data/apps/php/etc/php.ini
cd ../

ln -s /Data/apps/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
ln -s /Data/apps/mysql/lib/libmysqlclientt.so.18 /usr/lib64/
mv /Data/apps/php/etc/php-fpm.conf.default /Data/apps/php/etc/php-fpm.conf
安装php扩展(memcache)
wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar zxvf autoconf-latest.tar.gz
cd autoconf-2.69/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
 
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz
cd memcache-2.2.7/
export PHP_AUTOCONF="/Data/apps/libs/bin/autoconf"
export PHP_AUTOHEADER="/Data/apps/libs/bin/autoheader"
/Data/apps/php53/bin/phpize
./configure --with-php-config=/Data/apps/php53/bin/php-config
make
make install
cd ../

#打开 /Data/apps/php/etc/php.ini 查找 ;extension_dir = “ext”
  #在其后增加一行:
extension = “memcache.so”

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值