ZABBIX 3.x PHP7´Ä¶¤Ø¤ÎƳÆþ
http://extstrg.asabiya.net/pukiwiki/index.php?ZABBIX%203.x%20PHP7%B4%C4%B6%AD%A4%D8%A4%CE%C6%B3%C6%FEÌܼ¡
CentOS7¤ËZabbix3·Ï¤òPHP7·Ï¤È°ì½ï¤ËÆþ¤ì¤ë †
CentOS7 †
ºÇ¾®¥¤¥ó¥¹¥È¡¼¥ë¤Ç¹½ÃÛ
MariaDB¤ò¥¤¥ó¥¹¥È¡¼¥ë †
- /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.1 CentOS repository list # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
- YUM¤Ç MariaDB 10.1¤ò¥¤¥ó¥¹¥È¡¼¥ë
yum install mariadb-server mariadb mariadb-devel mariadb-libs
- MariaDB¤òµ¯Æ°¤·¡¢¼«Æ°µ¯Æ°¤ò͸ú¤Ë¤¹¤ë
systemctl start mariadb systemctl enable mariadb
- ½é´üÀßÄꥹ¥¯¥ê¥×¥È¤ò»È¤¤¡¢root¥æ¡¼¥¶¤Î¥Ñ¥¹¥ï¡¼¥É¤òÀßÄê
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ¢«Enter OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n]¡¡ ¢«Enter New password: ¢«¥Ñ¥¹¥ï¡¼¥ÉÆþÎÏ Re-enter new password: ¢«¥Ñ¥¹¥ï¡¼¥ÉºÆÆþÎÏ Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ¢«Enter ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ¢«Enter ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] ¢«Enter - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ¢«Enter ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Apache,PHP¤ò¥¤¥ó¥¹¥È¡¼¥ë †
- YUM¤ÇApache¤ò¥¤¥ó¥¹¥È¡¼¥ë
yum install httpd
- Apache¤òµ¯Æ°¤·¡¢¼«Æ°µ¯Æ°¤ò͸ú¤Ë¤¹¤ë
systemctl start httpd systemctl enable httpd
- PHP 7·Ï¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤¿¤á¤ËɬÍפÊYUM¤Î¥ê¥Ý¥¸¥È¥ê(EPEL,Remi)¤òÄɲÃ
yum install epel-release rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
- Remi¥ê¥Ý¥¸¥È¥ê¤ò»ØÄꤷ¡¢PHP 7¤ÈɬÍפʥѥ屡¼¥¸¤ò¥¤¥ó¥¹¥È¡¼¥ë
yum install --enablerepo=remi-php70 php php-mysqlnd php-ldap php-gd php-xml php-bcmath php-mbstring php-pecl-mysql
- php.ini¤Ë¥¿¥¤¥à¥¾¡¼¥ó¤òÀßÄê
sed -i 's/\;date\.timezone\ \=/date\.timezone\ \=\ Asia\/Tokyo/g' /etc/php.ini
- Apache¤òºÆµ¯Æ°
systemctl restart httpd
Zabbix server¤ò¥¤¥ó¥¹¥È¡¼¥ë †
- Zabbix Server¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ËɬÍפÊYUM¤Î¥ê¥Ý¥¸¥È¥ê¤òÄɲÃ
rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
- Zabbix Server¤ÈɬÍפʥѥ屡¼¥¸¤ò¥¤¥ó¥¹¥È¡¼¥ë
yum install --enablerepo=remi-php70 zabbix-server zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese
- MariaDB¤ËZabbix ServerÍѤΥǡ¼¥¿¥Ù¡¼¥¹¤È¥æ¡¼¥¶¤òºîÀ®¡£¥æ¡¼¥¶Ì¾¤È¥Ñ¥¹¥ï¡¼¥É¤Ï¡¢¤È¤â¤Ë¡Özabbix¡×¤È¤¹¤ë¡£
# mysql -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 10 Server version: 10.1.11-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> \q Bye
- Zabbix ServerÍѤΥǡ¼¥¿¤òMariaDB¤Ë¥¤¥ó¥Ý¡¼¥È
cd /usr/share/doc/zabbix-server-mysql-3.2.6/ gzip -d create.sql.gz mysql -u zabbix -pzabbix zabbix < create.sql cd
- Zabbix Server¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ò¥Ð¥Ã¥¯¥¢¥Ã¥×
mv -v /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.bak
- /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid DBSocket=/var/lib/mysql/mysql.sock SNMPTrapperFile=/var/log/snmptt/snmptt.log AlertScriptsPath=/etc/zabbix/alertscripts ExternalScripts=/etc/zabbix/externalscripts DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix
- PHP7Âбþ¤Ç½ñ¤´¹¤¨¤ë
sed -i "s/PHP\_VERSION\,\ '5\.6'/PHP\_VERSION\,\ '7\.1'/g" /usr/share/zabbix/include/classes/setup/CFrontendSetup.php
- Zabbixµ¯Æ° apacheºÆµ¯Æ°
systemctl enable zabbix-server systemctl start zabbix-server systemctl restart httpd
- web²èÌ̤γÎǧ
WebUI¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤Ë¤Ï¡Öhttp://¥µ¡¼¥ÐIP¥¢¥É¥ì¥¹/zabbix¡×¤È¥Ö¥é¥¦¥¶¤ËÆþÎÏ
- ɽ¼¨¤µ¤ì¤Ê¤¤¾ì¹ç
- firewall¤Ëhttp¤Îµö²Ä¤òÄɲÃ
firewall-cmd --permanent --add-service=http
- firewall¤Ëhttp¤Îµö²Ä¤òÄɲÃ
- zabbix¥µ¡¼¥Ð¤¬µ¯Æ°¤·¤Ê¤¤¾ì¹ç
- SELinux¤Ëµö²Ä¤òÄɲÃ
setsebool -P httpd_can_connect_zabbix on setsebool -P zabbix_can_network on yum install policycoreutils-python grep zabbix_server /var/log/audit/audit.log | audit2allow -M zabbix-limit semodule -i zabbix-limit.pp
- SELinux¤Ëµö²Ä¤òÄɲÃ
Last-modified: 2017-06-05 (·î) 20:00:40 (2517d)