Centos 7はZabbix 3をインストールする.4


2018-08-20 21:07:38
一、SELinuxを閉じる
クエリがSELinuxを開いているかどうか
getenforce

SELinuxには、**Enforcing、Permissive**、**Disabled**の3つの状態があります.1つ目はデフォルト状態で、強制有効化を表し、2つ目は寛容を意味します.つまり、ほとんどのルールが放行されます.3つ目は、ルールを設定しないことです.
setenforce 0                   # SELinux  ,        ,     

vim/etc/selnux/conf#はdisabledに変更され、この操作は永続的に閉じられ、再起動後に有効になります.
    #This file controls the state of SELinux on the system.#SELINUX= can take one of these three values:#enforcing - SELinux security policy is enforced.#permissive - SELinux prints warnings instead of enforcing.#disabled - No SELinux policy is loaded.SELINUX=disabled   #disabled   #SELINUXTYPE= can take one of three two values:#targeted - Targeted processes are protected,#minimum - Modification of targeted policy. Only selected processes are protected. #mls - Multi Level Security protection.SELINUXTYPE=targeted

二、ファイアウォールの閉鎖または開放に必要なポート
#     ,        。
systemctl stop firewalld.service #  firewall
systemctl disable firewalld.service #  firewall    
               
firewall-cmd --zone=public --add-port=80/tcp --permanent            #–permanent #    ,          
firewall-cmd --list-ports        #         
firewall-cmd --reload            #    
firewall-cmd --zone= public --query-port=80/tcp    #  
firewall-cmd --zone= public --remove-port=80/tcp --permanent  #  

三、ZabbixのYumソースとMySQLのソースをインストールします.
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/このページでreleaseのrpmパッケージを見つけ、システムにインストールします.
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm

四、ZabbixとMySQLのインストール
yum install -y  zabbix-server-mysql zabbix-web-mysql  mysql-community-server zabbix-agent
 systemctl start mysqld            #  MySQL   
 mysql_secure_installation         #        

五、zabbixデータベースを作成し、zabbixアカウントを作成する
mysql -uroot -p
...
mysql>  create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

六、デフォルトのZabbixデータベース情報をインポートする
zcat /usr/share/doc/zabbix-server-mysql-3.0.18/create.sql.gz | mysql zabbix -uzabbix -pzabbix

七、修正Zabbix_server.confのプロファイルは、次の行の内容を正しく変更します.DBPasswordはさっきデータベースを作成したパスワードです.
[root@linux-node2 ~]# grep ^DB /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

八、構成ファイル/etc/http/conf.d/zabbixを修正する.conf、タイムゾーンをAsia/shanghaiに変更
php_value max_execution_time 300 
php_value memory_limit 128M 
php_value post_max_size 16M 
php_value upload_max_filesize 2M 
php_value max_input_time 300 
php_value always_populate_raw_post_data -1 
php_value date.timezone Asia/Shanghai

九、各サービスを起動し、起動するように設定する
systemctl start zabbix-server.service
systemctl start mysqld.service
systemctl start httpd.service
systemctl start zabbix-agent.service
systemctl enable zabbix-server
systemctl enable mysqld
systemctl enable httpd
systemctl enable zabbix-agent

Zabbix-serverのデフォルトアカウントAdmin、パスワードzabbix
Webディレクトリの下にあるsetupを削除または名前変更します.phpファイル
mv setup.php setup.php.bak
ログイン成功後すぐにAdminのパスワードを変更