一.安裝MySQL
和平網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),和平網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為和平上千多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的和平做網(wǎng)站的公司定做!
cd /data/soft sudo wget http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.45.tar.gz sudo tar zxvf mysql-5.0.45.tar.gz cd mysql-5.0.45/ sudo apt-get install libncurses5-dev(如果沒(méi)有需要安裝) sudo apt-get install build-essential(如果沒(méi)有需要安裝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=innobase sudo make && make install clean cd /usr/local/mysql cp ./share/mysql/my-medium.cnf ./my.cnf ./bin/mysql_install_db cp ./share/mysql/mysql.server /etc/init.d/mysql chmod +x /etc/init.d/mysql #/etc/init.d/mysql start 及 /etc/init.d/mysql stop 運(yùn)行和結(jié)束mysql服務(wù)。 #注意:如遇到下面問(wèn)題: #Starting MySQL/etc/init.d/mysql: line 159: kill: (21755) - No such process解決辦法 #vim /etc/init.d/mysql #找到類似這樣一行(我這里是304行): #$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/ dev/null 2>&1 & #改為(加上參數(shù)--user=root): #$bindir/mysqld_safe --user=root --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 & #即可啟動(dòng)成功!!! #/usr/local/mysql/bin/mysql -uroot -p 進(jìn)入mysql !!
二.安裝Nginx
cd /data/soft wget http://nginx.org/download/nginx-0.8.37.tar.gz tar zxvf nginx-0.8.37.tar.gz cd nginx-0.8.37 apt-get install libpcre3-dev(如果需要) apt-get install openssl(如果需要) apt-get install libssl-dev(如果需要) sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module sudo make && make install cp nginx.sh /etc/init.d/nginx #/etc/init.d/nginx start(stop) http://127.0.0.1測(cè)試
三.安裝PHP
cd /data/soft wget http://cn2.php.net/distributions/php-5.3.23.tar.gz tar zxvf php-5.3.23.tar.gz cd php-5.3.23 apt-get install libxml2-dev apt-get install libjpeg-dev apt-get install libpng-dev apt-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 --enable-sockets --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-cli make && make install cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm cd /usr/local/php/etc mv php-fpm.conf.default php-fpm.conf vim php-fpm.conf #去掉25行前的分號(hào) pid = run/php-fpm.pid #修改第131和132行的user和group為當(dāng)前用戶(安裝系統(tǒng)時(shí)設(shè)置的帳戶名)jane jane #去掉161、166、171、176行前面的分號(hào)保存并退出。 #cp 代碼包里的php.ini.development 到 /usr/local/php php.ini #/etc/init.d/php-fpm start 與 /etc/init.d/php-fpm stop (啟動(dòng)和停止)
四.配置nginx支持PHP
mkdri /data/htdocs vi /usr/local/nginx/conf/nginx.conf #修改43、44行 #root /data/htdocs; #index index.html index.htm index.php; #修改63行 #location ~ \.php$ { fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } #/etc/init.d/nginx reload(http://127.0.0.1測(cè)試)
五.安裝memcached
cd /data/soft wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz tar zxvf memcached-1.4.15.tar.gz cd memcached-1.4.15 apt-get install libevent-dev ./configure --prefix=/usr/local/memcached make && make install /usr/local/memcached/bin/memcached -d -m 50 -p 11211 -u root -l 127.0.0.1
六.安裝MongoDB
cd /data/soft wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.8.tgz tar zxvf mongodb-linux-x86_64-2.0.8.tgz mv mongodb-linux-x86_64-2.0.8 /usr/local/mongodb mkdir -p /data/db/mongodb/data mkdir -p /data/db/mongodb/logs cd /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
七.安裝redis
cd /data/soft wget http://redis.googlecode.com/files/redis-2.6.9.tar.gz tar zxvf redis-2.4.18.tar.gz mv redis-2.6.9 /usr/local/redis cd /usr/local/redis make #安裝完成后,執(zhí)行一下make test看是否正常。 #如果出現(xiàn)“You need 'tclsh8.5' in order to run the Redis test”。 則可運(yùn)行 sudo apt-get install tcl8.5 來(lái)安裝tcl。 #src/redis-server redis.conf(默認(rèn)配置文件,啟動(dòng)前daemonize參數(shù)為no,所以redis不會(huì)在后臺(tái)運(yùn)行,改成yes) #src/redis-cli redis 127.0.0.1:6379> 成功!
八.配置mongodb擴(kuò)展
wget http://pecl.php.net/get/mongo-1.4.2.tgz tar zxf mongo-1.4.2.tgz sudo apt-get install php5-dev phpize5 ./configure --enable-mongo make install #這樣mongodb的php擴(kuò)展就裝好了,然后在php.ini文件中增加extension=mongo.so即可。 #注意:為了能加載擴(kuò)展,需要修改php.ini中到 extension_dir=“/usr/lib/php5/20090626/” #重啟php-fpm phpinfo查看
九、配置redis擴(kuò)展
wget --no-check-certificate http://github.com/owlient/phpredis/tarball/master -O phpredis.tar.gz tar zxvf phpredis.tar.gz cd owlient-phpredis-90ecd17/ #修改/usr/local/php/bin/php-config extension_dir=“/usr/lib/php5/20090626” phpize5 ./configure -with-php-config=/usr/local/php/bin/php-config sudo make sudo make install #在php.ini文件中增加extension=redis.so即可 #重啟php-fpm phpinfo查看
十、配置memcache擴(kuò)展
wget http://pecl.php.net/get/memcache-2.2.6.tgz tar zxvf memcache-2.2.6.tgz cd memcache-2.2.6/ #修改/usr/local/php/bin/php-config extension_dir=“/usr/lib/php5/20090626” phpize5 ./configure -with-php-config=/usr/local/php/bin/php-config sudo make sudo make install #在php.ini文件中增加extension=memcache.so即可 #重啟php-fpm phpinfo查看
十一、安裝并配置memcached擴(kuò)展(lnmp下)
wget https://launchpad.net/libmemcached/1.0/1.0.8/+download/libmemcached-1.0.8.tar.gz wget http://pecl.php.net/get/memcached-2.0.1.tgz tar zxf libmemcached-1.0.8.tar.gz cd libmemcached-1.0.8 sudo apt-get install cloop-ppl0 ./configure --prefix=/usr/local/libmemcached --with-memcached sudo make sudo make install tar zxf memcached-2.0.1.tgz cd 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/libmemcached sudo make & make install vim php.ini 加入 extension=memcached.so #重啟php-fpm phpinfo查看
大功告成?。。?!