Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS7 installs Cacti1.1.38 (available for personal testing)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Software installation

1.1 Update system

Yum-y install wget vim-enhancedmkdir / etc/yum.repos.d/backupmv / etc/yum.repos.d/ {* .repo,backup} wget-O / etc/yum.repos.d/CentOS-Base.repo https://mirrors.163.com/.help/CentOS7-Base-163.repowget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.reporm-rf / var/cache/yumrm-rf / var/cache/manyum makecacheyum update

1.2 install software packages required for the Cacti deployment environment

1.2.1 add the MariaDB YUM repository and execute the following script

Echo'# MariaDB 10.2 CentOS repository list-created 2017-07-03 06:59 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDBbaseurl = https://ipv4.mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64gpgkey=https://ipv4.mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDBgpgcheck=1'>/etc/yum.repos.d/Mariadb.repo

1.2.2 install the software environment

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

two。 Environment configuration

2.1 configure PHP

Modify PHP main configuration file / etc/php.ini

Turn off safe mode to support rrdtool and allow exec () access

[PHP] safe_mode = Off

Set time zone

[Date] date.timezone = Asia/Shanghai

2.2 configure Web server Apache httpd

Edit the / etc/httpd/conf.d/php.conf configuration file to make sure it contains

# 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

2.3 configure the database MariaDB

Set the database root user password for security reasons

Systemctl start mariadbmysqladmin-uroot password xxx123

Import time zone data to mysql database

Mysql_tzinfo_to_sql / usr/share/zoneinfo | mysql-uroot mysql-p

Modify the / etc/my.cnf.d/server.cnf file to make sure it contains

[mysqld] character_set_server = utf8mb4collation_server = utf8mb4_unicode_cicharacter_set_client = utf8mb4max_connections = 100max_heap_table_size = 4096Mmax_allowed_packet = 16777216join_buffer_size = 64Mtmp_table_size = 64Minnodb_file_per_table = ONinnodb_buffer_pool_size = 25600Minnodb_doublewrite = OFFinnodb_lock_wait_timeout = 50innodb_flush_log_at_timeout = 3innodb_read_io_threads = 32innodb_write_io_threads = 16

2.4 configure SNMP

Configure net-snmp-agent, modify configuration file / etc/snmp/snmpd.conf

Put 41 lines

Com2sec notConfigUser default public

Change to

Com2sec notConfigUser 127.0.0.1 public

Put 62 lines

Access notConfigGroup "" any noauth exact systemview none none

Change to

Access notConfigGroup "" any noauth exact all none none

Put 85 lines

# view all included. 1 80

Change to

View all included. 1 80

3. Install and configure Cacti

Download the unzipped Cacti installation package

Useradd-r-M cacticd / var/www/html/wget https://github.com/Cacti/cacti/archive/release/1.1.38.tar.gztar-zxvf 1.1.38.tar.gzcp-R cacti-release-1.1.38/ / var/www/html/cacticd / var/www/html/cacti

3.2 create cacti database, create cactiuser users, and set relevant authorizations

Mysql-u root-pCREATE database cacti default character set utf8;create user 'cacti'@'localhost' identified by' xxx3';grant all privileges on cacti.* to cacti@localhost;grant select on mysql.time_zone_name to 'cacti'@'localhost' identified by' xxx3';flush privileges

Import Cacti default database

Use cacti;source / var/www/html/cacti/cacti.sql;flush privileges;quit

3.4Editing / var/www/html/cacti/include/config.php

$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "xxx3" / * load up old style plugins here * / $plugins = array (); / / $plugins [] = 'thold'

3.5 create cacti system users and set graph/log directory permissions

Chown-R apache.apache / var/www/html/chown-R cacti/ var/www/html/chown-R apache.apache / var/www/html/cacti/chown-R cacti/ var/www/html/cacti/ {rra,log} / chmod-R 777 / var/www/html/cacti/ {rra,log} /

3.6 add scheduled tasks

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

4. Configure the firewall

4.1 configure firewalld Firewall

Firewall-cmd-permanent-add-port=3306/tcpfirewall-cmd-permanent-add-service=httpfirewall-cmd-permanent-add-port=161/udpfirewall-cmd-permanent add-port=162/udpfirewall-cmd reload

4.2 turn off selinux

Setenforce 0sed-I's Union SELINUXPRENTENTFORCING setenforce 0sed'/ etc/selinux/config

5. Install spine

Download and extract the Spine source code installation package with the same version number as Cacti

Cd / usr/local/srcwget http://www.cacti.net/downloads/spine/cacti-spine-1.1.38.tar.gztar xf cacti-spine-1.1.38.tar.gz

5.2 Source Code Compiler installs spine

Ln-s / usr/lib64/libmysqlclient.so.18.0.0 / usr/lib64/libmysqlclient.sontpdate ntp.sjtu.edu.cncd cacti-spine-1.1.38./configure & & make & & make install

5.3 copy and modify configuration fil

Cp / usr/local/spine/etc/spine.conf.dist / etc/spine.confvim / etc/spine.confDB_Host localhostDB_Database cactiDB_User cactiDB_Pass xxx3DB_Port 3306RDB_Host localhostRDB_Database cactiRDB_User cactiRDB_Pass xxx3RDB_Port 3306

5.4 Test

/ usr/local/spine/bin/spine

The following results will occur

SPINE: Using spine config file [/ etc/spine.conf]

SPINE: Version 1.1.38 starting

SPINE: Time: 0.0429 s, Threads: 5, Devices: 0

6. Set up restart and boot to start related services

Systemctl restart httpdsystemctl restart mariadbsystemctl restart crondsystemctl restart snmpdsystemctl enable httpdsystemctl enable mariadbsystemctl enable crondsystemctl enable snmpd

7. Log in to the Cacti WEB page to modify the Cacti configuration

Console-> Settings (Cacti Settings)-> Paths-> enter the configuration file path / usr/local/spine/bin/spine in the Spine Binary File Location text box, enter the configuration file path / usr/local/spine/etc/spine.conf in the Spine Config File Path box, and click Save (Save).

Console-> Settings (Cacti Settings)-> Poller-> Select spine in the Poller Type drop-down box, and click Save (Save).

8. Special hint

After adding devices and graphics, you need to rebuild the collector cache.

Console-> system tools-> Rebuild Poller Cache

Attached:

For example, the cacti platform requires that the default port number be changed (for example, changed to 10010) and the whitelist limit should be made (for example, only IP address 123.123.123 is allowed to log in). The relevant settings are as follows

1. Change the port number

Vim / etc/httpd/conf/httpd.conf

Change Listen:80 to Listen:10010 under line 137 and save exit.

2. The firewall releases 10010 port numbers.

Vim / etc/sysconfig/iptables

Add Firewall Rul

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 10010-j ACCEPT

Restart the firewall service

Service iptables restart

3. Make whitelist access restrictions

Vim / etc/httpd/conf/httpd.conf

Under line 318, add the following and save exit

Order allow,deny

Allow from 123.123.123.123

Restart the httpd service

Service httpd restart

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report