ubuntu下nginx+php+mysql+memcached+mango的安装配置

3 篇文章 0 订阅
2 篇文章 0 订阅
本文详述了在Ubuntu系统中手动编译安装nginx 1.0.5、mysql 5.1.54、php 5.6.30以及手动和自动安装php的mongo、memcached扩展和mongodb 2.0.1服务器的步骤,包括配置nginx的php处理、php-fpm设置和添加服务至开机启动。
摘要由CSDN通过智能技术生成

手动编译安装nginx 1.0.5

nginx下载页面:http://nginx.org/en/download.html

echo 复制下面整段shell到命令行终端中,会自动逐条执行。

wget http://nginx.org/download/nginx-1.1.5.tar.gz

tar -xvf nginx-1.1.5.tar.gz

cd nginx-1.1.5

sudo apt-get install libpcre3 libpcre3-dev

./configure   --prefix=/opt/nginx

make

sudo make install

sudo ln -s  /opt//nginx/sbin/nginx   /etc/init.d/

echo 启动nginx

sudo /etc/init.d/nginx

echo 访问本机首页,如果正常,则说明nginx已启动

wget   http://localhost/

 

把Nginx加入服务,开机自启动,步骤:http://www.linuxidc.com/Linux/2011-10/45735.htm

自动安装mysql 5.1.54

在本机安装mysql server数据库。

sudo apt-get install mysql-client mysql-common mysql-server

手动安装mysql

从mysql.com下载最新版的,有rpm自动安装包给Federo、CentOS用,没有deb包。所以Ubuntu要手动安装。下载Linux - Generic 2.6 (x86, 64-bit), Compressed TAR Archive。参考:http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html

下载地址: http://www.mysql.com/downloads/mysql/

echo 复制下面整段shell到命令行终端中,会自动逐条执行。
sudo apt-get install libaio1
tar -zxvf mysql-5.5.13-linux2.6-x86_64.tar.gz
sudo mv ./mysql-5.5.13-linux2.6-x86_64 /usr/local/mysql
sudo groupadd mysql
sudo useradd -r -g mysql mysql
cd /usr/local/mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql
sudo chown -R root .
sudo chown -R mysql data
sudo cp support-files/my-medium.cnf /etc/my.cnf
sudo cp ./bin/mysql /usr/bin/
sudo cp support-files/mysql.server /etc/init.d/mysql
sudo /etc/init.d/mysql start
./bin/mysqladmin -u root password '1'
sudo /etc/init.d/mysql restart
mysql -uroot -p1

 

sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

手动编译安装php 5.3.8

php下载页面:http://php.net/downloads.php

php发送email的2种方式:http://www.linuxidc.com/Linux/2011-10/45736.htm

CGI、fastcgi、php-fpm:http://www.linuxidc.com/Linux/2011-10/45746.htm

常用扩展:curl、pdo、pdo-mysql、mysqli、openssl、gd、jpeg、png、exif、zip、magickwand

sudo apt-get install libltdl-dev libssl-dev sendmail libjpeg8 libjpeg8-dev libpng12-0  libpng12-dev libxml2-dev libcurl4-openssl-dev   libmcrypt-dev

sudo ln -s /usr/lib/x86_64-linux-gnu/libpng*  /usr/lib/

 

wget http://curl.haxx.se/download/curl-7.19.6.tar.gz

echo 根据PHP官方推荐,使用mysqli和pdo_mysql,而不使用mysql。gmail stmp需要openssl。

 wget http://uk1.php.net/get/php-5.6.30.tar.gz/from/this/mirror -O php.tar.gz

tar -xvf  php.tar.gz

cd php-5.6.30

./configure --prefix=/opt/php --enable-fpm --with-fpm-user=webuser --with-fpm-group=webuser --with-curl=/opt/curl --with-mcrypt=/opt/libmcrypt --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-openssl --with-imap-ssl --with-gd --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/ --enable-exif --enable-zip

make

sudo make install

sudo cp php.ini-development /opt/php/lib/php.ini

sudo ln -s /opt/php/bin/php /usr/bin/php

sudo cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf

sudo vi /opt/php/etc/php-fpm.conf

pid = run/php-fpm.pid

error_log =log/php-fpm.log

log_level = error

pm.start_servers

pm.min_spare_servers

pm.max_spare_servers

 

sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

sudo chmod 755 /etc/init.d/php-fpm

echo 把php-fpm加入服务,开机自启动

sudo update-rc.d php-fpm  defaults

sudo /opt/php/sbin/php-fpm

sudo vi /opt/nginx/conf/nginx.conf

location / {

 

root html;

 

index index.htmlindex.htm index.php;

 

}

 

location ~ \.php$ {

 

root /usr/www;

 

fastcgi_pass 127.0.0.1:9000;

 

fastcgi_index index.php;

 

fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

 

include fastcgi_params;

 

}

 

sudo kill all nginx

 

sudo /etc/init.d/nginx

 

 

手动安装php mongo扩展

PHP mongo下载页面:http://pecl.php.net/package/mongo

sudo apt-get install autoconf
wget http://pecl.php.net/get/mongo-1.2.6.tgz
tar -zxvf mongo-1.2.6.tgz
cd mongo-1.2.6
/opt/php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config
make
sudo make install
echo 'extension = mongo.so' | sudo tee -a /opt/php/lib/php.ini
 

自动安装memcached服务器

sudo apt-get install memcached
sudo /etc/init.d/memcached start

pecl自动安装php memcache扩展

sudo /opt/php/bin/pecl install memcache
echo 'extension = memcache.so' | sudo tee -a /opt/php/lib/php.ini
 

pecl自动安装php memcached扩展

sudo apt-get install libmemcached-dev
sudo /opt/php/bin/pecl install memcached-2.2.0
echo 'extension = memcached.so' | sudo tee -a /opt/php/lib/php.ini
 

手动安装mongodb 2.0.1服务器

mongodb服务器下载页面:http://www.mongodb.org/downloads

wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.8.2.tgz
tar -zxvf mongodb-linux-i686-2.0.1.tgz
sudo mv mongodb-linux-i686-2.0.1 /opt/mongodb
sudo ln -s /opt/mongodb/bin/mongo /usr/bin/
sudo mkdir -p /data/db/
sudo mkdir /var/log/mongodb/
echo 启动mongod服务器
sudo /opt/mongodb/bin/mongod --fork --logpath=/var/log/mongodb/a.log

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值