Cacti安装及配置图文详解(2)

4.3、安装net-snmp

[root@node2 app]# tar zxvf net-snmp-5.6.1.1.tar.gz
[root@node2 app]# cd net-snmp-5.6.1.1
[root@node2 net-snmp-5.6.1.1]# ./configure --prefix=/usr/local/net-snmp
[root@node2 net-snmp-5.6.1.1]# make && make install
[root@node2 net-snmp-5.6.1.1]# cp EXAMPLE.conf /etc/snmpd.conf
[root@node2 net-snmp-5.6.1.1]# ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
[root@node2 net-snmp-5.6.1.1]# vim /etc/snmpd.conf
rocommunity public localhost #去掉注释
[root@node2 net-snmp-5.6.1.1]# /usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf
----加入开启启动
[root@node2 net-snmp-5.6.1.1]# echo "/usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf " >>/etc/rc.local

4.4、安装cacti

[root@node2 app]# tar zxvf cacti-0.8.8b.tar.gz
----将cacti中的内容移到web目录
[root@node2 app]# mv cacti-0.8.8b/* /var/www/html
[root@node2 app]# chown -R apache:apache /var/www/html/
----连接到mysql创建数据库
[root@node2 app]# mysql
----创建cacti数据库
mysql> create database cacti;                       
----建立用户cacti,密码cacti123
mysql> insert into mysql.user(host,user,password) values ('localhost','cacti',password('cacti123'));
----重载mysql授权表
mysql> flush privileges;
----把数据库cacti授权于用户cacti
mysql> grant all on cacti.* to cacti@'localhost' identified by 'cacti123';
[root@node2 app]# cd /var/www/html/
[root@node2 html]# mysql -ucacti -pcacti123 cacti<cacti.sql
[root@node2 html]# vi include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti123";
$database_port = "3306";
----在httpd中添加cacti目录的配置
[root@node2 app]# cat /etc/httpd/conf.d/cacti.conf
Alias /cacti /var/www/html/
<Directory /var/www/html/>
    DirectoryIndex index.php
    Options -Indexes
    AllowOverride all
    order deny,allow
    allow from all
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc on
    php_flag track_vars on
</Directory>
----如果不添加此配置,登陆页面会报:
/cacti/auth_changepassword.php was not found on this serve

首次登陆页面可能会出现:

FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'

或者:

[root@node2 app]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决方案:  ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

使用浏览器打开,会看到安装向导:

Cacti安装及配置图文详解

Cacti安装及配置图文详解

Cacti安装及配置图文详解

点击FINISH后出现下面的界面:

Cacti安装及配置图文详解

 

默认用户名和密码admin,第一次登陆会要求更改密码。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9242bdf6857e7fe013f82e4526010493.html