一、环境说明
主机说明 |
ip |
系统说明 |
qy-nginx+NFS |
192.168.69.130 |
centos7 |
qy-mysql-php-zabbix |
192.168.69.133 |
centos7 |
二、安装nginx和mysql+php
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/43f707382f7182f05d66919cf4bea1bd.png)
1.安装mysql和php
[root@mysql-php ~]#yum groups mark install 'Development Tools'
[root@mysql-php ~]#yum -y install wget bzip2 bzip2-devel gcc gcc-c++
[root@mysql-php ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
[root@mysql-php ~]# groupadd -r -g 306 mysql
[root@mysql-php ~]# useradd -r -M -s /sbin/nologin -g mysql mysql
[root@mysql-php src]# ls
debug kernels mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
[root@mysql-php src]# tar -xf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@mysql-php src]# cd /usr/local/
[root@mysql-php local]# ln -s mysql-5.7.23-linux-glibc2.12-x86_64/ mysql
[root@mysql-php local]# chown -R mysql.mysql /usr/local/mysql
[root@mysql-php local]# ll /usr/local/mysql -d
lrwxrwxrwx 1 mysql mysql 36 3月 2 16:18 /usr/local/mysql -> mysql-5.7.23-linux-glibc2.12-x86_64/
[root@mysql-php local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@mysql-php local]# . /etc/profile.d/mysql.sh
[root@mysql-php ~]# mkdir /opt/data
[root@mysql-php ~]# chown -R mysql.mysql /opt/data/
[root@mysql-php ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
[root@mysql-php ~]# ln -sv /usr/local/mysql/include/ /usr/local/include/mysql
"/usr/local/include/mysql" -> "/usr/local/mysql/include/"
[root@mysql-php ~]# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
[root@mysql-php ~]# cat > /etc/my.cnf <<EOF
> [mysqld]
> basedir = /usr/local/mysql
> datadir = /opt/data
> socket = /tmp/mysql.sock
> port = 3306
> pid-file = /opt/data/mysql.pid
> user = mysql
> skip-name-resolve
> EOF
[root@mysql-php ~]#cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@mysql-php ~]#sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /etc/init.d/mysqld
[root@mysql-php ~]#sed -ri 's#^(datadir=).*#\1/opt/data#g' /etc/init.d/mysqld
[root@mysql-php ~]#service mysqld start
[root@mysql-php ~]#mysql> set password =