1. 程式人生 > >Centos7下搭建Zabbix

Centos7下搭建Zabbix

ges restart start bin chown time rpm -ivh 正式 登錄

安裝Mysql5.6
1.下載MySQL的repo源

#wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2.安裝mysql-community-release-el7-5.noarch.rpm包

#rpm -ivh mysql-community-release-el7-5.noarch.rpm

3.安裝mysql

#yum install -y mysql-server

這裏已經將MySQL安裝好了,但是並不能登錄,需要重置密碼
4.重置密碼前需要先登錄

#mysql -u root
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2)
#原因是/var/lib/mysql訪問權限問題

5.修改權限

#chown -R root:root /var/lib/mysql

6.重啟服務

#service mysqld restart

7.重置密碼

#mysql -u root
mysql> use mysql;
mysql> update user set password=password(‘密碼‘) where user=‘root‘;
mysql>  flush privileges;
mysql> exit;

正式安裝:
1.使用Mysql安裝數據存儲

 #rpm -i https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

2.安裝ZabBIX服務器、前端、代理

#yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent

3.創建初始數據庫

# mysql -uroot -p
root賬戶密碼
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix賬號的密碼‘;
mysql> quit;

4.導入初始模式和數據。將提示您輸入新創建的密碼。

#zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

5.為ZabBIX服務器配置數據庫

#vi /etc/zabbix/zabbix_server.conf
DBPassword=zabbix賬號的密碼

6.為ZabBIX前端配置PHP,去掉註釋,並設置為自己的時區

#vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

7.啟動ZabBIX服務器和代理進程並使其在系統啟動時啟動

# systemctl restart zabbix-server zabbix-agent httpd
# systemctl enable zabbix-server zabbix-agent httpd

Centos7下搭建Zabbix