设为首页 收藏本站
查看: 1016|回复: 0

[经验分享] Centos7下安装部署Zabbix3.4

[复制链接]

尚未签到

发表于 2019-1-18 08:33:56 | 显示全部楼层 |阅读模式
  Centos7下安装部署Zabbix3.4
  主要参考官方文档:
  https://www.zabbix.com/documentation/3.4/zh/manual/installation/install_from_packages
  一、系统基本配置
  1.配置IP地址
  1)编辑 /etc/sysconfig/network-scripts/ifcfg-eth0文档,修改成如下内容:
  DEVICE=eth0
  ONBOOT=yes
  BOOTPROTO=none
  IPADDR=172.17.100.211
  NETMASK=255.255.255.0
  GATEWAY=172.17.100.1
  DNS1=202.106.0.20
  DNS2=8.8.8.8
  2)重启网络服务
  # systemctl restart network.service
  3)验证
  # ifconfig -a   或 ip a
  2.更改主机名称
  hostnamectl set-hostname  zabbix
  备注:
  也可以使用nmtui命令修改网络IP地址和主机名称
  3.配置允许root账号远程登录
  1)编辑/etc/ssh/sshd_config文档,修改成如下内容:
  PermitRootLogin yes
  2)重启ssh服务
  # systemctl restart sshd.service
  4.关闭IPV6
  1)修改/etc/sysctl.conf配置文件
  # sed -i '$a net.ipv6.conf.all.disable_ipv6 =1\nnet.ipv6.conf.default.disable_ipv6 =1' /etc/sysctl.conf
  2)执行下面的命令来使设置生效。
  # sysctl -p
  5.关闭防火墙
  1)使用下列指令关闭防火墙
  # systemctl stop firewalld     (关闭防火墙)
  # systemctl disable firewalld  (禁止开机启动)
  2)查看firewalld 状态
  # firewall-cmd --state
  not running
  6.禁用SElinux(一定要关闭,否则有些功能不能正常使用)
  1)修改/etc/selinux/config配置文件
  # sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
  2)确认是否修改成功
  # cat /etc/selinux/config |grep -v ^# |grep -v ^$
  SELINUX=disabled
  SELINUXTYPE=targeted
  3)重启系统
  # reboot
  4)重启后,查看SELinux状态
  # sestatus
  SELinux status:                 disabled
  二、安装数据库
  1.安装Mariadb数据库(最新版本的linux系统,默认的是 Mariadb。)
  # yum install -y mariadb mariadb-server
  2.启动mariadb
  # systemctl start mariadb
  3.设置开机自启动
  # systemctl enable mariadb
  4.安全初始化,设置root密码等
  # mysql_secure_installation
  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] yes
  New password:                              (输入:123456)
  Re-enter new password:                     (输入:123456)
  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] y
  ... Success!
  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!
  5.测试登录
  # mysql -uroot -p123456

  三、安装Zabbix
  先在网站"http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/"下载“zabbix-release-3.4-2.el7.noarch.rpm”文件,通过xftp软件先将上传到/root/目录下
  1.安装 zabbix
  # rpm -ivh zabbix-release-3.4-2.el7.noarch.rpm
  2.安装 server和web端,基于mysql数据库
  # yum install -y zabbix-server-mysql zabbix-web-mysql
  3.初始化 zabbix DB
  1)登录数据库
  # mysql -uroot -p123456
  MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
  MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
  MariaDB [(none)]> grant all privileges on zabbix.* to root@localhost identified by '123456';
  MariaDB [(none)]> quit;
  Bye
  2)测试zabbix帐号能否正常使用
  [root@zabbix ~]# mysql -uzabbix -p123456

  3)导入数据
  # cd /usr/share/doc/zabbix-server-mysql-3.4.5/  (由于安装的版本有可能不一样,需要到/usr/share/doc/下确定)
  # zcat create.sql.gz | mysql -uroot -p123456 zabbix
  4.修改 Zabbix Server 配置,并启动 Zabbix Server 服务
  1)修改配置文件
  # vi /etc/zabbix/zabbix_server.conf
  DBHost=localhost
  DBName=zabbix
  DBUser=zabbix
  DBPassword=123456
  2)检查zabbix_server.conf配置文件修改结果
  # cat /etc/zabbix/zabbix_server.conf |grep -v ^# |grep -v ^$
  LogFile=/var/log/zabbix/zabbix_server.log
  LogFileSize=0
  PidFile=/var/run/zabbix/zabbix_server.pid
  SocketDir=/var/run/zabbix
  DBHost=localhost
  DBName=zabbix
  DBUser=zabbix
  DBPassword=123456
  SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
  Timeout=4
  AlertScriptsPath=/usr/lib/zabbix/alertscripts
  ExternalScripts=/usr/lib/zabbix/externalscripts
  LogSlowQueries=3000
  3)启动zabbix-server服务
  # systemctl start zabbix-server
  4)开机自启动zabbix-server服务
  # systemctl enable zabbix-server
  5)查看zabbix-server运行情况
  # systemctl status zabbix-server

  四、配置zabbix 管理界面
  1.编辑PHP配置

  # 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
  2.查看修改结果
  # cat /etc/httpd/conf.d/zabbix.conf |grep -v ^# |grep -v ^$
  Alias /zabbix /usr/share/zabbix
  
  Options FollowSymLinks
  AllowOverride None
  Require all granted
  
  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
  
  
  3.配置开启zh_CN语言显示(默认是开启的)
  # vi /usr/share/zabbix/include/locales.inc.php
  如果参数是:    'zh_CN' => ['name' => _('Chinese (zh_CN)'),    'display' => false],
  需要修改为:    'zh_CN' => ['name' => _('Chinese (zh_CN)'),    'display' => true],
  4.启动Apache服务
  # systemctl start httpd
  5.开机启动Apache服务
  # systemctl enable httpd
  6.查看Apache服务运行情况
  # systemctl status httpd

  五、登陆 Zabbix 管理页面,显示Zabbix安装向导。

  1.登录管理页面
  http://172.17.100.211/zabbix/  (IP:172.17.100.211,需要更换成你自己的IP地址)
  2.输入密码:123456

  3.zabbix web用户名及密码分别是:Admin/zabbix




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-664603-1-1.html 上篇帖子: zabbix 报告生成 下篇帖子: Zabbix最佳实践一:Zabbix4.0.2的安装与配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表