1、关闭防火墙和selinux
# systemctl stop firewalld # vi /etc/selinux/config SELINUX=permissive # setenforce 0
2、添加zabbix存储库
# rpm -ivh HTTPs://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
3、安装zabbix-server-mysql和zabbix-web-mysql
# yum install -y zabbix-server-mysql zabbix-web-mysql
要在 MySQL支持下安装Zabbix服务器
要在 MySQL支持下安装Zabbix前端
要使用MySQL支持安装Zabbix代理
# yum install zabbix-proxy-mysql -y
对服务器进行自身监控
安装zabbix-agent客户端
# yum install zabbix-agent -y
设置开机自启动
# systemctl start zabbix-agent # chkconfig zabbix-agent on
4、安装并且启动mysql5.6及初始化数据库信息
# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm # yum install -y mysql-community-server
启动mysqld服务
# systemctl start mysqld
设置开机自启动
# chkconfig mysqld on
初始化数据库信息
# mysql_secure_installation
[root@localhost ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): //回车 OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up...
5、创建zabbix数据库,创建zabbix账号
# mysql -uroot -p
创建一个zabbix库并设置为utf8的字符编码格式
mysql> create database zabbix character set utf8 collate utf8_bin;
创建账户并且授权设置密码
给来自loclhost的用户zabbxi分配可对数据库zabbix所有表进行所有操作的权限,并且设定密码为zabbix
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
刷新
mysql> flush privileges;
6、导入默认的zabbix数据库信息
# zcat /usr/share/doc/zabbix-server-mysql-4.2.0/create.sql.gz | mysql zabbix -uzabbix -pzabbix
7、修改zabbix_server.conf的配置文件
vi /etc/zabbix/zabbix.server.conf ------>修改ZABBIX服务配置文件
# grep ^DB /etc/zabbix/zabbix_server.conf ---->查看配置文件是否修改正确
# vi /etc/php.ini ---->修改PHP.ini文件
在最后一行添加一下内容
php_value max_execution_time 300php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300
8、修改系统时间
安装ntp服务
# yum install ntpdate -y
调整为亚洲上海时区
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
同步时间服务器
# ntpdate us.pool.ntp.org
9、修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成 Asia/Shanghai
# vi /etc/httpd/conf.d/zabbix.conf
10、启动apache/zabbix-server服务并设置为开机启动
启动apache
# systemctl start httpd # systemctl enable httpd
启动zabbix-server服务并设置为开机启动
# systemctl start zabbix-server # systemctl enable zabbix-server
zabbix-server的web目录
# ls /usr/share/zabbix
10、访问网站,例如:http://本机IP/zabbix,如下图所示:
PHP版本
password是我们设置的数据库密码zabbix
输入名字
查看zabbix基础信息
安装完成
Zabbix·server的默认账号Admin 密码zabbix
移除或改名web目录下面的setup.php文件
# mv /usr/share/zabbix/setup.php /usr/share/zabbix/setup.php.bak
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
- 上一篇: centos使用163yum源
- 下一篇: 解决ZABBIX中文乱码无法显示的问题
发表评论