操作系统类型:Ubuntu 系统环境版本:4.4.0-122-generic IP地址:192.168.152.118 |
第一步:选择适当的操作系统类型与各项的版本要求,我这边直接使用LNMP脚本平台搭建;
https://lnmp.org/download.html下下载lnmp1.5-full.tar.gz脚本安装包
1:上面连接中是一个LNMP平台的脚本程序包,下载对应服务器和相应的目录中进行解压;
SH152118:/tmp/Package$ sudo tar xvf lnmp1.5-full.tar.gz
SH152118:/tmp/Package$ cd lnmp1.5-full/
SH152118:/tmp/Package/lnmp1.5-full$sudo bash install.sh
root@SH152118:~# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")
root@SH152118:~# vim /etc/my.cnf //注释掉client字段中的socket = /tmp/mysql.sock在进行服务重启;
[client]
#password = your_password
port = 3306
#socket = /tmp/mysql.sock
root@SH152118:~# /etc/init.d/mysql restart
[ ok ] Restarting mysql (via systemctl): mysql.service.
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'password'; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>exit
----------------------------------------------------------------------------------------------------------------------------
5:初始化导入表结构
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: password
------------------------------------------------------------------------------------------------------------------------------
6:修改zabbix_server.conf文件
---------------------------------------------------------------------------------------------------------------------------
7:拷贝相关配置文件到对应nginx默认目录下,一键脚本默认路径为 /home/wwwroot/default/
# cp -r /usr/share/zabbix/ /home/wwwroot/default/
# cd /home/wwwroot/default/zabbix/conf/
#rm -rf zabbx.conf.php
#cp zabbix.conf.php.example ./zabbix.conf.php
#vim ./zabbix.conf.php
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '127.0.0.1';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'password';
# chown www.www /home/wwwroot/default/* -R
#vim /etc/zabbix/zabbix_server.conf 修改配置文件
DBSocket=/tmp/mysqld.sock
#ln -s /run/mysqld/mysqld.sock /tmp/
#/etc/init.d/php-fpm restart
----------------------------------------------------------------------------------------------------------------------------
访问:http://IP/zabbix/zabbix.php
修改配置文件:
max_input_time = 60 修改为:max_input_time = 300
;always_populate_raw_post_data = -1 修改为:always_populate_raw_post_data = -1
SH152118:~# /etc/init.d/php-fpm restart 重新启动服务;
----------------------------------------------------------------------------------------------
如有问题可联系WX:ai759731807