1. 程式人生 > >zabbix 3.0.0beta1安裝-centos6.8版本

zabbix 3.0.0beta1安裝-centos6.8版本

php5 服務器 ase zabbix3 inux reat europe 下載 host

zabbix 3.0安裝

zabbix最低需要mysql 5.5 php5.3

查詢mysql版本
yum list installed | grep mysql
##mysql-libs.x86_64 5.1.73-5.el6_6 @anaconda-CentOS-201508042137.x86_64/6.7

卸載mysql
yum remove mysql*

指定mysql源
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

安裝mysql
yum install mysql-server

安裝vim 文本編輯器

yum install vim -y

修改mysql配置
vim /etc/my.cnf

[mysqld]
innodb_file_per_table

啟動mysql服務
service mysqld start

更新配置
mysql_secure_installation
Enter current password for root (enter for none):

Set root password? [Y/n]

Remove anonymous users? [Y/n]

Disallow root login remotely? [Y/n]

Remove test database and access to it? [Y/n]

Reload privilege tables now? [Y/n]

登陸mysql數據庫
mysql -u root -p

創建zabbix的數據庫
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
授權zabbix系統訪問Mysql數據庫的用戶和密碼:
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY ‘zabbix‘;

查詢數據庫信息
mysql> show databases;
+--------------------+
Database
+--------------------+

information_schema
mysql
performance_schema
zabbix
+--------------------+
4 rows in set (0.00 sec)
If everything is fine then exit the database for now.

exit

Zabbix 3.0 requires PHP to be at least version 5.4 or higher. Our CentOS 6.7 repositories come with PHP 5.3.3 therefore we need to install a newer one.

指定zabbix源
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

安裝php等支持庫
yum install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

編輯php配置
vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Europe/Riga
always_populate_raw_post_data=-1

啟動Apache服務
service httpd start

防火墻放行80端口
iptables -I INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables-save > /etc/sysconfig/iptables
查詢防火墻
ip a

創建zabbix用戶
groupadd zabbix
useradd -g zabbix zabbix

創建zabbix下載路徑並進入
mkdir /home/zabbix/downloads
cd /home/zabbix/downloads

安裝 wget下載工具
yum install wget -y

下載zabbix3.0gz包
wget "https://sourceforge.net/projects/zabbix/files/ZABBIX Latest Development/3.0.0beta1/zabbix-3.0.0beta1.tar.gz"
wget "https://sourceforge.net/projects/zabbix/files/ZABBIX Latest Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz"
解壓
tar -zxvf zabbix-3.0.0beta1.tar.gz

導入數據庫
cd /home/zabbix/downloads/zabbix-3.0.0beta1/database/mysql
mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql

安裝依賴庫
yum install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel

cd ../..
查看編譯幫助
./configure --help
Configure all components required for Zabbix.
編譯
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl
安裝zabbix
make install

配置zabbix-server
vim /usr/local/etc/zabbix_server.conf

DBName=zabbix
DBUser=zabbix
DBPassword=your_password

創建服務路徑
mkdir /var/www/html/zabbix
cd /home/zabbix/downloads/zabbix-3.0.0beta1/frontends/php/

cp -a . /var/www/html/zabbix/

創建規則,以允許我們的Web服務器來訪問前端文件。
chcon -Rv --type=httpd_sys_content_t /var/www/html

selinux未關閉賦予權限
setsebool -P httpd_can_network_connect=1
setsebool -P zabbix_can_network=1
Set Apache user as owner of the web interface files.

賦予權限
chown -R apache:apache /var/www/html/zabbix
chmod +x /var/www/html/zabbix/conf/

拷貝數據
cp /home/zabbix/downloads/zabbix-3.0.0beta1/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp /home/zabbix/downloads/zabbix-3.0.0beta1/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
Add Zabbix server and Zabbix agent as services.

自啟動
chkconfig --add /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_agentd
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agentd on

啟動服務
service zabbix_server start
service zabbix_agentd start

#####修改中文支持

開啟中文支持
locales.inc.php
‘zhCN‘ => [‘name‘ => (‘Chinese (zh_CN)‘), ‘display‘ => true]

解決中文亂碼
defines.inc.php
#修改第93行
define(‘ZBX_FONT_NAME‘, ‘msyh‘);
#修改第45行改為
define(‘ZBX_GRAPH_FONT_NAME‘, ‘msyh‘)

zabbix 3.0.0beta1安裝-centos6.8版本