Cacti安装

更新前,内核版本为:

uname -r 

3.10.0-327.10.1.el7.x86_64

1

2

1

2

升级的方法:

1、导入key

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org 

1

1

2、安装elrepo的yum源

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm 

1

1

3、安装内核

yum --enablerepo=elrepo-kernel install  kernel-ml-devel kernel-ml 

当前为4.4.4:

==================================================================================

Package            架构              版本                  源              大小

==================================================================================

正在安装:

kernel-ml        x86_64      4.4.4-1.el7.elrepo      elrepo-kernel      38 M

kernel-ml-devel  x86_64      4.4.4-1.el7.elrepo      elrepo-kernel      10 M

4、查看默认启动顺序

awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg 

CentOS Linux (4.4.4-1.el7.elrepo.x86_64) 7 (Core) 

CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core) 

CentOS Linux (0-rescue-c52097a1078c403da03b8eddeac5080b) 7 (Core)

默认启动的顺序是从0开始,新内核是从头插入(目前位置在0,而4.4.4的是在1),所以需要选择0。

grub2-set-default 0 

1

1

然后reboot重启,使用新的内核,下面是重启后使用的内核版本:

uname -r 

4.4.4-1.el7.elrepo.x86_64 

1

2

1

2

5、删除旧的内核

yum remove kernel 

chown -R apache:apache

3.修改MySQL配置文件

修改mysql配置文件my.cnf(windows为my.ini)

my.cnf一般在etc/mysql/my.cnf位置。找到后请在以下三部分里添加如下内容:

[client]

default-character-set = utf8mb4

[mysql]

default-character-set = utf8mb4

[mysqld]

character-set-client-handshake = FALSE

character-set-server = utf8mb4

collation-server = utf8mb4_unicode_ci

init_connect='SET NAMES utf8mb4'

4. 重启数据库,检查变量

SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';

SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';

yum install wget ntpdate -y

[root@localhost ~]# ntpdate pool.ntp.org

14 Feb 09:01:01 ntpdate[2476]: step time server 85.199.214.101 offset 942934.062841 sec

[root@localhost ~]# date

Tue Feb 14 09:01:07 CST 2017

创建文件:vi /etc/yum.repos.d/MariaDB.repo

文件内容:

# MariaDB 10.0 CentOS repository list - created 2014-09-28 09:10 UTC

# http://mariadb.org/mariadb/repositories/

[mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/10.0/centos7-amd64

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

gpgcheck=1

yum install -y httpd mariadb-server mariadb php php-gd php-mysql php-ldap php-snmp php-posix php-mbstring net-snmp net-snmp-utils

yum install -y zlib libpng freetype libjpeg fontconfig gd libxml2

yum install -y rrdtool

1.查看ip

ip addr

2. 临时关闭 selinux

setenforce 0 

3. 查看selinux状态

sestatus

4. 关闭selinux

cat /etc/selinux/config 

systemctl disable firewalld

[root@localhost conf]# systemctl stop firewalld

[root@localhost conf]# setenforce 0

setenforce: SELinux is disabled

SELINUX= enforcing改为disabled

sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config 

systemctl enable snmpd.service

systemctl start snmpd.service

systemctl enable httpd.service

systemctl start httpd.service

systemctl enable mariadb.service

systemctl start mariadb.service

yum install vixie-cron

echo '*/5 * * * * root /usr/bin/php /var/www/html/poller.php' >> /etc/crontab

vi /etc/httpd/conf/httpd.conf

/ServerName修改为localhost:80

#ServerName www.example.com:80

--ServerName localhost:80

vi /etc/php.ini

/timezone

[Date]

; Defines the default timezone used by the date functions

; http://php.net/date.timezone

;date.timezone =

date.timezone = Asia/Shanghai

copy cacti.tar -> /var/www/html/

[root@localhost html]# tar zxvf cacti-1.0.2.tar.gz

[root@localhost html]# mv cacti-1.0.2/* .

[root@localhost html]# chown -R apache:apache *

[root@localhost html]# chmod -R 777 rra/ log/

[root@localhost html]# rm -rf cacti-1.0.2/

[root@localhost html]# mysql -u root -p

MariaDB [mysql]> grant all privileges on *.* to 'root'@'109.130.91.41' identified by '!wangqiang25' with grant option;

Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> flush privileges;

Query OK, 0 rows affected (0.01 sec)

mysql -u root -p

create database cacti;

grant all on cacti.* to 'cactiuser'@'%' identified by 'cactipwd123';

flush privileges;

mysql -u root -p cacti < cacti.sql

原始目录/etc/my.cnf.d/server.cnf

/etc/my.cnf

[mysqld]

character-set-client-handshake = FALSE

character-set-server = utf8mb4

collation-server = utf8mb4_unicode_ci

init_connect= 'SET NAMES utf8mb4'

# cacti_setting_20170213

innodb_buffer_pool_size = 4000M

innodb_doublewrite=OFF

innodb_additional_mem_pool_size=160M

innodb_flush_log_at_timeout=3

innodb_read_io_threads=32

innodb_write_io_threads=16

join_buffer_size=256M

tmp_table_size=256M

max_allowed_packet=16M

max_heap_table_size=512M

[client]

default-character-set=utf8mb4

[mysql]

default-character-set=utf8mb4

systemctl restart mariadb.service

/var/www/html/include/config.php

$database_type    = 'mysql';

$database_default  = 'cacti';

$database_hostname = 'localhost';

$database_username = 'cactiuser';

$database_password = 'cactiuser';

$database_password = 'cactipwd123';

$database_port    = '3306';

$database_ssl      = false;

$url_path = '/';

ALTER DATABASE `cacti` COLLATE 'utf8mb4_unicode_ci';

删除多余的用户账户

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

并给time_zone_name放开cactiuser show权限

测试

"/etc/snmp/snmpd.conf

#      group          context sec.model sec.level prefix read  write  notif

access  notConfigGroup ""      any      noauth    exact  all none none

##          incl/excl subtree                          mask

view all    included  .1                              80

安装spine

[root@localhost html]# cd /opt

You have new mail in /var/spool/mail/root

[root@localhost opt]# ls

cacti-spine-1.0.2.tar.gz

[root@localhost opt]# ll

total 784

-rw-r--r--. 1 root root 800868 Feb 14 11:48 cacti-spine-1.0.2.tar.gz

[root@localhost opt]# tar zxvf cacti-spine-1.0.2.tar.gz

yum install gcc net-snmp-devel mariadb-devel openssl-devel automake autoconf libtool make -y

yum install help2man -y

[root@localhost cacti-spine-1.0.2]# ./configure --build=x86_64-unknown-linux

make

make install

安装路径 /usr/local/spine/bin/spine

配置文件存放路径/usr/local/spine/etc

[root@localhost cacti-spine-1.0.2]# cp /usr/local/spine/bin/spine /usr/bin/spine  把执行文件拷贝到/usr/bin/目录下

You have new mail in /var/spool/mail/root

[root@localhost cacti-spine-1.0.2]# chmod +x /usr/bin/spine

[root@localhost cacti-spine-1.0.2]# cp /usr/local/spine/etc/spine.conf.dist  /etc/spine.conf

vi /etc/spine.conf

DB_Host                localhost

DB_Database            cacti

DB_User                cactiuser

DB_Pass                cactipwd123

DB_Port                3306

安装插件

cd /var/www/html/plugins/

wget http://*****

mv plugin\:插件名称.tgz

tar zxvf 插件名称.tgz

chown -R apache:apache 插件文件夹

你可能感兴趣的:(Cacti安装)