###替换默认centos源为阿里云的源
cd /etc/yum.repos.d/
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
备份(如有配置其他epel源)
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
cd /etc/yum.repos.d
vim zabbix.repo
[zabbix]
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/
enabled=1
gpgcheck=0
最后执行
yum makecache
yum install -y zabbix-release //安装源码库配置部署包
yum install -y zabbix-server-mysql zabbix-web-mysql
只安装Zabbix Agent的示例.
yum install zabbix-agent
yum install -y mysql-server mysql
systemctl enable mysql
systemctl start mysql
##初始化mysql数据库
shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;
然后导入初始架构(Schema)和数据。
cd /usr/share/doc/zabbix-server-mysql-3.4*
zcat create.sql.gz | mysql -uroot zabbix
vim +95 /etc/httpd/conf/httpd.conf
ServerName 192.168.200.132:80
systemctl restart httpd
vim /etc/httpd/conf.d/zabbix.conf
#启用时区设置,并将其改为上海
php_value date.timezone Asia/Shanghai
在zabbix_server.conf中编辑数据库配置
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=
启动Zabbix Server进程
systemctl start zabbix-server
vim /etc/zabbix/zabbix_agentd.conf
#修改其中是Server项 , 让其指向zabbix-server的地址
Server=192.168.200.132
##访问zabbix
Zabbix前端可以在浏览器中通过 http://zabbix-frontend-hostname/zabbix 进行访问。默认的用户名/密码为 Admin/zabbix