首页 > 代码库 > lnmp搭建
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搭建