您好,登錄后才能下訂單哦!
一.安裝MySQL
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(如果沒有需要安裝) sudo apt-get install build-essential(如果沒有需要安裝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 運行和結束mysql服務。 #注意:如遇到下面問題: #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 & #改為(加上參數--user=root): #$bindir/mysqld_safe --user=root --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 & #即可啟動成功!!! #/usr/local/mysql/bin/mysql -uroot -p 進入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測試
三.安裝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行前的分號 pid = run/php-fpm.pid #修改第131和132行的user和group為當前用戶(安裝系統時設置的帳戶名)jane jane #去掉161、166、171、176行前面的分號保存并退出。 #cp 代碼包里的php.ini.development 到 /usr/local/php php.ini #/etc/init.d/php-fpm start 與 /etc/init.d/php-fpm stop (啟動和停止)
四.配置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測試)
五.安裝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 #安裝完成后,執行一下make test看是否正常。 #如果出現“You need 'tclsh8.5' in order to run the Redis test”。 則可運行 sudo apt-get install tcl8.5 來安裝tcl。 #src/redis-server redis.conf(默認配置文件,啟動前daemonize參數為no,所以redis不會在后臺運行,改成yes) #src/redis-cli redis 127.0.0.1:6379> 成功!
八.配置mongodb擴展
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擴展就裝好了,然后在php.ini文件中增加extension=mongo.so即可。 #注意:為了能加載擴展,需要修改php.ini中到 extension_dir=“/usr/lib/php5/20090626/” #重啟php-fpm phpinfo查看
九、配置redis擴展
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擴展
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擴展(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查看
大功告成!!!!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。