Centos7.3 yum部署 zabbix-server文档

前端之家收集整理的这篇文章主要介绍了Centos7.3 yum部署 zabbix-server文档前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

一、关闭SElinux

[root@zabbix ~]# vi /etc/selinux/config

SELINUX=disabled
SELINUXTYPE=targeted

重启系统, 如果不想重启系统,使用命令setenforce 0

二、开放防火墙必要的端口:

[root@zabbix ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@zabbix ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
[root@zabbix ~]# firewall-cmd --zone=public --add-port=10050/tcp --permanent
[root@zabbix ~]# firewall-cmd --zone=public --add-port=10051/tcp --permanent
[root@zabbix ~]# firewall-cmd --reload

三、安装必要工具:

[root@zabbix ~]# yum -y install vim openssl openssl-devel gcc gcc-c++ telnet net-tools

四、安装apache:

[root@zabbix ~]# yum -y install httpd

启动:

[root@zabbix ~]# systemctl start httpd

设置开机启动:

[root@zabbix ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service

五、安装mariaDB:

[root@zabbix ~]# yum -y install mariadb mariadb-server

覆盖配置:

[root@zabbix ~]# cp /usr/share/MysqL/my-medium.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y

启动:

[root@zabbix ~]# systemctl start mariadb

设置密码以及其他:

[root@zabbix ~]# MysqL_secure_installation

/usr/bin/MysqL_secure_installation:行379: find_MysqL_client: 未找到命令
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it,we'll need the current
password for the root user. If you've just installed MariaDB,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 MariaDB
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 MariaDB installation has an anonymous user,allowing anyone
to log into MariaDB 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,MariaDB 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...
... Success!
- 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!
Cleaning up...
All done! If you've completed all of the above steps,your MariaDB
installation should now be secure.
Thanks for using MariaDB!

设置开机启动:

[root@zabbix ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

六、安装PHP

[root@zabbix ~]# yum -y install PHP PHP-bcmatch PHP-gd PHP-mbstring PHP-MysqL PHP-pdo PHP-ldap PHP-pear PHP-ldap PHP-devel PHP-cli

七、配合httpd与PHP

[root@zabbix ~]# vim /etc/httpd/conf/httpd.conf

把 DirectoryIndex index.html

改为: DirectoryIndex index.html index.PHP

重启httpd:

[root@zabbix ~]# systemctl restart httpd

添加index.PHP文件内容

[root@zabbix ~]# vim /var/www/html/index.PHP

<?PHP

PHPinfo();

然后访问一下,看看是否成功:http://172.0.0.53/index.PHP

八、安装zabbix源:

[root@zabbix ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
获取http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
警告:/var/tmp/rpm-tmp.ExKdN8: 头V4 DSA/SHA1 Signature,密钥 ID 79ea5ed4: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:zabbix-release-3.0-1.el7 ################################# [100%]

九、安装zabbix服务(server):

[root@zabbix ~]# yum install zabbix-server-MysqL zabbix-web-MysqL

十、添加连接的MysqL用户与库:

[root@zabbix ~]# MysqL -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.50-MariaDB MariaDB Server
Copyright (c) 2000,2016,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;
Query OK,1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'localhost'
-> IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK,0 rows affected (0.01 sec)
MariaDB [(none)]> exit;
Bye

十一、导入sql数据:

[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-MysqL-3.0.4/create.sql.gz | MysqL -uzabbix -p123456 zabbix

十二、配置zabbix-server:

[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf

改了对应的配置项

ListenPort=10051
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBSocket=/var/lib/MysqL/MysqL.sock
DBPort=3306

启动:

[root@zabbix ~]# systemctl start zabbix-server

十三、配置web管理应用:

[root@zabbix ~]# vim /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 :

[root@zabbix ~]# systemctl restart httpd

十四、管理web界面:

访问:http://172.0.0.53/zabbix/

原文链接:https://www.f2er.com/centos/377245.html

猜你在找的CentOS相关文章