ZABBIX 安装手册
1.操作系统环境
CentOS release 6.7
服务器IP地址:X.X.X.X
安装过程
- 安装YUM源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2.安装MySQL
下载rpm源及安装
#rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
# yum install -y mysql-server mysql-devel
更改配置文件 添加内容如下:
#vi /etc/my.cnf
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
启动数据库
# service mysqld start
MySQL安全设置:
# mysql_secure_installation
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 MySQL
root user without the proper authorisation.
Set root password? [Y/n] y #设置root密码 选择Y 或者回车
New password: #设置root密码
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] y 是否删除匿名用户 选择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 是否禁止用户登陆root 远程 选择Y 为了安全考虑
... Success!
Remove test database and access to it? [Y/n] y 删除test数据库 选择y
- Dropping test database...
Reload privilege tables now? [Y/n] y 是否重新加载刷新表空间 选择Y 是
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
创建zabbix数据库
# mysql -uroot -p
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> show create database zabbix;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO [email protected] IDENTIFIED BY 'zabbix';
mysql> FLUSH PRIVILEGES;
mysql> show databases;
安装php5.6
# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
# yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
更改配置文件
vim /etc/php.ini
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
always_populate_raw_post_data = -1
3.安装zabbix
创建zabbix用户与组
# groupadd -g 201 zabbix
# useradd -g zabbix -u 201 -m zabbix
下载zabbix软件包并且安装
#wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz
#tar zxvf zabbix-3.0.3.tar.gz
# cd zabbix-3.0.3
# /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
# /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
# /usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
#./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix/ --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql --with-libxml2
# make && make install
配置zabbix
# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost 数据库ip地址
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP= IP 地址
#ln -s /usr/local/zabbix/sbin/* /usr/sbin/
#cd
#cp zabbix-3.0.3/misc/init.d/Fedora/core/zabbix_* /etc/init.d/
#chmod +x /etc/init.d/zabbix_*
#sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" #/etc/init.d/zabbix_server
#mkdir -p /var/www/html/zabbix
#cp -r zabbix-3.0.3/frontends/php/* /var/www/html/zabbix/
#chkconfig zabbix_server on
启动Apache和zabbix server
# /etc/init.d/zabbix_server restart
# /etc/init.d/httpd restart
4.打开浏览器 进行安装Zabbix
http://X.X.X.X/zabbix/setup.php
….
安装成功
登陆默认用户是Admin 密码 zabbix
- 常见问题
关闭防火墙:
Service iptables status
Service iptables stop
chkconfig iptables off
chkconfig iptables –list
设置/etc/selinux/config 文件,将SELINUX设置为disabled。
[[email protected] ~]# cat /etc/selinux/config
# This file controls the state of SELinux onthe system.
# SELINUX= can take one of these threevalues:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these twovalues:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted