## 编译安装 nginx
cd /opt/app
yum -y install wget gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel
wget 'http://nginx.org/download/nginx-1.16.0.tar.gz'
tar -xvf nginx-1.16.0.tar.gz
cd nginx-1.16.0/
./configure --prefix=/usr/local/nginx
make
make install
cd
vi .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/nginx/sbin
nginx -t #配置文件检查
nginx
nginx -s stop
vi /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
[Install]
WantedBy=multi-user.target
systemctl start nginx.service
systemctl status nginx.service
## 编译安装 php7
yum -y install gcc gcc-c++ libxml2 libxml2-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel openssl openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel readline readline-devel libxslt-devel perl perl-devel psmisc.x86_64 recode recode-devel libtidy libtidy-devel httpd-devel libzip-deve
yum remove libzip -y
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install
rz php-7.3.6.tar.gz
tar -xvf php-7.3.6.tar.gz
cd php-7.3.6
./configure --prefix=/usr/local/php7 --sysconfdir=/etc/php7 --with-config-file-path=/etc/php7 --with-apxs2=/usr/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mhash --with-openssl --with-zlib --with-bz2 --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-zlib --enable-mbstring --with-mcrypt --enable-sockets --with-iconv-dir --with-xsl --enable-zip --with-pcre-dir --with-pear --enable-session --enable-gd-native-ttf --enable-xml --with-freetype-dir --enable-gd-jis-conv --enable-inline-optimization --enable-shared --enable-bcmath --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-mbregex --enable-pcntl --with-xmlrpc --with-gettext --enable-exif --with-readline --with-recode --with-tidy --enable-fpm
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/
make
make install
cp ./php.ini-production /etc/php7
vi .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/nginx/sbin:/usr/local/php7/sbin:/usr/local/php7/bin
yum -y install php-fpm
systemctl start php-fpm.service
systemctl status php-fpm.service
vi /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm index.php;
}
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
systemctl restart nginx
# 安装 mysql
# 安装 zabbix
yum -y install libevent-devel wget tar gcc gcc-c++ make net-snmp-devel libxml2-devel libcurl-devel
useradd -s /sbin/nologin zabbix
cd /usr/local/src
rz zabbix-4.2.1.tar.gz
cd zabbix-4.2.1
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2make
make
make install
vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/nginx/sbin:/usr/local/php7/sbin:/usr/local/php7/bin:/usr/local/zabbix/bin:/usr/local/zabbix/sbin
# 初始化数据库
建库 建用户 授权 写入 schema.sql data.sql images.sql三个文件
create schema zabbix;
use zabbix;
create user 'zabbix'@'%' identified by 'zabbix';
grant all on zabbix.* to zabbix;
source /opt/app/zabbix-4.2.1/database/mysql/schema.sql
source /opt/app/zabbix-4.2.1/database/mysql/data.sql
source /opt/app/zabbix-4.2.1/database/mysql/images.sql
# 配置 zabbix
update dbversion set mandatory=3040000;
mkdir /usr/local/zabbix/log
chown zabbix:zabbix -R /usr/local/zabbix/log
vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/usr/local/zabbix/log/zabbix_server.log
DBHost=10.10.5.207
DBName=zabbix
DBSchema=zabbix
DBUser=zabbix
DBPassword=zabbix
DBPort=3306
Timeout=30
AlertScriptsPath=/usr/local/zabbix/alertscripts
ExternalScripts=/usr/local/zabbix/externalscripts
LogSlowQueries=3000
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1
chown -R zabbix:zabbix /usr/local/zabbix/
# 拷贝页面文件
mkdir /usr/local/nginx/html/zabbix/
cp -r /opt/app/zabbix-4.2.1/frontends/php/* /usr/local/nginx/html/zabbix/
# 启动
zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
关闭 zabbix_server
killall zabbix_server