最小化安装 CentOS 7.3 部署 Cacti-1.1.23 详细步骤

Cacti 是一个利用 RRDTool 数据存储和绘图功能的完整的网络图形解决方案。Cacti 提供了快速的数据轮询、高级图形模板、多样的数据获取方法以及用户管理等功能。并以直观易于使用的接口来呈现,这在具有成千上万个设备的复杂网络上是有意义的。

一、安装环境

安装 Cacti 需要 Mysql,PHP,RRDTool,net-snmp 和 支持 PHP 的 Web服务器,如 Apache,Nginx 或 IIS等。

版本要求:

RRDTool 1.3 或更高版本,http://oss.oetiker.ch/rrdtool/

MySQL 5.1 或更高版本,https://mysql.com/

MariaDB 5.5 或更高版本,https://mariadb.org/

PHP 5.4 或更高版本,https://php.net/

支持PHP的Web服务器,如Apache,NGINX 或 IIS(https://www.apache.org/,https://www.nginx.com/)

本次安装 Cacti-1.1.23 使用相关软件及版本为:

RRDTool 1.4.8

MariaDB 10.2.8 (mariadb mariadb-server)

PHP 5.4.16 (php php-snmp php-ldap php-xml php-session php-sockets php-pdo php-pdo-mysql php-mbstring php-pcre php-json php-openssl php-gd php-gmp php-zlib)

Apache httpd 2.4.6

net-snmp 5.7.2 (net-snmp net-snmp-utils)

crond (cronie 或其他类似软件)

为了安装官方补丁,还需要安装一些工具软件

wget

patch

二、软件安装

2.1 更新 YUM 源

添加 MariaDB YUM 仓库

# cat > /etc/yum.repos.d/MariaDB.repo <<EOF

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.2/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

EOF

2.2 安装 Cacti 部署环境所需软件包

# yum install -y httpd mariadb mariadb-server mariadb-devel net-snmp net-snmp-utils net-snmp-libs net-snmp-agent-libs net-snmp-devel php php-snmp php-ldap php-pdo php-mysql php-devel php-pear php-common php-gd php-mbstring php-xml php-process rrdtool rrdtool-php rrdtool-perl rrdtool-devel gcc openssl-devel dos2unix autoconf automake binutils libtool cpp postfix glibc-headers kernel-headers glibc-devel gd gd-devel help2man ntpdate wget patch

三、环境配置

3.1 配置 PHP

修改 PHP 主配置文件 /etc/php.ini

关闭安全模式,以支持 rrdtool,允许 exec() 访问

[PHP]

safe_mode = Off

设置时区

[Date]

date.timezone = PRC

3.2 配置 Web 服务器 Apache httpd

编辑 /etc/httpd/conf.d/php.conf 配置文件,确保文件含有

# PHP is an HTML-embedded scripting language which attempts to make it

# easy for developers to write dynamically generated webpages.

LoadModule php5_module modules/libphp5.so

#

# Cause the PHP interpreter to handle files with a .php extension.

AddHandler php5-script .php

如果你不打算将 Cacti 安装到 Web 服务器默认目录,如/var/www/html,就需要将下面内容添加

至 /etc/httpd/conf.d/cacti.conf 文件,并将其中的 /your/cacti/dir 替换为实际安装目录,将

Allow from 127.0.0.1 改为你公司所在网段。

# Cacti - the complete rrdtool-based graphing solution

#

# Allows only localhost by default

#

# Allowing cacti to anyone other than localhost should be considered

# dangerous unless properly secured by SSL

# Make sure, that httpd can read your cacti directories.

# At minimum, you need

#    chmod ugo+r -R /your/cacti/dir

# Make sure to replace with your directories

# When using SELinux, set the following:

#    chcon -R -h -t httpd_sys_content_t /your/cacti/dir

# when using SELinux and you private homedir, enable

#    setsebool -P httpd_enable_homedirs 1

#    setsebool -P httpd_read_user_content 1

Alias /cacti /var/www/html/cacti

<Directory /var/www/html/cacti>

AllowOverride None

Order Deny,Allow

Deny from all

Allow from 127.0.0.1

Allow from ::1

Options Indexes Includes FollowSymLinks

</Directory>

# These directories do not require access over HTTP

#

<Directory /var/www/html/cacti/cli>

Order Deny,Allow

Deny from All

Allow from None

</Directory>

3.3. 配置数据库 MariaDB

为安全起见,设置数据库 root 用户密码

# systemctl start mariadb

# mysqladmin -uroot password somepassword

导入时区数据到 mysql 数据库

# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot mysql -p

修改 /etc/my.cnf.d/server.cnf 文件,确保文件含有

[mysqld]

character_set_server = utf8mb4

collation_server = utf8mb4_unicode_ci

character_set_client = utf8mb4

max_connections = 100

max_heap_table_size = 48M

max_allowed_packet = 16777216

join_buffer_size = 64M

tmp_table_size = 64M

innodb_file_per_table = ON

innodb_buffer_pool_size = 240M

innodb_doublewrite = OFF

innodb_lock_wait_timeout = 50

innodb_flush_log_at_timeout = 3

innodb_read_io_threads = 32

innodb_write_io_threads = 16

3.4 配置 SNMP

配置 net-snmp-agent, 修改配置文件 /etc/snmp/snmpd.conf

将41行

com2sec notConfigUser  default       public

改为

com2sec notConfigUser  127.0.0.1     public

将62行

access  notConfigGroup ""      any       noauth    exact  systemview none none

改为

access  notConfigGroup ""      any       noauth    exact  all    none   none

将85行

#view all    included  .1                               80

改为

view all    included  .1                               80

四、安装配置 Cacti

4.1 下载解压 Cacti 安装包

# cd /var/www/html

# wget http://www.cacti.net/downloads/cacti-1.1.23.tar.gz

# tar zxvf cacti-1.1.23.tar.gz

4.2 创建 cacti 数据库,创建 cactiuser 用户,设置相关授权

# mysql -u root -p

MariaDB [(none)]> CREATE database cacti default character set utf8;

MariaDB [(none)]> create user ‘cactiuser‘@‘localhost‘ identified by ‘cactiuser‘;

MariaDB [(none)]> grant all privileges on cacti.* to [email protected];

MariaDB [(none)]> grant select on mysql.time_zone_name to ‘cactiuser‘@‘localhost‘ identified by ‘cactiuser‘;

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> quit

4.3 导入 Cacti 默认数据库

# mysql -uroot -p cacti < /var/www/html/cacti-1.1.23/cacti.sql

4.4 编辑 /var/www/html/cacti-1.1.23/include/config.php,给Cacti指定数据库类型,名称,用户名,密码等

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "cactiuser";

/* load up old style plugins here */

$plugins = array();

//$plugins[] = ‘thold‘;

4.5 创建 cacti 系统用户,设置 graph/log 目录权限

# useradd -r -M cacti

# ln -s /var/www/html/cacti-1.1.23 /var/www/html/cacti

# chown -R apache.apache /var/www/html/cacti/

# chown -R cacti /var/www/html/cacti-1.1.23/{rra,log}/

4.6 添加定时任务

# crontab -e

*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

五、配置防火墙

5.1 配置 firewalld 防火墙

# firewall-cmd --permanent --add-port=3306/tcp

# firewall-cmd --permanent --add-service=http

# firewall-cmd --permanent --add-port=161/udp

# firewall-cmd --permanent --add-port=162/udp

# firewall-cmd --reload

5.2 关闭selinux

# setenforce 0

# sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config

六、设置开机启动相关服务

# systemctl enable httpd

# systemctl enable mariadb

# systemctl enable crond

# systemctl enable snmpd

七、重启相关服务

# systemctl restart httpd

# systemctl restart mariadb

# systemctl restart crond

# systemctl restart snmpd

八、登录 Cacti Web 安装界面

使用浏览器登录

http://your-server/cacti/

勾选 “Accept GPL License Agreement” --> Next --> Next --> 下一步 --> Next --> Next --> 勾选所有预置模版 --> Finish

使用初始登录用户名和密码(admin)登录,然后更改初始密码。

进入Cacti Web 管理界面。

九、安装 spine

9.1 下载解压与 Cacti 相同版本号 Spine 源码安装包

# cd /usr/local/src

# wget http://www.cacti.net/downloads/spine/cacti-spine-1.1.23.tar.gz

# tar xf cacti-spine-1.1.23.tar.gz

9.2 源码编译安装 spine

# ln -s /usr/lib64/libmysqlclient.so.18.0.0 /usr/lib64/libmysqlclient.so

# ntpdate 202.120.2.101

# cd cacti-spine-1.1.23

# ./configure && make && make install

9.3 复制修改配置文件

# cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf

修改spine.conf文件内用户名及密码配置

DB_Host                 localhost

DB_Database             cacti

DB_User                 cactiuser

DB_Pass                 cactiuser

DB_Port                 3306

RDB_Host                localhost

RDB_Database            cacti

RDB_User                cactiuser

RDB_Pass                cactiuser

RDB_Port                3306

9.4 登录 Cacti WEB 页面修改 Cacti 配置:

Console -> 设置(Cacti Settings) -> Paths -> 在 Spine Binary File Location 文本框内填入配置文件路径 /usr/local/spine/bin/spine ,在 Spine Config File Path 文本框内填入配置文件路径 /usr/local/spine/etc/spine.conf,点击保存 (Save)。

Console -> 设置(Cacti Settings) -> Poller -> 在 Poller Type 下拉框中选择 spine ,点击保存 (Save)。

十、特别提示

在添加完设备和图形后,需要重建采集器缓存。

Console --> 系统工具 --> Rebuild Poller Cache

时间: 2024-08-28 09:23:16

最小化安装 CentOS 7.3 部署 Cacti-1.1.23 详细步骤的相关文章

搭建LNMP环境(基于最小化安装CentOS 6.5)

本文档主要说明在单台服务器上手动安装LNMP环境的操作步骤,本文档使用的系统版本可能与您的实际使用版本不同,您可以根据实际情况选择相应版本. 一.本文档LNMP环境版本说明: OS:最小化安装CentOS 6.5 Nginx:nginx-1.10.2.tar.gz MySQL:mysql-5.6.24.tar.gz PHP:php-5.6.23.tar.bz2 二.搭建LNMP环境基本步骤 1. 准备编译环境 2. 安装nginx 3. 安装mysql 4. 安装php-fpm 5. 测试访问

最小化安装CentOS基础命令

最小化安装CentOS基础命令 # yum install vim iotop bc gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel zip unzip zlib-devel net-tools lrzsz tree ntpdate telnet lsof tcpdump wget libevent libevent-devel bc systemd-devel bash-completion tracero

最小化安装centos的init初始化脚本

#!/bin/bash #this script is appropriate for minimize installation system centos or linux 6.x(这脚本适合最小化安装6.x版本的系统) #you have already install the os read -p "Pleases input hostname for linux:" hname sed -i "/HOSTNAME/s/localhost\.localdomain/$

VMware安装CentOS之二——最小化安装CentOS

1.上文已经创建了一个虚拟机,现在我们点击开启虚拟机. 2.虚拟机进入到安装的界面,在这里我们选择第一行,安装或者升级系统. 3.这里会提示要检查光盘,我们直接选择跳过. 4.这里会提示我的硬件设备不被支持,点击OK,实际对安装使用没有影响的,其他电脑没有出现这个提示. 5.点击下一步. 6.在这里我选择中文,这样我们用远程工具的时候可以显示中文,不需要额外设置. 7.键盘布局选择美国英语 8.这里选择基本存储设备即可,如果你的存储设备比较多可以自己选定. 9.会提示是否要清除所有数据,选择是,

在VM中最小化安装CentOS 7后的网络配置

1.点击虚拟网络编辑器:2.选择VMnet0为桥接模式,选择自动或者网卡3.右键VMware Network Adapter 属性4.选中VMware Bridge Protocol 5.选择共享6.返回网络7.虚拟机设置 8.进入CentOS 7 系统进行操作 9.查看当前网卡信息[[email protected] ~]# nmcli connection show NAME UUID TYPE DEVICE ens33 5dfbfd07-c796-49cb-a837-468af72b6d2

最小化安装centos 基础命令

# yum install vim iotop bc gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel zip unzip zlib-devel net-tools lrzsz tree ntpdate telnet lsof tcpdump wget libevent libevent-devel bc systemd-devel bash-completion traceroute -y 原文地址:http

安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(四)码农网

17. 安装 Webmin Webmin 是基于 Web 的 Linux 配置工具.它像一个中央系统,用于配置各种系统设置,比如用户.磁盘分配.服务以及 HTTP 服务器.Apache.MySQL 等的配置. # wget http://prdownloads.sourceforge.net/webadmin/webmin-1.740-1.noarch.rpm # rpm -ivh webmin-*.rpm 安装 Webmin 安装完 webmin 后,你会在终端上得到一个消息,提示你用 roo

基于CentOS 7下最小化安装的操作系统搭建Zabbix3.0环境

环境说明 系统版本:CentOS Linux release 7.3.1611 (Core) 内核版本:3.10.0-514.el7.x86_64 Httpd版本:Apache/2.4.6 (CentOS) MariaDB版本:5.5.52-MariaDB PHP版本:PHP 5.4.16 环境准备 [[email protected] ~]# setenforce 0 [[email protected] ~]# sed -i "s/SELINUX=enforcing/SELINUX=disa

RHEL/CentOS 7最小化安装后需做的30件事情

导读 CentOS是一个工业标准的Linux发行版,是红帽企业版 Linux 的衍生版本.你安装完后马上就可以使用,但是为了更好地使用你的系统,你需要进行一些升级.安装新的软件包.配置特定服务和应用程序等操作. 阅读帖子的时候请先完成 RHEL/CentOS 最小化安装,这是首选的企业和生产环境.如果还没有,你可以按照下面的指南,它会告诉你两者的最小化安装方法. 最小化安装 CentOS 7 最小化安装 RHEL 7 我们会基于工业标准的需求来介绍以下列出的这些重要工作.我们希望这些东西在你配置