CentOS7 LAMP安裝zabbix4.2

1.查看系統版本
命令:
cat /etc/redhat-release
CentOS7 LAMP安裝zabbix4.2

2.關閉防火牆,取消防火牆開機自啓
命令:
systemctl stop firewalld
systemctl disable firewalld
CentOS7 LAMP安裝zabbix4.2

3.關閉selinux立即生效,修改配置文件重啓才生效
命令:
setenforce 0
vi /etc/sysconfig/selinux
修改selinux文件中的值爲SELINUX=permissive
CentOS7 LAMP安裝zabbix4.2

4.安裝httpd.mysql等軟件及依賴包
命令:
yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash
CentOS7 LAMP安裝zabbix4.2

5.查看httpd,php,mariadb下載的版本
命令:
rpm -qa httpd php mariadb

CentOS7 LAMP安裝zabbix4.2

6.編輯httpd配置文件,修改主機名,添加首頁支持
命令:
vi /etc/httpd/conf/httd.conf
ServerName 127.0.0.1
DirectoryIndex index.html index.php
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2

7.編輯php.ini的時區設置
命令:
vi /etc/php.ini
找到date.timezone此行,修改爲date.timezone = Asia/Shanghai
CentOS7 LAMP安裝zabbix4.2

8.啓動httpd和mariadb服務
命令:
systemctl start httpd
systemctl start mariadb
CentOS7 LAMP安裝zabbix4.2

9.配置數據庫的root密碼及刪除匿名用戶等
命令:
mysql_secure_installation
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2

10.創建zabbix數據庫並授權
命令:
mysql -uroot -pa123456
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbixpwd';
flush privileges;
exit
CentOS7 LAMP安裝zabbix4.2

11.測試LAMP連通性
命令:
vi /var/www/html/index.php
在index.php文件裏面添加如下內容:
<?php
echo "Zabbix 4.2演示<br><br>";

    $link = mysql_connect('127.0.0.1','zabbix','zabbixpwd');

    if(!$link)
    {
            echo "連接數據庫失敗";
    }
    else
    {
            echo "連接數據庫成功";
    }

    mysql_close();

?>
CentOS7 LAMP安裝zabbix4.2

12.測試是否成功
CentOS7 LAMP安裝zabbix4.2

13.把mariadb數據庫停止
命令:
systemctl stop mariadb
CentOS7 LAMP安裝zabbix4.2

14.再次測試
CentOS7 LAMP安裝zabbix4.2

15.安裝依賴包+組件(此步可以不進行操作)
命令:
yum -y install net-snmp net-snmp-devel curl curl-devel libxml2 libxml2-devel libevent-devel.x86_64 javacc.noarch javacc-javadoc.noarch javacc-maven-plugin.noarch javacc* php-bcmath php-mbstring
CentOS7 LAMP安裝zabbix4.2

16.安裝zabbix的rpm包
命令:
rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm
yum clean all
CentOS7 LAMP安裝zabbix4.2

17.安裝Zabbix server,Web前端,agent
命令:
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
CentOS7 LAMP安裝zabbix4.2

18.導入初始架構和數據,系統將提示您輸入zabbix數據庫用戶密碼。
命令:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
CentOS7 LAMP安裝zabbix4.2

19.爲Zabbix server配置數據庫
編輯配置文件 /etc/zabbix/zabbix_server.conf(配置數據庫用戶及密碼)
vi /etc/zabbix/zabbix_server.conf
CentOS7 LAMP安裝zabbix4.2

20.修改zabbix.conf文件的時區
命令:
vi /etc/httpd/conf.d/zabbix.conf
將# php_value date.timezone Europe/Riga 變更成php_value date.timezone Asia/Shanghai
CentOS7 LAMP安裝zabbix4.2

21.啓動zabbix_server和zabbix-agent服務
命令:
systemctl start zabbix-server
systemctl start zabbix-agent
CentOS7 LAMP安裝zabbix4.2

22.編輯httpd配置文件,把路徑指向/usr/share/zabbix
命令:
vi /etc/httpd/conf/httpd.conf
CentOS7 LAMP安裝zabbix4.2

23.重啓httpd服務
命令:
systemctl restart httpd
CentOS7 LAMP安裝zabbix4.2

24.在瀏覽器輸入http://192.168.80.90 即可進行設置zabbix
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2
CentOS7 LAMP安裝zabbix4.2

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章