lnmp搭建
編譯安裝前準備,先確認編譯所需要的依賴軟件包已經安裝
yum groupinstall "Desktop Platform Development" -y
yum groupinstall "Development tools" -y
yum install curl-devel ncurses-devel net-snmp-* *icu* libxml2-devel -y
第一大步:
編譯mysql
mysql-5.6.26.tar.gz
# rm /mysqldata56 -rf
# rm /usr/local/mysql -rf
# rm /usr/src/mysql-*/ -rf
--刪除以前編譯過的,重新編譯
yum install cmake
tar xvf mysql-5.6.26.tar.gz -C /usr/src/
cd /usr/src/mysql-5.6.26/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=gbk,gb2312 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
make;make install
安裝後
1,手動編寫my.cnf配置文件
# mkdir /usr/local/mysql/etc
# vim /usr/local/mysql/etc/my.cnf
[mysqld]
port=3307
datadir=/mysqldata56
pid-file=/mysqldata56/mysql56.pid
socket=/mysqldata56/mysql56.socket
log-error=/mysqldata56/mysql56-err.log
user=mysql
[client]
socket=/mysqldata56/mysql56.socket
2:創建相關目錄,並修改權限
# useradd -u 27 mysql
# mkdir /mysqldata56
# chown mysql.mysql /mysqldata56 /usr/local/mysql/ -R
3:初始化數據庫
# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/usr/local/mysql/etc/my.cnf --user=mysql --basedir=/usr/local/mysql/
4:啟動服務
# /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf &
5:登錄
# /usr/local/mysql/bin/mysql
第二大步:編譯安裝php
編譯之前,確認把以前編譯過的給刪除
# rm -rf /usr/src/lnmp
# rm -rf /usr/local/php
lnmp搭建