How To Install Graylog on Ubuntu 20.04 LTS

Install Graylog on Ubuntu 20.04

In this tutorial, we will show you how to install Graylog on Ubuntu 20.04 LTS. For those of you who didn’t know, Graylog is a free and open-source powerful centralized log management tool based on Elasticsearch and MongoDB. Graylog helps you to collect, index and analyze any machine logs centrally.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation Graylog on an Ubuntu 20.04 (Focal Fossa) server. You can follow the same instructions for Ubuntu 18.04, 16.04 and any other Debian based distribution like Linux Mint.

Install Graylog on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running these following apt commands in the terminal.

Step 2. Installing Java.

Graylog set up requires Java. You can use either OpenJDK or Oracle JDK on your machine to proceed further:

Verify the Java version:

Step 3. Installing Elasticsearch.

Run the following command to import the repository’s GPG key:

Now add the Elasticsearch repository to the system:

Then,  run apt update then install Elasticsearch package on your Ubuntu system:

Elasticsearch service will not start automatically after the installation process is complete. To start the service and enable the service run:

Now edit the Elasticsearch configuration file to set the cluster name for Graylog set up:

Make the following changes:

After that, start the Elasticsearch service to read the new configurations:

To verify that Elasticsearch is running, use curl to send an HTTP request to port 9200 on localhost:

You should see something similar to this:

Step 4. Installing MongoDB.

By default, the latest version of MongoDB is not available in the Ubuntu 20.04 default repository. So you will need to add the official MongoDB repository in your system:

Next, add the MongoDB repository with the following command:

After that, update your system and refresh existing repositories by running the commands below:

Once the installation has been completed, start the MongoDB service and enable it to start at reboot with the following command:

Step 5. Installing Graylog on Ubuntu 20.04.

Graylog is not available in the Ubuntu 20.04 default repository, you need to download and install the Graylog repository to your system:

Update the repository cache and install the Graylog server using the following command:

Once installed the Graylog Server, you have to generate a secret key for Graylog using the following command:

Then, create a hash password for the root user that can be used to log in to the Graylog web server using the following command:

Next steps edit the server.conf file:

Make changes to the file as shown below:

After you have modified the configuration file, you can start Graylog Service using the following commands:

Step 6. Accessing Graylog Web Interface.

Graylog will be available on HTTP port 9000 by default. Open your favourite browser and navigate to http://your-domain.com:9000 or http://your-ip-address:9000 and complete the required steps to finish the installation.

Install Graylog on Ubuntu 20.04  LTS

Congratulations! You have successfully installed Graylog. Thanks for using this tutorial for installing Graylog on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official Graylog website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!