How to Install Cacti on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Cacti is a free and open source web-based network monitoring and graphing tool designed as the PHP front-end application for the RRDtool. Cacti is a complete frontend to RRDTool that stores all of the necessary information to create graphs and populate them with data in a MySQL database. Cacti allow us to check the services at an interval of time and resulting in the graph format. It is used to get a graph data for the CPU and network bandwidth utilization and monitors the network traffic by polling a router or switch via SNMP protocol. You can easily monitor the performance of your server, network, router, switch, web application and other services like, Mysql, Apache, Mail server, and DNS using Cacti. Cacti provide a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box.

In this tutorial, we will be installing and configuring Cacti monitoring tool on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 16.04 server.

Requirements

  • A fresh Alibaba Cloud Ubuntu 16.04 instance.
  • A static IP address is set up in your instance.
  • A root password is set up to your instance.

Launch Alibaba Cloud ECS Instance

First, Login to your Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install Apache, MariaDB and PHP

Cacti run on the web server, written in PHP and uses MariaDB to store their data. So, you will need to install Apache, MariaDB and PHP to your server. You can install all of them by running the following command:

Next, you will also need to install some other required packages like, snmp, rrdtool and PHP modules to your server. You can install them by running the following command:

Configure Database

By default, MariaDB installation is not secured. So, you will need to secure it first. You can secure it by running the mysql_secure_installation script:

Answer all the questions as shown below:

After securing MariaDB, log in to MariaDB console with the following command:

Enter your root password when prompt, then create a database and user for Cacti:

Next, flush the privileges with the following command:

Finally, exit from the MariaDB console with the following command:

Next, you will need to change some MariaDB variables settings for better performances. You can do this by editing /etc/mysql/mariadb.conf.d/50-server.cnf file:

Add the following lines under [mysqld] section:

Save and close the file. When you are finished. Then, change Timezone setting in php.ini file:

Make the following changes:

Save and close the file. Then, restart Apache and MariaDB service with the following command:

Download and Install Cacti

You can install Cacti using two ways, 1) Install Cacti from Ubuntu default repository and 2) Install Cacti from Source.

Here, we will install Cacti from Source. You can download the latest version of the Cacti from their official website using the following command:

Once the download is completed, extract the downloaded file and copy the extracted directory to the Apache web root directory with the following command:

Next, create a log file to store Cacti log and give proper permissions to the cacti directory with the following command:

Next, you will need to import cacti database tables from the cacti.sql file. You can do this with the following command:

Next, edit config.php file and provides Cacti database credentials:

Make the following changes:

Save and close the file, when you are finished.

Configure Apache for Cacti

Next, you will need to create an Apache Virtual host file for Cacti. You can do this by creating the following file:

Add the following lines:

Save and close the file. Then, enable Apache virtual host file with the following command:

Finally, restart Apache service to apply all the changes:

Next, you will need to create a cronjob for Cacti poller service that poll every five minutes.

Add the following line:

Save and close the file. Then, restart cron service with the following command:

Access Cacti Web Installation Wizard

Cacti is now installed. It’s time to set up it through a web browser.

Open your web browser and type the URL http://your-server-ip/cacti. You will be redirected to the Cacti license agreement page:

Image for post
Image for post

Now, accept the license agreement and click on Begin button. You will be redirected to the Cacti pre-installation check page:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Make sure all the required packages are installed. Then, click on the Next button. You should see the following page:

Image for post
Image for post

Here, choose the installation type and click on the Next button. You should see the following page:

Image for post
Image for post

Make sure all the required values are correct. Then, click on the Next button. You should see the following page:

Image for post
Image for post

Here, select the Templates that you wish to use after the installation. Then, click on the Finish button. You will be redirected to the Cacti login page:

Image for post
Image for post

Now, provide default username/password as admin/admin. Then, click on the Login button. You will be redirected to the Change password page:

Image for post
Image for post

Here, change your current password and click on the Save button. You will be redirected to the Cacti default dashboard as shown on the following page:

Image for post
Image for post

Congratulations! You have successfully installed Cacti monitoring tool on Ubuntu 16.04 server.

Original Source

https://www.alibabacloud.com/blog/how-to-install-cacti-on-ubuntu-16-04_594936?spm=a2c41.13062305.0.0

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store