安装配置icinga2

申明:

程序:icinga2

网页:icingaweb2

一、设置SELinux

[root@localhost ~]# setenforce 0

[root@localhost ~]# echo 'setenforce 0' >> /etc/rc.local  

二、设置iptables

[root@localhost ~]# vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

[root@localhost ~]# service iptables restart

[root@localhost ~]# chkconfig iptables on

三、设置ntp

[root@localhost ~]# yum install ntp -y

[root@localhost ~]# crontab -e

*/20 * * * * /usr/sbin/ntpdate 202.120.2.101 >/dev/null &

四、安装开发工具

[root@localhost ~]# yum groupinstall Development tools

五、安装软件依赖包

[root@localhost ~]# yum install php-cli php-pear php-xmlrpc php-xsl php-pdo php-soap php-gd php-ldap

[root@VM_139_76_centos ~]# yum install php php-mysql -y

[root@VM_139_76_centos ~]# yum update

六、获取icinga2 epel

[root@localhost ~]# rpm --import  http://packages.icinga.org/icinga.key

[root@localhost ~]# wget http://packages.icinga.org/epel/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo

[root@localhost ~]# yum makecache

七、安装icinga2

[root@localhost ~]# yum install icinga2

[root@localhost ~]# yum install   boost-regex boost-system boost-test boost-thread icinga2-common libboost_regex-mt   libboost_system-mt libboost_thread-mt

八、安装MySQL

[root@localhost ~]# yum install mysql-server mysql -y

[root@localhost ~]# service mysqld start

[root@localhost ~]# /usr/bin/mysqladmin -u root password 'Delln4020'

[root@localhost ~]# chkconfig mysqld on

九、安装icingaweb2

[root@VM_139_76_centos ~]# yum install httpd -y

[root@VM_139_76_centos ~]# git clone git://git.icinga.org/icingaweb2.git

[root@VM_139_76_centos ~]# mv icingaweb2 /usr/share/icingaweb

[root@VM_139_76_centos ~]# /usr/share/icingaweb/bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb/public
Alias /icingaweb "/usr/share/icingaweb/public"

<Directory "/usr/share/icingaweb/public">
       Options SymLinksIfOwnerMatch 
       AllowOverride None 

       
               # Apache 2.4 
               
                       Require all granted 
               
       

       
               # Apache 2.2 
               Order allow,deny 
               Allow from all 
       

       SetEnv ICINGAWEB_CONFIGDIR "/etc/icingaweb" 

       EnableSendfile Off 

       
               RewriteEngine on 
               RewriteBase /icingaweb/ 
               RewriteCond %{REQUEST_FILENAME} -s [OR] 
               RewriteCond %{REQUEST_FILENAME} -l [OR] 
               RewriteCond %{REQUEST_FILENAME} -d 
               RewriteRule ^.*$ - [NC,L] 
               RewriteRule ^.*$ index.php [NC,L] 
       

       
               DirectoryIndex error_norewrite.html 
               ErrorDocument 404 /error_norewrite.html 
       
</Directory>

[root@VM_139_76_centos ~]# vi /etc/httpd/conf.d/icingaweb.conf

#写入以上生成的配置文件

[root@VM_139_76_centos ~]# chown apache.apache /usr/share/icingaweb/public/* -R

[root@VM_139_76_centos ~]# service httpd start

[root@VM_139_76_centos ~]# chkconfig iptables on

  

十、创建icinga数据库

[root@localhost ~]# mysql -u root -p

mysql> create database icinga;

mysql> grant select, insert, update, delete, drop, create view, index, execute on icinga.* to 'icinga'@'localhost' identified by 'icinga';

mysql> grant execute on icinga.* to 'icinga'@'localhost';

mysql> flush privileges;

mysql> quit

十一、创建icingaweb2数据库

[root@localhost ~]# mysql -u root -p

mysql> create database icingaweb2;

mysql> grant select, insert, update, delete, drop, create view, index, execute on icingaweb2.* to 'icingaweb2'@'localhost' identified by '

';

mysql> flush privileges;

mysql> quit

十二、安装DB DBO

[root@localhost ~]# yum install icinga2-ido-mysql icinga-idoutils-libdbi-mysql

十三、导入数据库

[root@localhost ~]# mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql

[root@VM_139_76_centos ~]# mysql -u root -p icingaweb2 < /usr/share/icingaweb/etc/schema/mysql.schema.sql

十四、安装插件

[root@localhost ~]# yum install nagios-plugins-all

十五、启动icinga2和IDO

[root@localhost ~]# service icinga2 start

[root@localhost ~]# chkconfig icinga2 on

[root@localhost ~]# service ido2db start

[root@localhost ~]# chkconfig ido2db on

十六、访问icinga2

[root@localhost conf]# service httpd restart

[root@localhost conf]# chkconfig httpd on

http://server-ip/icingaweb

wKioL1STifLikR67AALBd8ArSuM626.jpg

[root@VM_139_76_centos ~]# /usr/share/icingaweb/bin/icingacli setup config createDirectory apache

[root@VM_139_76_centos ~]# /usr/share/icingaweb/bin/icingacli setup token create

The newly generated setup token is: 3d10d82c93f20cb3

wKioL1STiomAxMbgAAV3vC0xGAQ203.jpgwKiom1STijDAdtTGAAitSSpGbKU968.jpg

[root@VM_139_76_centos ~]# vi /etc/php.ini

  ;date.timezone =

改成:

date.timezone = Asia/Shanghai

[root@VM_139_76_centos ~]# yum install php-intl

[root@VM_139_76_centos ~]# yum install php-pecl-imagick

[root@VM_139_76_centos ~]# yum install php-pgsql

[root@VM_139_76_centos ~]# service httpd restart

wKiom1STio3DRPLSAAhruluuZN4330.jpgwKiom1STisqx5BChAAJliImrzE0427.jpgwKioL1STi3yidfy9AAI5BcXJ_5g083.jpgwKioL1STi6rjFxCoAANb2fdPn9s593.jpgwKioL1STjBGD2y75AAJqKAWYAc0314.jpgwKioL1STjC3DksadAAKTxBgxYY4349.jpgwKiom1STi9bA2GQXAAKImYzn7AE896.jpgwKioL1STjJDw1e3XAALkhsLN0GE701.jpgwKiom1STjEbwFIz3AAQShkJLRYQ548.jpgwKiom1STjFDhVc7sAAN6owyEB48645.jpgwKioL1STjSvABAwHAAQdABb9zWs295.jpgwKiom1STjI_Ce-0eAAOpiEEAFfw072.jpgwKioL1STjWHzTiQpAAN7l7leFag898.jpgwKioL1STjWnC0RQAAAUe-g0PvAE550.jpgwKiom1STjNzybGWqAASG4OWVhy8200.jpg

本文出自 “linjianying110” 博客,谢绝转载!

你可能感兴趣的:(icinga,icinga2,icingaweb2)