在192.168.220.50这台主机上源码安装mysql
//安装开发工具包
[root@zzg ~]# yum groups mark install 'Development Tools'
[root@zzg ~]# yum -y install wget bzip2 bzip2-devel gcc gcc-c++
//安装依赖包
[root@zzg ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
//创建用户和组
[root@zzg ~]# groupadd -r -g 306 mysql
[root@zzg ~]# useradd -r -M -s /sbin/nologin -g mysql mysql
//下载二进制格式的mysql软件包
[root@zzg ~]# cd /usr/src/
[root@zzg src]# wget https://downloads.mysql.com/archives/get/file/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
//解压软件至/usr/local/
[root@zzg src]# tar xf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@zzg src]# ls /usr/local/
bin games lib libexec sbin src
etc include lib64 mysql-5.7.23-linux-glibc2.12-x86_64 share
[root@zzg src]# cd /usr/local/
[root@zzg local]# ln -s mysql-5.7.23-linux-glibc2.12-x86_64/ mysql
//修改目录/usr/local/mysql的属主属组,添加环境变量
[root@zzg local]# chown -R mysql.mysql /usr/local/mysql
[root@zzg local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@zzg local]# . /etc/profile.d/mysql.sh
//建立数据存放目录
[root@zzg local]# mkdir /opt/data
[root@zzg local]# chown -R mysql.mysql /opt/data/
//初始化数据库
[root@zzg local]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
//配置mysql
[root@zzg local]# ln -sv /usr/local/mysql/include/ /usr/local/include/mysql
‘/usr/local/include/mysql’ -> ‘/usr/local/mysql/include/’
[root@zzg local]# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
[root@zzg local]# ldconfig -v
//生成配置文件
[root@zzg local]# cat > /etc/my.cnf < [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@zzg local]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@zzg local]# sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /etc/init.d/mysqld
[root@zzg local]# sed -ri 's#^(datadir=).*#\1/opt/data#g' /etc/init.d/mysqld
//启动
[root@zzg local]# service mysqld start
//修改密码
mysql> set password = password(123456');
在192.168.220.50这台主机上源码安装php
//安装开发工具包
[root@zzg ~]# yum groups mark install 'Development Tools'
[root@zzg ~]# yum -y install wget bzip2 bzip2-devel gcc gcc-c++
//安装依赖包
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel libpcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel php72w-mysqlnd
//下载php
[root@zzg ~]# cd /usr/src/
[root@zzg src]# wget http://cn.php.net/distributions/php-7.2.8.tar.xz
//编译安装php
[root@zzg src]# tar xf php-7.2.8.tar.xz
[root@zzg src]# cd php-7.2.8
[root@zzg php-7.2.8]# ./configure --prefix=/usr/local/php7 \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --enable-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
[root@zzg php-7.2.8]# make && make install
//安装后配置
[root@zzg php-7.2.8]# echo 'export PATH=/usr/local/php7/bin:$PATH' > /etc/profile.d/php7.sh
[root@zzg php-7.2.8]# . /etc/profile.d/php7.sh
[root@zzg php-7.2.8]# php -v
PHP 7.2.8 (cli) (built: Mar 1 2019 02:31:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
//配置php-fpm
[root@zzg php-7.2.8]# cp php.ini-production /etc/php.ini
[root@zzg php-7.2.8]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@zzg php-7.2.8]# chmod +x /etc/rc.d/init.d/php-fpm
[root@zzg php-7.2.8]# cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
[root@zzg php-7.2.8]# cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
[root@zzg php-7.2.8]# vim /usr/local/php7/etc/php-fpm.conf
[root@zzg php-7.2.8]# tail -4 /usr/local/php7/etc/php-fpm.conf
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8
//启动
[root@zzg php-7.2.8]# service php-fpm start
在192.168.220.60这台主机上源码安装ngninx
//安装开发工具包
[root@zzg ~]# yum groups mark install 'Development Tools'
[root@zzg ~]# yum -y install wget bzip2 bzip2-devel gcc gcc-c++
//创建系统用户ngin
[root@zzg ~]# groupadd -r nginx
[root@zzg ~]# useradd -r -s /sbin/nologin -M -g nginx nginx
//安装依赖环境
[root@zzg ~]# yum -y install pcre-devel openssl openssl-devel gd-devel
//创建日志存放目录
[root@zzg ~]# mkdir -p /var/log/nginx
[root@zzg ~]# chown -R nginx.nginx /var/log/nginx/
//下载nginx
[root@zzg ~]# cd /usr/src/
[root@zzg src]# wget http://nginx.org/download/nginx-1.12.0.tar.gz
//编译安装
[root@zzg src]# tar xf nginx-1.12.0.tar.gz
[root@zzg src]# ls
debug kernels nginx-1.12.0 nginx-1.12.0.tar.gz
[root@zzg src]# cd nginx-1.12.0
[root@zzg nginx-1.12.0]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-debug \
> --with-http_ssl_module \
> --with-http_realip_module \
> --with-http_image_filter_module \
> --with-http_gunzip_module \
> --with-http_gzip_static_module \
> --with-http_stub_status_module \
> --http-log-path=/var/log/nginx/access.log \
> --error-log-path=/var/log/nginx/error.log
[root@zzg nginx-1.12.0]# make && make install
//nginx安装后配置
[root@zzg nginx-1.12.0]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@zzg nginx-1.12.0]# . /etc/profile.d/nginx.sh
//启动
[root@zzg ~]# nginx
在192.168.220.50这台虚拟机安装zabbix
//下载zabbix,解压
[root@zzg ~]# cd /usr/src/
[root@zzg src]# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.12/zabbix-3.4.12.tar.gz
[root@zzg src]# tar xf zabbix-3.4.12.tar.gz
//安装依赖包
[root@zzg src]# yum -y install net-snmp-devel libevent-devel
//创建zabbix用户和组
[root@zzg src]# groupadd -r zabbix
[root@zzg src]# useradd -r -g zabbix -M -s /sbin/nologin zabbix
//配置zabbix数据库
[root@zzg src]# mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix123!';
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@zzg src]# cd /usr/src/zabbix-3.4.12/database/mysql/
[root@zzg mysql]# ls
data.sql images.sql schema.sql
[root@zzg mysql]# mysql -uzabbix -pzabbix123! zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zzg mysql]# mysql -uzabbix -pzabbix123! zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zzg mysql]# mysql -uzabbix -pzabbix123! zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
//编译安装zabbix
[root@zzg mysql]# cd /usr/src/zabbix-3.4.12
[root@zzg zabbix-3.4.12]# [root@localhost zabbix-4.0.3]# ./configure --enable-server \
> --enable-agent \
> --with-mysql \
> --with-net-snmp \
> --with-libcurl \
> --with-libxml2
[root@zzg zabbix-3.4.12]# make install
//安装后配置
//下载zabbix,解压
[root@zzg ~]# cd /usr/src/
[root@zzg src]# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz
[root@zzg src]# tar xf zabbix-3.4.12.tar.gz
//安装依赖包
[root@zzg src]# yum -y install net-snmp-devel libevent-devel
//创建zabbix用户和组
[root@zzg src]# groupadd -r zabbix
[root@zzg src]# useradd -r -g zabbix -M -s /sbin/nologin zabbix
//配置zabbix数据库
[root@zzg src]# mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix123!';
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@zzg src]# cd /usr/src/zabbix-3.4.12/database/mysql/
[root@zzg mysql]# ls
data.sql images.sql schema.sql
[root@zzg mysql]# mysql -uzabbix -pzabbix123! zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zzg mysql]# mysql -uzabbix -pzabbix123! zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@zzg mysql]# mysql -uzabbix -pzabbix123! zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
//编译安装zabbix
[root@zzg mysql]# cd /usr/src/zabbix-3.4.12
[root@zzg zabbix-3.4.12]# [root@localhost zabbix-4.0.3]# ./configure --enable-server \
> --enable-agent \
> --with-mysql \
> --with-net-snmp \
> --with-libcurl \
> --with-libxml2
[root@zzg zabbix-3.4.12]# make install
//修改/etc/php.ini的配置并重启php-fpm
[root@zzg etc]# sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
[root@zzg etc]# sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini[root@zzg etc]# sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
[root@zzg etc]# sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
[root@zzg etc]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@zzg ~]# systemctl stop firewalld
[root@zzg ~]# setenforce 0
[root@zzg ~]# vim /usr/local/php7/etc/php-fpm.d/www.conf
listen = 0.0.0.0:9000 //修改这一行
[root@zzg ~]# mkdir -p /www/zzg/zabbix
[root@zzg ~]# cd /usr/src/zabbix-4.0.4
[root@zzg ~]# cp -a frontends/php/* /www/zzg/zabbix/
[root@zzg ~]# chmod -R 777 /www/zzg/zabbix/
[root@zzg ~]# yum -y install nfs-utils
[root@zzg ~]# systemctl start rpcbind nfs-server
[root@zzg ~]# cat /etc/exports
/www/zzg/zabbix 192.168.220.60(insecure,rw)
[root@zzg ~]# exportfs -r
[root@zzg ~]# tail /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.php index.html index.htm; //添加index.php
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /www/zzg/zabbix; //zabbix目录
fastcgi_pass 192.168.220.50:9000; //对方ip
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/zzg/zabbix$fastcgi_script_name;
include fastcgi_params;
}
[root@zzg ~]# yum -y install nfs-utlis
[root@zzg ~]# mount -t nfs 192.168.220.50:/www/zzg/zabbix /usr/local/nginx/html/
//220.50
[root@zzg ~]# service php-fpm restart
//220.60
[root@zzg ~]# nginx -s reload