Zabbix 3.2 Install in CentOS 6.x
##參考所需套件Zabbix所需套件(官方網站)
##https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages
cd /usr/local/src/
mkdir zabbix
cd zabbix
#先安裝 mariaDB yum源
vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
#先安裝LAMP環境
yum install -y httpd php php-mysql php-bcmath php-gd php-mbstring MariaDB-*
#下載zabbix套件至/usr/local/src/zabbix
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-agent-3.2.1-1.el6.x86_64.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-get-3.2.1-1.el6.x86_64.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-proxy-mysql-3.2.1-1.el6.x86_64.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-1.el6.noarch.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-sender-3.2.1-1.el6.x86_64.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/zabbix-server-mysql-3.2.1-1.el6.x86_64.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/zabbix-web-3.2.1-1.el6.noarch.rpm
wget http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/zabbix-web-mysql-3.2.1-1.el6.noarch.rpm
wget http://repo.zabbix.com/non-supported/rhel/6/x86_64/fping-2.4b2-16.el6.x86_64.rpm
wget http://repo.zabbix.com/non-supported/rhel/6/x86_64/iksemel-1.4-2.el6.x86_64.rpm
#安裝zabbix套件
cd /usr/local/src/zabbix
yum -y localinstall *.rpm
#配置MySQL
service mysql start #啟動資料庫
mysql_secure_installation #初始化資料庫root的密碼
mysql -u root -p
mysql> create database zabbix character set utf8 collate utf8_bin;
#建置zabbix資料庫 格式設定UTF8
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'P@ssw0rd'; #授權
mysql>flush privileges;
mysql> quit;
zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uzabbix -pzabbix -b zabbix
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'P@ssw0rd'; #授權
mysql>flush privileges;
mysql> quit;
zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uzabbix -pzabbix -b zabbix
#導入zabbix table至Mysql
##PS:先建資料庫再導入table最後再授權 要按照順序
#安裝yum源 (更新PHP5.6)
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
##PS:先建資料庫再導入table最後再授權 要按照順序
#安裝yum源 (更新PHP5.6)
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
#使用yum list命令查看可安裝的套件(Packege)。
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
#升級PHP5.6
yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
#通過WEB頁面設置ZABBIX
cp /usr/share/doc/zabbix-web-3.2.0/httpd22-example.conf /etc/httpd/conf.d/zabbix.conf #把ZABBIX的配置文件配置到HTTPD目錄中
#設定php.ini
vim /etc/php.ini
date.timezone= Asia/Taipei
max_execution_time 300
post_max_size 16M
max_input_time 300
#設定/etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#重新啟動服務
service zabbix-server restart
service httpd restart
service mysqld restart
#設置重開機啟動服務
chkconfig --level 35 zabbix-server on
chkconfig --level 35 zabbix-agent on
chkconfig --level 35 httpd on
chkconfig --level 35 mysqld on
#進web 設定zabbix
http://yousrvip/zabbix
登入帳密:admin/yourpassword
##修改語系為中文
cd /usr/share/zabbix/include
cp locales.inc.php bak.locales.inc.php ##先備份設定檔
vim locales.inc.php
56 'zh_TW' => ['name' => _('Chinese (zh_TW)'), 'display' => true], ##將第56行zh_TW的 false改為 true
##修改亂碼
擷取Windows 的字形至桌面例如:msjhl.ttc -->修改附檔名為ttf
將其上傳至zabbix主機 /usr/share/zabbix/fonts
先將原有字形備份並修改參數
mv graphfont.ttf graphfont.ttf.bak
vim /usr/share/zabbix/include/defines.inc.php
約45行
define('ZBX_GRAPH_FONT_NAME', 'graphfont');graphfont 修改為 define('ZBX_GRAPH_FONT_NAME', 'msjhbd');
約93行
define('ZBX_FONT_NAME', 'graphfont'); 修改為
define('ZBX_FONT_NAME', 'msjhbd');
## Firewall所需開啟的port
Opened SSH port (22 TCP); #或自定義的port
Opened Zabbix agent (10050 TCP) and Zabbix trapper (10051 TCP) ports;
Opened HTTP (80 TCP) and HTTPS (443 TCP) ports;
Opened SNMP trap port (162 UDP);
Opened outgoing connections to NTP port (53 UDP);
ICMP pakets limited to 5 packets per second; ##可參考其他文件
All other incoming connections are dropped.
##https登入 使用openssl建置憑證
##可參閱設定 http://icodding.blogspot.tw/2015/10/centos-apache-ssl-https.html
#1安裝套件
yum install mod_ssl openssl
#2 產生私鑰
openssl genrsa -out ca.key 2048
#3 產生 CSR
openssl req -new -key ca.key -out ca.csr
#4 產生自我簽署的金鑰
openssl x509 -req -days 1095 -in ca.csr -sha256 -extensions v3_ca -signkey ca.key -out ca.crt
##PS:1095代表憑證有效天數這邊設定三年
#5 複製檔案至正確位置
cp ca.crt /etc/pki/tls/certs
cp ca.key /etc/pki/tls/private/ca.key
cp ca.csr /etc/pki/tls/private/ca.csr
##更新 Apache SSL 的設定檔
vim /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/ca.crt ##約第105行
SSLCertificateKeyFile /etc/pki/tls/private/ca.key ##約第112行
##儲存及離開檔案,然後重新啟動 Apache
service httpd restart
#https://yourIP 試試
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
#升級PHP5.6
yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
#通過WEB頁面設置ZABBIX
cp /usr/share/doc/zabbix-web-3.2.0/httpd22-example.conf /etc/httpd/conf.d/zabbix.conf #把ZABBIX的配置文件配置到HTTPD目錄中
#設定php.ini
vim /etc/php.ini
date.timezone= Asia/Taipei
max_execution_time 300
post_max_size 16M
max_input_time 300
#設定/etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#重新啟動服務
service zabbix-server restart
service httpd restart
service mysqld restart
#設置重開機啟動服務
chkconfig --level 35 zabbix-server on
chkconfig --level 35 zabbix-agent on
chkconfig --level 35 httpd on
chkconfig --level 35 mysqld on
#進web 設定zabbix
http://yousrvip/zabbix
登入帳密:admin/yourpassword
##修改語系為中文
cd /usr/share/zabbix/include
cp locales.inc.php bak.locales.inc.php ##先備份設定檔
vim locales.inc.php
56 'zh_TW' => ['name' => _('Chinese (zh_TW)'), 'display' => true], ##將第56行zh_TW的 false改為 true
##修改亂碼
擷取Windows 的字形至桌面例如:msjhl.ttc -->修改附檔名為ttf
將其上傳至zabbix主機 /usr/share/zabbix/fonts
先將原有字形備份並修改參數
mv graphfont.ttf graphfont.ttf.bak
vim /usr/share/zabbix/include/defines.inc.php
約45行
define('ZBX_GRAPH_FONT_NAME', 'graphfont');graphfont 修改為 define('ZBX_GRAPH_FONT_NAME', 'msjhbd');
約93行
define('ZBX_FONT_NAME', 'graphfont'); 修改為
define('ZBX_FONT_NAME', 'msjhbd');
## Firewall所需開啟的port
Opened SSH port (22 TCP); #或自定義的port
Opened Zabbix agent (10050 TCP) and Zabbix trapper (10051 TCP) ports;
Opened HTTP (80 TCP) and HTTPS (443 TCP) ports;
Opened SNMP trap port (162 UDP);
Opened outgoing connections to NTP port (53 UDP);
ICMP pakets limited to 5 packets per second; ##可參考其他文件
All other incoming connections are dropped.
##https登入 使用openssl建置憑證
##可參閱設定 http://icodding.blogspot.tw/2015/10/centos-apache-ssl-https.html
#1安裝套件
yum install mod_ssl openssl
#2 產生私鑰
openssl genrsa -out ca.key 2048
#3 產生 CSR
openssl req -new -key ca.key -out ca.csr
#4 產生自我簽署的金鑰
openssl x509 -req -days 1095 -in ca.csr -sha256 -extensions v3_ca -signkey ca.key -out ca.crt
##PS:1095代表憑證有效天數這邊設定三年
#5 複製檔案至正確位置
cp ca.crt /etc/pki/tls/certs
cp ca.key /etc/pki/tls/private/ca.key
cp ca.csr /etc/pki/tls/private/ca.csr
##更新 Apache SSL 的設定檔
vim /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/ca.crt ##約第105行
SSLCertificateKeyFile /etc/pki/tls/private/ca.key ##約第112行
##儲存及離開檔案,然後重新啟動 Apache
service httpd restart
#https://yourIP 試試
沒有留言:
張貼留言