Centos 7 cacti build
1. Turn off selinux
Setenforce 0
2. Install the appropriate tools
Yum-y install wget unzip vim
3. Install httpd, mariadb database, php, php database, rrdtool drawing tools and corresponding graphics library, snmp, etc.
Yum-y install httpd mariadb-server mysql-devel php php-mysql php-gd php-pear rrdtool rrdtool-devel rrdtool-php rrdtool-perl gd gd-devel php-gd net-snmp net-snmp-utils php-snmp net-snmp-libs
3.1.Configuring httpd
Systemctl start httpd
Systemctl enable httpd
Firewall-cmd-reload
3.2.Configuring mariadb database
Systemctl start mariadb
Mysql_secure_installation
Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Mysql-u root-p
3.2.1. Create users to test php and mariadb connectivity
Grant all privileges on. To test@localhost identified by 'test'
Flush privileges
Systemctl restart mariadb
Systemctl enable mariadb
Firewall-cmd-permanent-add-port=3306/tcp
Firewall-cmd-reload
Configure the PHP time zone
Vim / etc/php.ini
Date.timezone = PRC modify time zone
Systemctl restart httpd
3.4. Set up a test page and note that the red mark is consistent with the test account.
Vim / var/www/html/index.php
Systemctl restart httpd
3.4.1, test connectivity, ok is fine, start the installation of cacti.
4. Create a cacti folder under the tmp directory. Users download the corresponding installation package for cacti.
Cd / tmp
Mkdir cacti
5. Go to the cacti directory and start the installation
Cd / tmp/cacti/
Wget http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz
Tar zxvf cacti-0.8.8f.tar.gz
Mv cacti-0.8.8f / var/www/html/cacti
5.1.Create cacti database and cacti users, and grant permissions
Mysql-u root-p
Create database cacti default character set utf8
Grant all privileges on cacti. To cacti@localhost identified by 'cacti'
Flush privileges
5.2. import cacti.sql into the database
Mysql-ucacti-predhat cacti
< /var/www/html/cacti/cacti.sql 5.3、修改config.php和global.php中对应数据库的信息 vim /var/www/html/cacti/include/config.php vim /var/www/html/cacti/include/global.php / make sure these values refect your actual database/host/user/password / $database_type = "mysql"; 数据库名称 $database_default = "cacti";数据库名称 $database_hostname = "127.0.0.1";主机名称 $database_username = "cacti";数据库用户名 $database_password = "cacti";数据库密码 $database_port = "3306"; $database_ssl = false; / 6、配置snmp,修改一下对应行信息 vim /etc/snmp/snmpd.conf 41 com2sec notConfigUser default public 62 access notConfigGroup "" any noauth exact systemview none none 85 #view all included .1 80 systemctl restart snmpd.service systemctl enable snmpd.service 7、创建cacti用户,授权目录权限 useradd -r -M cacti chown -R cacti /var/www/html/cacti/rra/ chown -R cacti /var/www/html/cacti/log/ 8、配置一个抓图的计划任务 crontab -e /5 /usr/bin/php /var/www/html/cacti/poller.php >> / tmp/cacti_rrdtool.log
Execute poller.php to generate graphics
/ usr/bin/php / var/www/html/cacti/poller.php
9. Visit the installation interface to start the installation of cacti, and then install http://ip/cacti/.
The following is the installation of the corresponding plug-in. Please note that the version of the plug-in corresponds to cacti. The old version may report an error.
Installation of cacti plug-ins setting, thold, monitor, wethermap, realtime, spine
Wget https://docs.cacti.net/media/plugin:settings-v0.71-1.tgz
Mv plugin\: settings-v0.71-1.tgz / tmp/cacti/settings-v0.71-1.tgz
Tar-zxvf settings-v0.71-1.tgz
Mv settings / var/www/html/cacti/plugins/*
Wget https://docs.cacti.net/media/plugin:thold-v0.5.0.tgz
Mv plugin\: thold-v0.5.0.tgz / tmp/cacti/thold-v0.5.0.tgz
Tar-zxvf thold-v0.5.0.tgz
Mv thold / var/www/html/cacti/plugins/
Wget https://docs.cacti.net/media/plugin:monitor-v1.3-1.tgz
Mv plugin\: monitor-v1.3-1.tgz / tmp/cacti/monitor-v1.3-1.tgz
Tar-zxvf monitor-v1.3-1.tgz
Mv monitor / var/www/html/cacti/plugins/
Wget https://github.com/howardjones/network-weathermap/releases/download/version-0.98a/php-weathermap-0.98a.zip
Unzip php-weathermap-0.98a.zip
Mv weathermap/ / var/www/html/cacti/plugins/
After the plug-in is installed, go to the weathermap view and click edit. If an error occurs, you need to modify the weathermap/editor.php file and change $ENABLED=false; to $ENABLED=ture.
Cd / var/www/html/cacti/plugins/weathermap/
Vi editor.php
$ENABLED=true
Then modify the weathermap/configs/ and weathermap/output/ host permissions:
Chown-R apache:apache configs/
Chown-R cacti:apache output/
After the modification, you can create a configuration file and add a drawing. If there is a problem such as not being able to edit the drawing, please close SElinux.
Wget wget https://docs.cacti.net/media/plugin:realtime-v0.5-1.tgz-- no-check-certificate
Mv plugin\: realtime-v0.5-1.tgz / tmp/cacti/realtime-v0.5-1.tgz
Tar-zxvf realtime-v0.5-1.tgz
Mv realtime / var/www/html/cacti/plugins/
Mkdir / var/www/html/cacti/cache
Chown apache:apache-R / var/www/html/cacti/cache
Wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8f.tar.gz
Yum-y install libtool net-snmp-devel mysql-devel
Tar zxvf cacti-spine-0.8.8f.tar.gz
Cd cacti-spine-0.8.8f
. / configure
Make & & make install
Cp / usr/local/spine/etc/spine.conf.dist / etc/spine.conf
Vim / etc/spine.conf
DBHost localhost
DBDatabase cacti
DBUser cacti
DBPass cacti
DBPort 3306
/ usr/local/spine/bin/spine
SPINE: Using spine config file [/ etc/spine.conf]
SPINE: Version 0.8.8f starting
SPINE: Time: 0.0913 s, Threads: 5, Hosts: 2
Cat / var/www/html/cacti/log/cacti.log
Firewall-cmd-permanent-add-port=161/udp
Firewall-cmd-reload
Then go to the page on cacti's Plugin Management to install the plug-in. **