1,裝機后修改系統設置
- 修改主機名:vim /etc/hostname ,修改為zabbix_test.com
- 關閉防火牆:
[root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service
- 關閉selinux : vim /etc/selinux/config,修改為:SELINUX=disabled
- 修改/etc/hosts文件
- yum源使用阿里雲的yum源:http://mirrors.aliyun.com/repo/找到對應的系統版本,替換/etc/yum.repos.d/CentOS-Base.repo,yun makecache。http://mirrors.aliyun.com/help/centos(阿里雲);http://mirrors.163.com/.help/centos.html(163源)
- 重啟系統
2,安裝MariaDB
-
yum install mariadb-server mariadb
-
mariadb數據庫的相關命令是:
systemctl start mariadb #啟動MariaDB systemctl stop mariadb #停止MariaDB systemctl restart mariadb #重啟MariaDB systemctl enable mariadb #設置開機啟動
- 默認安裝的root密碼是空白,以下命令更改密碼
[root@zabbix_test ~]# mysqladmin -u root password "password" #更改密碼為password
- 登錄數據庫,mysql -uroot -p
- 創建zabbix數據庫 zabbix數據庫的密碼為zabbix
create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
3, 安裝zabbix3.4 https://www.zabbix.com/download
- rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
- yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
- yum install zabbix-get zabbix-sender zabbix-java-gateway (選擇安裝)
4,導入數據
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
5,配置zabbix的數據庫設置
vim /etc/zabbix/zabbix_server.conf 主要配置數據庫的用戶名,庫名,密碼,端口等,其它設置也可以安裝情況配置
6,啟動zabbix 並設置開機啟動
systemctl enable zabbix-server systemctl start zabbix-server
systemctl enable zabbix-agent systemctl start zabbix-agent
7, 編輯Zabbix前端PHP配置,主要是更改時區
vim /etc/httpd/conf.d/zabbix.conf
修改此行:php_value date.timezone Asia/Shanghai
8,啟動httpd並設置開機啟動
systemctl start httpd
systemctl enable httpd
9,瀏覽器訪問並配置
http://IP/zabbix/
這里的Name待安裝完成后顯示在頁面的右上角
使用Admin/zabbix初始管理員密碼登錄
10 ,修改為中文界面
在Adminstration-->Users下面找到對應的用戶,點進去,找到Language,選擇Chinese(zh_CN),更新后,刷新頁面即可切換為中文界面。
11,中文顯示亂碼問題
一種原因是數據庫創建的時候需要設置為支持utf8
第二種情況如下:
原因是zabbix前端默認的字體對中文的支持不好,需要替換下
在自己的windows電腦上,打開C:\Windows\Fonts,里面全是字體文件,找到想要的,我這里選擇是常規楷體。
將此字體文件C:\Windows\Fonts\simkai.ttf 上傳到zabbix服務器的zabbix的fonts路徑下,我這里路徑為:/usr/share/zabbix/fonts。
如下圖,graphfont.ttf是原來默認的字體文件
在切換到路徑/usr/share/zabbix/include下,修改defines.inc.php 文件
文件里的 ZBX_GRAPH_FONT_NAME', 'graphfont' 就是指默認的字體文件是graphfont 對應/usr/share/zabbix/fonts里的graphfont.ttf文件
使用命令 sed -i 's/graphfont/simkai/g' defines.inc.php 全部替換為simkai文件
重新加載下配置文件:systemctl reload httpd.service
再刷新下網頁, 發現亂碼解決了