基於Nginx0.8.54 PHP5.3.4 MySQL5.5.8的全新LNMP穩定版架構搭建的VPS

NO IMAGE

雖然開始在MySQL5.5.8的編譯過程中遇到了一些問題,因為之前從未接觸過Cmake方式的編譯,在查閱官方手冊並結合谷歌,終於把問題搞定了。

目前Nginx的worker_processes設定為4,php-fpm設定為dynamic模式,max_children=32,start_servers=8,min_spare_servers=4,max_spare_servers=16,max_request=512的環境下,540MB記憶體剩餘380MB,相比之前用Zend Server CE搭建的LAMP記憶體開銷,優化效果還是十分明顯的,而且網站速度也很理想,給我最大的感受就是頁面請求的響應速度比以前大大提升了。

鑑於MySQL5.5.8這個新產品釋出不久,網上的相關資料匱乏,補充一些自己在編譯上的內容(注意,我因為自己對innodb無需求,因此遮蔽了innodb引擎,如果需要可以開啟引數-DWITH_INNOBASE_STORAGE_ENGINE=1。
複製程式碼 程式碼如下:
#download software package
wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
wget http://ftp.gnu.org/gnu/bison/bison-2.4.3.tar.gz

tar zxvf cmake-2.8.3.tar.gz
cd cmake-2.8.3/
./configure –prefix=/usr
gmake
gmake install
cd ../
tar zxvf bison-2.4.3.tar.gz
cd cd bison-2.4.3
./configure
make
make install

#install mysql5.5.8
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
tar zxvf mysql-5.5.8.tar.gz
cd mysql-5.5.8
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DWITHOUT_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DSYSCONFDIR=/etc/ -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=on
make
make install
/usr/local/mysql/scripts/mysql_install_db –basedir=/usr/local/mysql/ –datadir=/data/mysql –user=mysql

#modify mysql config
vim /etc/my.cnf

[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
thread_concurrency = 1
basedir = /usr/local/mysql
datadir = /data/mysql
default-storage-engine = myisam
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

#add to boot config
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig –add mysqld
/etc/rc.d/init.d/mysqld start
/usr/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock

PS:如果在編譯PHP的時候報錯error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory,可以通過以下方法解決:
複製程式碼 程式碼如下:
ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16

您可能感興趣的文章:

centos7利用yum安裝lnmp的教程(linux nginx php7.1 mysql5.7)LNMP編譯安裝之nginx安裝配置方法圖文教程Centos 6.8編譯安裝LNMP環境(Nginx MySQL PHP)教程CentOS 7.0編譯安裝lnmp教程(Nginx1.6.0 MySQL5.6.19 PHP5.5.14)CentOS 6.6伺服器編譯安裝lnmp(Nginx1.6.2 MySQL5.6.21 PHP5.6.3)lnmp環境中如何為nginx開啟pathinfoLNMP伺服器環境配置 (linux nginx mysql php)CentOS 6.4安裝配置LNMP伺服器(Nginx PHP MySQL)在lnmp環境中的nginx編譯安裝