centos8 编译lnmp环境 编译安装zabbix5.0.1

#######安装lnmp基础环境#######

dnf update -y
dnf -y install wget tmux
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz
tar xf lnmp1.7.tar.gz
cd lnmp1.7/
./install.sh
10: Install MariaDB 10.4.13
10: Install PHP 7.4.6
1: Don't install Memory Allocator. (Default)
mkdir /zabbix5
cd /zabbix5/

########安装go1.13运行环境######

wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz
tar -C /usr/local -xf go1.13.4.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin">>/etc/profile
source /etc/profile
#echo "export GO111MODULE=on" >> ~/.profile
#echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
#source ~/.profile
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

#######编译zabbix##########

useradd zabbix
tar xf ~/zabbix-5.0.1.tar.gz
cd /zabbix5/zabbix-5.0.1/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \
yum -y install net-snmp net-snmp-devel openldap-devel openldap
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent  --with-mysql=/usr/local/mariadb/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 --enable-proxy --enable-agent2
make install

########初始化数据库#########

mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'zabbix';
grant all privileges on zabbix.* to zabbix@localhost;
use zabbix;
source /zabbix5/zabbix-5.0.1/database/mysql/schema.sql
source /zabbix5/zabbix-5.0.1/database/mysql/images.sql
source /zabbix5/zabbix-5.0.1/database/mysql/data.sql
exit

#########安装界面################
/usr/local/zabbix/etc/zabbix_server.conf 配置 DBPassword=zabbix

mkdir /home/wwwroot/default/zabbix
cp -r /zabbix5/zabbix-5.0.1/ui/* /home/wwwroot/default/zabbix/
chown -R www:www zabbix
cd /root/lnmp1.7/src
tar xf php-7.4.6.tar.bz2
cd php-7.4.6/ext/ldap/
/usr/local/php/bin/phpize
cp -frp /usr/lib64/libldap* /usr/lib/
./configure -with-php-config=/usr/local/php/bin/php-config
make
make install
sed -i "s/max_input_time = 60/max_input_time = 300/g"  /usr/local/php/etc/php.ini
sed -i "s/;extension=ldap/extension=ldap/g"  /usr/local/php/etc/php.ini
/etc/init.d/php-fpm restart

############访问http://192.168.31.71/zabbix/setup.php配置zabbix页面
修改图形页面中文乱码问题
yum install -y langpacks-zh_CN
上传字体到/home/wwwroot/default/zabbix/assets/fonts
chown www:www /home/wwwroot/default/zabbix/assets/fonts/*
复制字体名字
SourceHanSansCN
修改 /home/wwwroot/default/zabbix/include/defines.inc.php
define(‘ZBX_GRAPH_FONT_NAME’, ‘DejaVuSans’);改为define(‘ZBX_GRAPH_FONT_NAME’, ‘SourceHanSansCN’);

cat > /lib/systemd/system/zabbix-server.service << \EOF
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service
[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0
[Install]
WantedBy=multi-user.target
EOF

cat > /lib/systemd/system/zabbix-agent.service << \EOF
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID``RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target
EOF

systemctl enable --now zabbix-server
systemctl enable --now zabbix-agent
firewall-cmd  --permanent  --add-port=80/tcp
firewall-cmd  --permanent  --add-port=10050/tcp
firewall-cmd  --permanent  --add-port=10051/tcp
firewall-cmd  --reload
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值