yum 源安装默认为最新版目前是8.0
如果需要更改其他版本,可以执行完 yum -y localinstall xxx 之后 修改/etc/yum.repos.d/mysql-community.repo
需要安装哪个版本就把参数更改为 1 和 1
yum -y localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI ntpdate libevent libevent-devel kernel libxml2-devel libevent-devel yum-utils pcre pcre-devel openssl openssl-devel zlib zlib-devel gcc gcc-c++ mysql-community-server mysql-community-devel mysql-connector-c++-devel
yum -y install net-snmp-devel curl-devel
service mysqld start
cat /var/log/mysqld/mysql.log |grep "password" //查看密码
登录MySQL,并创建zabbix用户
ALTER USER 'root'@'localhost' IDENTIFIED BY '自定义密码(注意密码强度)';
create database zabbix character set utf8 collate utf8_bin;
create user 'zabbix'@'127.0.0.1' identified with mysql_native_password by '自定义密码';
grant all privileges on zabbix.* to "zabbix"@"127.0.0.1";
#create user 'zabbix'@'localhost' identified with mysql_native_password by '自定义密码';
#create user 'zabbix'@'%' identified with mysql_native_password by '自定义密码';
#grant all privileges on zabbix.* to "zabbix"@"localhost";
#grant all privileges on zabbix.* to "zabbix"@"%";
flush privileges;
如需要导入zabbix初始数据库:官网可以下载,
脚本一键安装:
安装路径:/opt/nginx
源码路径:/root/
#!/bin/bash
useradd -s /sbin/nologin nginx #创建一个不能登陆系统的用户nginx
#Installation dependence
yum groupinstall -y "Development tools"
yum install -y gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel
yum install -y pcre-devel pcre zlib zlib-devel openssl openssl-devel wget gcc gcc-c++ unzip
yum -y install git
#Download source
wget http://nginx.org/download/nginx-1.20.1.tar.gz
tar -xvf nginx-1.20.1.tar.gz -C /opt
#Compile and install
cd /opt/nginx-1.20.1/
sed -i '49s/nginx/Microsoft-IIS/' src/http/ngx_http_header_filter_module.c
sed -i '50s/: /: Microsoft-IIS/' src/http/ngx_http_header_filter_module.c
sed -i '51s/: /: Microsoft-IIS/' src/http/ngx_http_header_filter_module.c
./configure \
--prefix=/opt/nginx/ \
--user=nginx \
--group=nginx \
--with-pcre \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-http_v2_module \
--with-threads \
--with-stream \
--with-stream_ssl_module
make && make install
ln -s /opt/nginx/sbin/nginx /usr/bin/nginx
nginx
ps -aux|grep nginx
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install -y ./remi-release-7.rpm
yum install -y php72-php-devel php72-php-fpm php72-php-mbstring php72-php-memcache php72-php-redis php72-php-mysqli php72-php-mysqlnd php72-php-pdo php72-php-bcmath php72-php-dom php72-php-gd php72-php-gmp php72-php-igbinary php72-php-imagick php72-php-mcrypt php72-php-pdo_mysql php72-php-posix php72-php-simplexml php72-php-opcache php72-php-xsl php72-php-xmlwriter php72-php-xmlreader php72-php-xml php72-php-swoole php72-php-zip php72-php-fileinfo curl curl-devel net-snmp net-snmp-devel perl-DBI ntpdate libxml2-devel libevent-devel yum-utils pcre pcre-devel openssl openssl-devel zlib zlib-devel gcc gcc-c++
路径:/etc/opt/remi/php72/php-fpm.d/www.conf
vim /etc/opt/remi/php72/php-fpm.d/www.conf
修改参数:
max_execution_time=300 #修改为300
post_max_size=16M
upload_max_filesize=8M
max_input_time=300
date.timezone=“Asia/Shanghai” #增加
always_populate_raw_post_data=-1 #增加
systemctl restart php72-php-fpm
安装目录:/opt/zabbix
wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.22.tar.gz
tar zxvf zabbix-5.0.22.tar.gz
cd zabbix-5.0.22
./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-net-snmp --enable-java --with-libxml2 --with-libcurl --with-libxml2 --with-mysql
make && make install
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
chmod +x /etc/init.d/zabbix_server
sed -i 's#BASEDIR=.*$#BASEDIR=/opt/zabbix#' /etc/init.d/zabbix_server
sed -i 's#BASEDIR=.*$#BASEDIR=/opt/zabbix#' /etc/init.d/zabbix_agentd
vim /opt/zabbix/etc/zabbix_server.conf
以下是需要修改的配置的地方
LogFile=/var/log/zabbix/zabbix_server.log //如果修改这个就要创建目录
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=数据库自定义的密码
DBSocket=/var/lib/mysql/mysql.sock
Timeout=30
LogSlowQueries=3000
JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5
cp -r /opt/nginx/conf/nginx.conf /opt/nginx/conf/nginx.conf.bak
vim /opt/nginx/conf/nginx.conf +65
将源码包中frontends/php/*拷贝到nginx的html目录下,配置nginx支持php页面,启动nginx
nginx -t
nginx -s reload
systemctl daemon-reload
systemctl start zabbix_server
systemctl start zabbix_agentd
systemctl restart php72-php-fpm
systemctl enable php72-php-fpm