zabbix安裝的環(huán)境要LNMP(linux+nginx+mysql+PHP)或LAMP(linux+apache+mysql+PHP)
先安裝阿里源epel源
yum -y install wget
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
再手寫zabbix源
vim /etc/yum.repo.d/zabbix.repo
[zaibbx]
name=zabbix
baseurl=http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/
enabled=1
gpgcheck=0
緩存
sudo yum clean all
sudo yum makecache
一、先安裝mysql數(shù)據(jù)庫
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum -y install mysql-community-server
vim /etc/my.cnf
skip_name_resolve=on
innodb_file_per_table=on
systemctl restart mysqld
systemctl enable mysqld
mysql_secure_installation 配置mysql
mysql -uroot -pAbcd1234
create database zabbix charset 'utf8'; #創(chuàng)建一個名叫zabbix的數(shù)據(jù)庫
grant all on zabbix.* to zabbix@'127.0.0.1' identified by 'Abcd1234'; #創(chuàng)建一個zabbix的用戶密碼為Abcd1234,并允許通過127.0.0.1進行連接
grant all on zabbix.* to zabbix@'192.168.0.%' identified by 'Abcd1234';
flush privileges; #刷新權(quán)限
exit
systemctl restart mysqld
二、開始安裝php環(huán)境
yum -y install gcc-c++ php-fpm php-mysql php bzip2 lrzsz
常用的PHP開發(fā)庫(php-gd、curl、php-mysql)
systemctl restart php-fpm
systemctl enable php-fpm
三、安裝服務(wù)端的zabbix
yum -y install zabbix-server-mysql zabbix-web zabbix-agent zabbix-web-mysql zabbix-sender zabbix-get
zabbix server數(shù)據(jù)庫初始化:
2.x:三個sql腳本;依次執(zhí)行;
3.x:一個sql腳本:create.sql
rpm -ql zabbix-server-mysql
cd /usr/share/doc/zabbix-server-mysql-3.2.6/
gzip -d create.sql.gz
mysql -h127.0.0.1 -u zabbix -p zabbix < create.sql #-p這里指數(shù)據(jù)庫
cd /etc/zabbix
cp zabbix_server.conf{,.backup}
vim zabbix_server.conf
通用參數(shù):
ListenPort=10051
SourceIP= #當有多個IP時,將哪個IP作為原IP
LogType=file #自我獨立記錄格式記性
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=1024 #0表示不滾動
PidFile=/var/run/zabbix/zabbix_server.pid #服務(wù)端PID路徑
DBHost=127.0.0.1 #數(shù)據(jù)庫所在IP地
DBName=zabbix #數(shù)據(jù)庫的名字
DBUser=zabbix #數(shù)據(jù)庫連接的用戶
DBPassword=Abcd1234 #數(shù)據(jù)庫連接的用戶密碼
DBSocket=/var/lib/mysql/mysql.sock #前文主機設(shè)置為localhost,用戶連接數(shù)據(jù)庫所用的sock位置
systemctl restart zabbix-server
systemctl enable zabbix-server
啟動服務(wù):
systemctl start zabbix-server.service
注意:centos7.0和7.1需要升級trousers
四、安裝apache
yum -y install httpd
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
systemctl restart httpd
systemctl enable httpd
firewall-cmd --add-service=mysql --permanent ; firewall-cmd --reload
setenforce 0
登入默認是admin 密碼:zabbix
參考資料:
http://dengxi.blog.51cto.com/4804263/1743146
http://www.ttlsa.com/zabbix/install-zabbix-on-linux-5-ttlsa/