一.建立一个虚拟主机
1.vim /etc/httpd/conf.d/vhost.conf
该文件为新建文件,也可在/etc/httpd/conf/httpd.conf末尾添加,为:
ServerName cacti.gaowei.com /域名
DocumentRoot /web/vhost/cacti-0.8.8a /路径
Options Indexes FollowSymLinks /一些权限,百度可查
AllowOverride None
Order allow,deny
Allow from all
ErrorLog "logs/cacti-error_log" /报错日志
CustomLog "logs/cacti-access_log" common /常规日志
2.vim /etc/hosts 添加:
192.168.18.144 cacti.gaowei.com
二.安装cacti
1.tar xvf cacti-0.8.8a -C /web/vhost/ //web/vhost为自己创建的
cd /web/vhost/cacti-0.8.8a
2.MySQLadmin create cactidb /创建mysql数据库
3.mysql cactidb < cacti.sql /将cacti.sql导入到数据库
4.mysql -e "GRANT ALL ON cactidb1.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser'" /cactidb给用户cactiuser所有权限
密码为cactiuser
5.mysqladmin flush-privileges /刷新
6.mysql -ucactiuser -p /以cactiuser用户登录
7.mysql>SHOW DATABASES; /查看创建的数据库
8.cd include ;vim config.php /修改如9
9.
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
$database_ssl = false;
/*
Edit this to point to the default URL of your Cacti install
ex: if your cacti install as at http://serverip/cacti/ this
would be set to /cacti/
*/
//$url_path = "/cacti/";
$url_path = "/";
10.service httpd restart
11.useradd cactiuser ;passwd cactiuser
12.chown -R cactiuser:cactiuser rra/ log/
13.vim /etc/php.ini /修改如14
14.这个选项设置为date.timezone = Asia/Shanghai
15.echo '*/5 * * * * /usr/bin/php /web/vhost/cacti-0.8.8a/poller.php &>/dev/null' > /var/spool/cron/cactiuser /每隔5分钟cactiuser用户会执行
poller.php
16.crontab -u cactiuser -e /使15写入成功,如果有错,则会报错
17.在浏览器输入
cacti.gaowei.com 会弹出cacti安装提示。按提示安装即可,自带5个数据源,可添加本机对这5个数据源进行监控。
专注于为中小企业提供做网站、成都网站制作服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业舞钢免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了超过千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。