2018年8月27日 星期一

CACTI 安裝於Ubuntu 1604

LAMP必須先安裝好

# vi /etc/apt/sources.list

於最後加入
deb http://ftp.ro.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.ro.debian.org/debian/ stretch main
deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main

#apt update
#apt upgrade

#apt install php7.0-snmp php7.0-xml php7.0-mbstring php7.0-json php7.0-gd php7.0-gmp php7.0-zip php7.0-ldap php7.0-mcrypt

# echo "date.timezone = Asia/Taipei" >> /etc/php/7.0/apache2/php.ini
# mysql -u root -p
MariaDB [(none)]> create database cacti;
MariaDB [(none)]> grant all on cacti.* to 'cactiuser'@'localhost' identified by 'password1';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

# mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql
# mysql -u root -p -e 'grant select on mysql.time_zone_name to cactiuser@localhost'

# vi /etc/mysql/mariadb.conf.d/50-server.cnf   將下列加入底部
max_heap_table_size             = 98M
tmp_table_size                  = 64M
join_buffer_size                = 64M
innodb_buffer_pool_size = 485M
innodb_doublewrite              = off
innodb_flush_log_at_timeout     = 3
innodb_read_io_threads  = 32
innodb_write_io_threads = 16

# systemctl restart mysql apache2
# systemctl status mysql apache2

下載Cacti
# wget https://www.cacti.net/downloads/cacti-latest.tar.gz
# tar xfz cacti-latest.tar.gz
# cp -rf cacti-1.1.38/* /var/www/html

# rm /var/www/html/index.html
# touch /var/www/html/log/cacti.log
# chown -R www-data:www-data /var/www/html/
# vi /var/www/html/include/config.php        變更資料庫Cacti的密碼
$database_type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'xxxxx';
$database_port     = '3306';
$database_ssl      = false;

#  mysql -u cactiuser cacti -p < /var/www/html/cacti.sql
# apt install snmp snmpd snmp-mibs-downloader rrdtool
# systemctl restart snmpd.service
# systemctl  status  snmpd.service
# ss -tulpn| grep snmp

下載及安裝Cacti-Spine
# apt install build-essential dos2unix dh-autoreconf help2man libssl-dev libmysql++-dev  librrds-perl libsnmp-dev libmysqlclient-dev libmysqld-dev

# wget https://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz
# tar xfz cacti-spine-latest.tar.gz
# cd cacti-spine-1.1.38
# ./bootstrap
# ./configure
# make
# make install
# chown root:root /usr/local/spine/bin/spine
# chmod +s /usr/local/spine/bin/spine
# vi /usr/local/spine/etc/spine.conf  新增檔案,加入下列

DB_Host localhost
DB_Database cacti
DB_User cactiuser
DB_Pass password1
DB_Port 3306
DB_PreG 0

http://IP/install























安裝完成

LAMP 安裝於Ubuntu 1604

安裝Apache
#  apt install apache2
# systemctl status apache2.service
# netstat -tlpn


打開瀏覽器http://IP 確認Apache 服務正常

如果Web要使用HTTPS,必須啟動Apache SSL
 # a2ensite default-ssl.conf
 # systemctl restart apache2.service
 # netstat -tlpn
















打開瀏覽器https://IP 確認Apache 服務正常

安裝PHP

# apt search php7.0
# apt install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-xml php7.0-gd
# php -v
# vi /var/www/html/info.php 新增此檔,內容如下:
<?php
phpinfo();
?>
# systemctl restart apache2
開啟瀏覽器 http://ip/info.php





















如果要額外安裝PHP模組,可以使用下列指令列出可安裝之麼組
# apt install php7.0











安裝MariaDB 10
# apt install php7.0-mysql mariadb-server mariadb-client
# mysql_secure_installation
# mysql
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set plugin=’‘ where User=’root’;
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> exit

# systemctl restart mysql.service
# mysql -u root -p