Linux安装zabbix 用Windows作为代理

一,关掉防火墙

二,安装Zabbix rpm包仓库
[root@localhost ~]# rpm -vhi http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

三,安装zabbix-server-mysql和zabbix-web-mysql
[root@localhost ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
四,安装并且启动mysql5.6及初始化数据库信息
[root@localhost ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
[root@localhost ~]# yum install -y mysql-community-server
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# /sbin/chkconfig mysqld on #开机启动

[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):
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:
Sorry, passwords do not match.
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] y
… Success!
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!
五,创建zabbix数据库,创建zabbix账号
[root@localhost ~]# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to ‘zabbix’@‘localhost’ identified by ‘zabbix’; #注意后面密码带引号
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> Ctrl-C – exit!
六,导入默认的zabbix数据库信息
[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.0.24/
[root@localhost zabbix-server-mysql-3.0.24]# zcat /usr/share/doc/zabbix-server-mysql-3.0.24/create.sql.gz | mysql zabbix -uzabbix -pzabbix
七,修改zabbix_server.conf的配置文件
[root@localhost ~]# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

八,修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成 Asia/Shanghai
[root@localhost ~]# vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai
九,启动apache/zabbix-server服务并设置为开机启动
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# systemctl start zabbix-server
[root@localhost ~]# systemctl enable zabbix-server

问题一:

用navicat连接到对应的数据库 提示不能连接的到服务器时,请查看mysql数据库中的user表是否有IP为属性值的host,为了方便建议再授权的方式进行修改

grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

flush privileges;

用这两个命令 再sql面板中执行, 将localhost改为%

部署成功后,直接IP加zabbix即可访问

 

 

Guess you like

Origin blog.csdn.net/testManger/article/details/121855360