标签:client 代码 技术分享 记录 3.0 mon sys nss rpm
一、Centos 6.5 下的Zabbix Server安装
上篇文章记录的是centos 7 下安装zabbix ,很简单。但是6.5上面没有可用的源直接安装zabbix,所以需要从别处下载。感谢itnihao团队的制作。
二、基础环境
zabbix server:系统:阿里云 centos6.5 4核8G
zabbix agent:系统:阿里云 centos6.5 4核8G
三、安装步骤:
zabbix需要mysql5.6以上版本,删除旧的版本
下载MySQL5.6版本
[root@localhost /]# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm [root@localhost /]# yum -y install mysql-server [root@localhost /]# yum list installed | grep mysql mysql-community-client.x86_64 5.6.32-2.el6 @mysql56-community mysql-community-common.x86_64 5.6.32-2.el6 @mysql56-community mysql-community-libs.x86_64 5.6.32-2.el6 @mysql56-community mysql-community-release.noarch mysql-community-server.x86_64 5.6.32-2.el6 @mysql56-community 修改mysql配置文件/etc/my.cnf,在[mysqld]中添加innodb_file_per_table=1
[root@localhost /]# vim /etc/my.cnf innodb_file_per_table=1 [root@localhost /]# /etc/init.d/mysqld start 这是强烈建议安全数据库和指定的“根”的帐户密码,删除匿名登录等。它是按照指令后MySQL安全安装完成。 root@localhost /]# mysql_secure_installation 登陆数据库 [root@localhost /]# mysql -u root -p #这里的root密码为123456 mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; Query OK, 1 row affected (0.06 sec) mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY ‘zabbixpass‘; Query OK, 0 rows affected (0.02 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | zabbix | +--------------------+ 4 rows in set (0.03 sec) mysql>
Zabbix 3需要PHP是至少5.4或更高版本。我们的CentOS 6.5库跟php 5.3.3因此我们需要安装一个新的。
[root@localhost /]# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
[root@localhost /]# yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
修改php配置
[root@localhost /]# vim /etc/php.ini post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = Asia/Shanghai always_populate_raw_post_data = -1
[root@localhost /]# vim /etc/httpd/conf/httpd.conf ServerName 127.0.0.1 DirectoryIndex index.html index.html.var index.php 启动apache [root@localhost /]# /etc/init.d/httpd start Starting httpd: [ OK ] 在iptables上开放80端口 [root@localhost /]# iptables -I INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT [root@localhost /]# /etc/init.d/iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] [root@localhost /]# cat /etc/sysconfig/iptables # Generated by iptables-save v1.4.7 on Mon Aug 29 21:58:54 2016 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [67:6921] -A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT # Completed on Mon Aug 29 21:58:54 2016 [root@localhost /]#
[root@localhost /]# groupadd zabbix [root@localhost /]# useradd -g zabbix zabbix
依赖包安装
[root@localhost mysql]# yum -y install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel
用于上传下载文件(由于直接在虚拟机里下载较慢、在此直接下载到本地主机用lrzsz上传至虚拟机) [root@localhost /]# yum -y install lrzsz zabbix3.0.4下载地址 [root@localhost /]# wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gz 解压到当前目录根 [root@localhost /]# tar -zxvf zabbix-3.0.4.tar.gz [root@localhost /]# cd zabbix-3.0.4/database/mysql/ [root@localhost mysql]# ls data.sql images.sql schema.sql [root@localhost mysql]# mysql -uroot -hlocalhost -p zabbix < schema.sql Enter password: #这里的root密码为123456 [root@localhost mysql]# mysql -uroot -hlocalhost -p zabbix < images.sql Enter password: [root@localhost mysql]# mysql -uroot -hlocalhost -p zabbix < data.sql Enter password:
[root@localhost mysql]# cd /usr/local/zabbix-3.0.4 编译 [root@localhost zabbix-3.0.4]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix 安装 [root@localhost zabbix-3.0.4]# make && make install [root@localhost zabbix-3.0.4]# echo $? 0
修改zabbix_server的配置
[root@localhost etc]# vim /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbixpass
创建一个新的web前端文件
[root@localhost conf]# mkdir /var/www/html/zabbix 移动源到刚才创建目录下 [root@localhost conf]#cd /usr/local/zabbix-3.0.4/frontends/php/ [root@localhost php]# cp -a . /var/www/html/zabbix/
设置Apache作为Web用户接口文件的所有者
[root@localhost php]# chown -R apache:apache /var/www/html/zabbix
添加权限给Zabbix Web界面执行文件
[root@localhost php]# chmod +x /var/www/html/zabbix/conf/
添加Zabbix服务器和Zabbix代理启动脚本
[root@localhost php]# cp /usr/local/zabbix-3.0.4/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server [root@localhost php]# cp /usr/local/zabbix-3.0.4/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
添加Zabbix服务器和Zabbix代理服务
[root@localhost php]# chkconfig --add /etc/init.d/zabbix_server [root@localhost php]# chkconfig --add /etc/init.d/zabbix_agentd [root@localhost php]# chkconfig httpd on [root@localhost php]# chkconfig mysqld on [root@localhost php]# chkconfig zabbix_server on [root@localhost php]# chkconfig zabbix_agentd on
启动zabbix_server
[root@localhost php]# /etc/init.d/zabbix_server start #报错 Starting zabbix_server: /etc/init.d/functions: line 546: /usr/local/sbin/zabbix_server: No such file or directory [FAILED] [root@localhost php]# vim /etc/init.d/zabbix_server BASEDIR=/usr/local/zabbix #更改下路径 [root@localhost php]# /etc/init.d/zabbix_server start Starting zabbix_server: [ OK ] [root@localhost php]# vim /etc/init.d/zabbix_agentd BASEDIR=/usr/local/zabbix #更改下路径 [root@localhost php]# /etc/init.d/zabbix_agentd start Starting zabbix_agentd: [ OK ]
标签:client 代码 技术分享 记录 3.0 mon sys nss rpm
原文地址:https://www.cnblogs.com/dukecc/p/9102101.html