Build LNMP+memcahce+memcahced+redis+mongodb extension under ubuntu12.04
one。 Install MySQL
Cd / data/softsudo wget http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.45.tar.gzsudo tar zxvf mysql-5.0.45.tar.gzcd mysql-5.0.45/sudo apt-get install libncurses5-dev (if not required) sudo apt-get install build-essential (if not required to install gcc) sudo. / configure-- prefix=/usr/local/mysql-- enable-assembler-- with-extra-charsets=complex-- Enable-thread-safe-client-- with-big-tables-- with-embedded-server-- enable-local-infile-- with-plugins=innobasesudo make & & make install cleancd / usr/local/mysqlcp. / share/mysql/my-medium.cnf. / my.cnf./bin/mysql_install_dbcp. / share/mysql/mysql.server / etc/init.d/mysqlchmod + x / etc/init.d/mysql#/etc/init.d/mysql start and / etc/init.d/mysql stop run and end mysql services. # Note: if you encounter the following problems: # Starting MySQL/etc/init.d/mysql: line 159: kill: (21755)-No such process solution # vim / etc/init.d/mysql# finds a line like this (I have line 304here): # $bindir/mysqld_safe-- datadir=$datadir-- pid-file=$server_pid_file $other_args > / dev/null 2 > & 1 & # change (add parameter-- user=root): # $bindir/mysqld_safe -- user=root-- datadir=$datadir-- pid-file=$server_pid_file $other_args > / dev/null 2 > & 1 & # to launch successfully! # / usr/local/mysql/bin/mysql-uroot-p enter mysql!
two。 Install Nginx
Cd / data/softwget http://nginx.org/download/nginx-0.8.37.tar.gztar zxvf nginx-0.8.37.tar.gzcd nginx-0.8.37apt-get install libpcre3-dev (if needed) apt-get install openssl (if needed) apt-get install libssl-dev (if needed) sudo. / configure-- prefix=/usr/local/nginx-- with-http_stub_status_modulesudo make & & make installcp nginx.sh / etc/init.d/ Nginx#/etc/init.d/nginx start (stop) http://127.0.0.1 Test
three。 Install PHP
Cd / data/softwget http://cn2.php.net/distributions/php-5.3.23.tar.gztar zxvf php-5.3.23.tar.gzcd php-5.3.23apt-get install libxml2-devapt-get install libjpeg-devapt-get install libpng-devapt-get install libfreetype6-dev./configure-prefix=/usr/local/php-- with-config-file-path=/usr/local/php-- enable-mbstring-- enable-ftp-- with-gd-- with-jpeg-dir= / usr/include-- with-png-dir=/usr/include-- with-mysql=mysqlnd-- with-mysqli=mysqlnd-- with-pdo-mysql=mysqlnd-- with-pear-- with-freetype-dir=/usr/include-- enable-gd-native-ttf-- with-zlib-- with-libxml-dir=/usr/include-- with-xmlrpc-- enable-zip-enable-fpm-- enable-fpm-- enable-xml-enable-sockets-- with-gd-- with-zlib-- With-iconv-- enable-zip-- enable-soap-- enable-pcntl-- enable-climake & & make installcp. / sapi/fpm/init.d.php-fpm / etc/init.d/php-fpmchmod + x / etc/init.d/php-fpmcd / usr/local/php/etcmv php-fpm.conf.default php-fpm.confvim php-fpm.conf# remove the semicolon before the 25th line pid = run/php-fpm.pid# modify the user and group of lines 131 and 132for the current use Account name (account name set when installing the system) jane jane# removed 161, The semicolon before lines 166, 171, 176 is saved and exited. # php.ini.development to / usr/local/php php.ini#/etc/init.d/php-fpm start and / etc/init.d/php-fpm stop (start and stop) in the cp code package
four。 Configure nginx to support PHP
Mkdri / data/htdocsvi / usr/local/nginx/conf/nginx.conf# Modification 43, 44 Line # root / data/htdocs;#index index.html index.htm index.php;# Modification 63 Line # location ~\. Php$ {fastcgi_pass 127.0.0.1 data/htdocsvi 9001 index.php;fastcgi_param SCRIPT_FILENAME fastcgiveness index $document_root$fastcgi_script_name;include fastcgi_params;} # / etc/init.d/nginx reload (http://127.0.0.1 test)
five。 Install memcached
Cd / data/softwget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gztar zxvf memcached-1.4.15.tar.gzcd memcached-1.4.15apt-get install libevent-dev./configure-- prefix=/usr/local/memcachedmake & & make install/usr/local/memcached/bin/memcached-d-m 50-p 11211-u root-l 127.0.0.1
six。 Install mongodb
Cd / data/softwget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.8.tgztar zxvf mongodb-linux-x86_64-2.0.8.tgzmv mongodb-linux-x86_64-2.0.8 / usr/local/mongodbmkdir-p / data/db/mongodb/datamkdir-p / data/db/mongodb/logscd / usr/local/mongodb/./bin/mongod-- dbpath=/data/db/mongodb/data/-- logpath=/data/db/ Mongodb/logs/log.log-logappend-port=27017-fork-source=127.0.0.1
seven。 Install redis
After the cd / data/softwget http://redis.googlecode.com/files/redis-2.6.9.tar.gztar zxvf redis-2.4.18.tar.gzmv redis-2.6.9 / usr/local/rediscd / usr/local/redismake# installation is complete, run make test to see if it is working. # if "You need 'tclsh8.5' in order to run the Redis test" appears. You can run sudo apt-get install tcl8.5 to install tcl. # src/redis-server redis.conf (default configuration file, the daemonize parameter is no before startup, so redis will not run in the background, change it to yes) # src/redis-cliredis 127.0.1 no 6379 > successful!
eight。 Configure mongodb extension
Wget http://pecl.php.net/get/mongo-1.4.2.tgztar zxf mongo-1.4.2.tgzsudo apt-get install php5-devphpize5./configure-enable-mongomake install# is installed as a php extension for mongodb, and then add extension=mongo.so to the php.ini file. # Note: in order to load the extension, you need to modify php.ini and go to extension_dir= "/ usr/lib/php5/20090626/" # restart php-fpm phpinfo to view
IX. Configure redis extension
Wget-- no-check-certificate http://github.com/owlient/phpredis/tarball/master-O phpredis.tar.gztar zxvf phpredis.tar.gzcd owlient-phpredis-90ecd17/# modify / usr/local/php/bin/php-config extension_dir= "/ usr/lib/php5/20090626" phpize5./configure-with-php-config=/usr/local/php/bin/php-configsudo makesudo make install# add extension=redis.so to the php.ini file to # restart php-fpm phpinfo view
Configure the memcache extension
Wget http://pecl.php.net/get/memcache-2.2.6.tgztar zxvf memcache-2.2.6.tgzcd memcache-2.2.6/# modify / usr/local/php/bin/php-config extension_dir= "/ usr/lib/php5/20090626" phpize5./configure-with-php-config=/usr/local/php/bin/php-configsudo makesudo make install# add extension=memcache.so to the php.ini file to # restart php-fpm phpinfo view
Install and configure the memcached extension (under lnmp)
Wget https://launchpad.net/libmemcached/1.0/1.0.8/+download/libmemcached-1.0.8.tar.gzwget http://pecl.php.net/get/memcached-2.0.1.tgztar zxf libmemcached-1.0.8.tar.gzcd libmemcached-1.0.8sudo apt-get install cloop-ppl0./configure-prefix=/usr/local/libmemcached-with-memcachedsudo makesudo make installtar zxf memcached-2.0.1.tgzcd memcached-2.0.1/usr / local/php/bin/phpize./configure-- enable-memcached-- with-php-config=/usr/local/php/bin/php-config-- with-libmemcached-dir=/usr/local/libmemcachedsudo make & make installvim php.ini join extension=memcached.so# to restart php-fpm phpinfo View
It's done!