Centos6.3 安装cacti服务器
首先我们要安装好Centos6.3 的系统。cacti是一款监控系统。
系统安装好以后,我们需要修改一些东西,因为6.3的版本比较老。连yum源都没有,所以我就把它更新到了阿里云的yum。
系统安装好了以后,我们就需要配置服务器可以上网,修改名称等等。
然后把yum搞好。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://www.xmpan.com/Centos-6-Vault-Aliyun.repo
本来一条命令可以搞定,但是连wget命令都没有。只能自己去电脑上下载好了repo,然后上传上去了。
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
备份一下源文件。
84 cp /etc/yum.repos.d/Centos-6-Vault-Aliyun.repo /etc/yum.repos.d/CentOS-Base.repo
85 yum makecache
这样yum就可以了。
安装一些必备软件,然后重启。
87 yum install nfs-ntils rpcbind -y
88 yum install vim
89 yum install wget
90 vim
91 yum install bash-completion -y
92 yum install lrzsz -y
93 yum install gcc gcc-c++ glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools vim iotop bc zip unzip zlib-devel lrzsz tree screen lsof tcpdump wget ntpdate bash-completion -y
94 yum -y update
95 init 6
这里特别提醒一下,因为实验,所以把环境要搭建好,防火墙,关掉。selinux关闭掉。不然后患无穷,搞死人。
关闭防火墙
209 service iptables stop
210 chkconfig iptables off
211 chkconfig --list iptables
关闭selinux
365 setenforce 0
397 sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config
398 cat /etc/selinux/config
然后开始安装一些cacti需要的插件。
有一个安装包的 https://files.cnblogs.com/files/davidz/cacti_tools.tar.gz?t=1661506231
准备工作差不多了,然后就开安装了。
95 yum install net-snmp* -y
97 ll /etc/snmp/snmpd.conf
98 cat /etc/snmp/snmpd.conf
99 cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
103 echo " " > /etc/snmp/snmpd.conf
104 vim /etc/snmp/snmpd.conf
105 /etc/init.d/snmpd start
106 lsof -i:161
107 netstat -lntup|grep 161
108* ps -ef|grep snmpd|grep -v gre
113 cd /home/
114 ls
115 mkdir software
116 ls
117 cd software/
118 rz -y
119 ls
120 tar zxf cacti_tools.tar.gz
121 ls
122 cd cacti_tools
123 ls
124 tar zxf libart_lgpl-2.3.17.tar.gz
125 cd libart_lgpl-2.3.17
126 ls
127 ./configure
128 make
129 make install
130 echo $?
131 /bin/cp -r /usr/local/include/libart-2.0 /usr/include
144 yum –y install libart_lgpl-devel
145 yum –y install pango-devel* cairo-devel*
146 yum install libart_lgpl-devel
147 yum – install pango-devel* cairo-devel*
148 yum install pango-devel* cairo-devel*
165 yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel
196 yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y
191 tar xf rrdtool-1.2.30.tar.gz
192 cd rrdtool-1.2.30
193 ls
194 ./configure
195 make
198 echo $?
199 make install
200 echo $?
然后开始配置数据库,把表记录导入进去。
然后就是按照老男孩老师的步骤一步一步,不会做。
190 cd ../
191 cd /etc/httpd/conf
192 cp httpd.conf httpd.conf.oldboy.ori
193 sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf
194 sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf
195 egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf
196 /etc/init.d/httpd start
197 lsof -i :80
198 grep DocumentRoot httpd.conf
199 echo -e "<?php \nphpinfo(); \n?>" >/var/www/html/index.php
200 cat /var/www/html/index.php
201 rm -f /var/www/html/index.php
202 cd ~
203 /etc/init.d/mysqld start
204 lsof -i :3306
205 ps -ef|grep mysql
206 mysql
207 cd /home/oldboy/tools/
208 ll
209 cd cacti_tools
210 ll
211 tar xf cacti-0.8.8a.tar.gz
212 cd cacti-0.8.8a
213 mysql cacti <cacti.sql
214 mysql -e "use cacti;show tables;"
215 grep database include/config.php
216 grep apache /etc/httpd/conf/httpd.conf
217 chown -R apache rra/ log/
218 mv ../cacti-0.8.8a /var/www/html/cacti
219 cd /var/www/html/
220 ll
221 ll cacti/
222 ll
223 chown -R apache.apache cacti
224 /usr/bin/php /var/www/html/cacti/poller.php
225 chmod 755 /var/www/html/cacti/poller.php
226 /usr/bin/php /var/www/html/cacti/poller.php
227 /usr/bin/php /var/www/html/cacti/poller.php
228 /usr/bin/php /var/www/html/cacti/poller.php
229 /usr/bin/php /var/www/html/cacti/poller.php
230 /usr/bin/php /var/www/html/cacti/poller.php
231 echo '*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1' >>/var/spool/cron/root
232 crontab -l
233 cat /var/www/html/cacti/poller.php
234 ll /usr/local/bin/rrdtool
235 /usr/bin/php
236 ll /usr/bin/php
237 rpm -qa |grep net-snmp
238 netstat -lntup|grep 161
239 /etc/init.d/iptables stop
240 crontab -l
241 /usr/bin/php /var/www/html/cacti/poller.php
242 /usr/bin/php /var/www/html/cacti/poller.php
也踩了坑,但是自己都能解决。安装好的界面是这样的。
默认账号和密码是admin admin
效果图