1、關(guān)掉selinux
setenforce 0
2、安裝相應(yīng)的工具
yum -y install wget unzip vim
3、安裝httpd、mariadb數(shù)據(jù)庫、php、php數(shù)據(jù)庫相關(guān)、rrdtool繪圖工具相關(guān)及對(duì)應(yīng)的圖形庫,snmp等
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、配置httpd
systemctl start httpd
systemctl enable httpd
firewall-cmd --reload
3.2、配置mariadb數(shù)據(jù)庫
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、創(chuàng)建用于測(cè)試php和mariadb連通性的用戶
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
3.3、配置PHP時(shí)區(qū)
vim /etc/php.ini
date.timezone =PRC 修改時(shí)區(qū)
systemctl restart httpd
3.4、建立測(cè)試頁,注意紅色標(biāo)記部分和測(cè)是賬戶的一致;
vim /var/www/html/index.php
$conn=mysql_connect('localhost','test','test');
if ($conn)
echo "database connect ok";
else
echo "database connect failure";
?>
phpinfo()
?>
systemctl restart httpd
3.4.1、測(cè)試連通性,ok沒問題,開始cacti的安裝。
4、在tmp目錄下創(chuàng)建cacti文件夾用戶下載cacti相應(yīng)的安裝包
cd /tmp
mkdir cacti
5、進(jìn)入到cacti目錄,開始安裝
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、創(chuàng)建cacti數(shù)據(jù)庫和cacti用戶,賦予權(quán)限
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、把cacti.sql導(dǎo)入數(shù)據(jù)庫
mysql -ucacti -predhat cacti < /var/www/html/cacti/cacti.sql
5.3、修改config.php和global.php中對(duì)應(yīng)數(shù)據(jù)庫的信息
vim /var/www/html/cacti/include/config.php
vim /var/www/html/cacti/include/global.php
創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比武岡網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式武岡網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋武岡地區(qū)。費(fèi)用合理售后完善,10多年實(shí)體公司更值得信賴。
/ make sure these values refect your actual database/host/user/password /
$database_type = "mysql"; 數(shù)據(jù)庫名稱
$database_default = "cacti";數(shù)據(jù)庫名稱
$database_hostname = "127.0.0.1";主機(jī)名稱
$database_username = "cacti";數(shù)據(jù)庫用戶名
$database_password = "cacti";數(shù)據(jù)庫密碼
$database_port = "3306";
$database_ssl = false;
/
6、配置snmp,修改一下對(duì)應(yīng)行信息
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、創(chuàng)建cacti用戶,授權(quán)目錄權(quán)限
useradd -r -M cacti
chown -R cacti /var/www/html/cacti/rra/
chown -R cacti /var/www/html/cacti/log/
8、配置一個(gè)抓圖的計(jì)劃任務(wù)
crontab -e
/5 /usr/bin/php /var/www/html/cacti/poller.php >> /tmp/cacti_rrdtool.log
執(zhí)行poller.php, 生成圖形
/usr/bin/php /var/www/html/cacti/poller.php
9、訪問安裝界面開始cacti的安裝,http://ip/cacti/安裝即可
下面為對(duì)應(yīng)插件的安裝,注意插件的版本與cacti的對(duì)應(yīng)即可,老版本可能會(huì)報(bào)錯(cuò)
cacti插件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/
插件安裝完畢后,進(jìn)入weathermap視圖,點(diǎn)擊edit,如出現(xiàn)錯(cuò)誤,需要修改weathermap/editor.php文件,將$ENABLED=false;改為$ENABLED=ture;
cd /var/www/html/cacti/plugins/weathermap/
vi editor.php
$ENABLED=true;
然后修改weathermap/configs/ 和weathermap/output/宿主權(quán)限:
chown -R apache:apache configs/
chown -R cacti:apache output/
修改完畢后就可以創(chuàng)建配置文件,添加圖形。若出現(xiàn)不能編輯圖形等問題,請(qǐng)關(guān)閉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
然后進(jìn)入cacti的Plugin Management上的頁面對(duì)插件進(jìn)行安裝。**