cacti upgrade for ubuntu 20.04 LTS

cacti upgrade for ubuntu 20.04 LTS

728x90

기존 서버에 있는 데이터 백업

#!/bin/sh

curtime=`date +%Y_%m%d_%H`

curdate=`date +%Y_%m%d`

export_curdate=`date +%Y-%b-%d`

prevdate=`date --date "14 days ago" +%Y_%m%d`

export_prevdate=`date --date "1 days ago" +%Y-%b-%d`

expiredate=`date --date "120 days ago" +%Y_%m%d`

# mysql backup

mysqldump -u cactiuser -p 암호 cacti|gzip > /data/home/backup/cacti_$curdate.mysql.gz

# home backup

tar -cvzf /data/home/backup/cacti_$curdate.tgz /usr/share/cacti/

# del

find /data/home/backup/ -ctime +20 -exec rm -f {} \;

mysql 과 home 이 백업이 된다.

https://www.cacti.net/info/downloads

가서 최신 버전이나 yum install cacti 설치 하면 된다.

현재 1.2.18 버전은 /usr/share/cacti 에 설치가 된다.

mysql 복원

# mysql -u root -p cacti < cacti_2021_1014.mysql

데이터 이전

# cp /home/cacti_backup/rra/* /usr/share/cacti/site/rra/

# cp -u /home/cacti_backup/scripts/* /usr/share/cacti/site/scripts/

# cp -u -R /home/cacti_backup/resource/* /usr/share/cacti/site/resource/

권한 부여

# chown -R cacti:users /usr/share/cacti/

웹 페이지 접속

http://localhost/cacti

자신의 원하는 설정으로 해서 진행

에러 나는부분 해결 하자.

# vi /etc/php/7.4/apache2/php.ini

date.timezone = Asia/Seoul

추가

memory_limit = 400M

max_execution_time = 60

수정

# vi /etc/php/7.4/cli/php.ini

date.timezone = Asia/Seoul

추가

# vi /etc/mysql/my.cnf

[mysqld]

character-set-server=utf8mb4

collation-server=utf8mb4_unicode_ci

max_heap_table_size=32M

max_allowed_packet=32M

tmp_table_size=32M

join_buffer_size=128M

innodb_buffer_pool_size=485M

innodb_flush_log_at_timeout=3

innodb_read_io_threads=32

innodb_write_io_threads=16

innodb_buffer_pool_instances=64M

innodb_io_capacity=5000

innodb_io_capacity_max=10000

추가

# service apache2 restart

# service mysql restart

서비스 재시작

ERROR: Your MySQL TimeZone database is not populated. Please populate this database before proceeding.

라고 위와 같이 에러 뜬다면

mysql 에 추가 설정을 해주면 된다.

# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 186

Server version: 8.0.26-0ubuntu0.20.04.3 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;

Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)

mysql> quit

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

# service mysql restart

사이트 refresh 해보면 위와 같이 모든 준비가 끝났다. 다음 누르자

경고가 뜬다.. 뭐 다음 눌러보자.

예시 처럼 작업을 해주자.

chown -R www-data.www-data /usr/share/cacti/site/resource/snmp_queries/

chown -R www-data.www-data /usr/share/cacti/site/resource/script_server/

chown -R www-data.www-data /usr/share/cacti/site/resource/script_queries/

chown -R www-data.www-data /usr/share/cacti/site/scripts/

그리고 refresh 해주면

문제 없이 다음으로

또 경고가 있다.. 위에 나와 있는대로 작업 해주자.

# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 25

Server version: 8.0.26-0ubuntu0.20.04.3 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Query OK, 1 row affected (0.04 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)

mysql> quit

Bye

# service mysql restart

경고가 없어졌다. 자 다음 눌러보자.

정말 할건지 물어보는데 ok 가즈아~

시간이 좀 걸린다. 기다리자.

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

망.... DB는 모두 정상적으로 떴지만 최종 error 뜨면서 오류가 났다...

음.. 대충 알아보니 DB 호환 문제인듯 하다.

mysql 버전이 너무 낮은 버전에서 너무 높은 버전으로 올라가서 호환이 안되는 문제 인듯... 해서

ubuntu 18.04 버전으로 다시 시도..

18.04 로 하면 최신 버전이 아닌 1.1.38 버전으로 설치 된다.

뭐 비슷 하니

위와 같이 모두 오류 수정 하고

다음 누르면

정상적으로 완료 되었다.

728x90

from http://algo79.tistory.com/846 by ccl(A) rewrite - 2021-10-14 17:26:36