
Introduction
Install Graylog on Ubuntu to efficiently manage and analyze large volumes of log data. Graylog is an open-source, web-based log management and aggregation system that collects server logs, stores them in Elasticsearch for indexing, and uses MongoDB to save metadata. It enables detailed log analysis and provides alerting capabilities for proactive monitoring.
This article explains how to install Graylog on Ubuntu server.
Prerequisites
- Deploy a fully updated Vultr Ubuntu 20.04 Server with at least 4 GB of RAM.
- Create a non-root user with sudo access.
1. Install OpenJDK
Install OpenJDK required by Elasticsearch and other dependencies.
$ sudo apt -y install bash-completion apt-transport-https uuid-runtime pwgen openjdk-11-jre-headless2. Install Elasticsearch
Import the Elasticsearch PGP signing key.
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -Add the Elasticsearch repository.
$ echo "deb https://artifacts.elastic.co/packages/oss-6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.listUpdate the system.
$ sudo apt updateInstall Elasticsearch.
$ sudo apt -y install elasticsearch-ossEdit the Elasticsearch configuration file.
$ sudo nano /etc/elasticsearch/elasticsearch.ymlAdd these two lines to the end of the file.
cluster.name: graylog action.auto_create_index: falseSave and exit the file.
Reload the system daemon.
$ sudo systemctl daemon-reloadRestart Elasticsearch service.
$ sudo systemctl restart elasticsearchEnable Elasticsearch to run on system startup.
$ sudo systemctl enable elasticsearch
3. Install MongoDB
-
$ sudo apt install mongodb-server -y Start the MongoDB service.
$ sudo systemctl start mongodbEnable MongoDB service to start at system startup.
$ sudo systemctl enable mongodb
4. Install Graylog on Ubuntu
Add the Graylog repository.
$ wget https://packages.graylog2.org/repo/packages/graylog-4.1-repository_latest.debInstall the Graylog server package.
$ sudo dpkg -i graylog-4.1-repository_latest.debUpdate the system.
$ sudo apt updateInstall Graylog.
$ sudo apt -y install graylog-serverGenerate a 96-character random string for Graylog and save a copy to use in the Graylog server configuration file.
$ pwgen -N 1 -s 96Choose a strong password for your admin account and generate a 64-character hash. For example, if you choose
StrongPassword:$ echo -n StrongPassword | sha256sumThe hash is:
05a181f00c157f70413d33701778a6ee7d2747ac18b9c0fbb8bd71a62dd7a223Edit the Graylog configuration file.
$ sudo nano /etc/graylog/server/server.confUpdate
password_secretwith the 96-character random string you generated earlier. For example:password_secret = E2oSBW5rFhN6q6zguM7ve7KH1e7WfkAnqy64WR2E4U673ryQmSSDtCSBCfnVoCrLgISiYkPvBam1h0EKfIxGCFhpVX78gz7lUpdate
root_password_sha2with the 64-character hash of your admin password. For example:root_password_sha2 = 05a181f00c157f70413d33701778a6ee7d2747ac18b9c0fbb8bd71a62dd7a223Update
http_bind_addressas shown:http_bind_address = 0.0.0.0:9000Save and close the file.
Restart the system daemon.
$ sudo systemctl daemon-reloadRestart the Graylog service.
$ sudo systemctl restart graylog-serverEnable the Graylog service to run on system startup.
$ sudo systemctl enable graylog-serverVerify the status of the Graylog server.
$ sudo systemctl status graylog-server
5. Access Graylog Web UI
Open your web browser and navigate to your servers IP address at port 9000. for example:
http://192.0.2.10:9000Log in with username
adminand the password you chose to access the Graylog dashboard.
More Information
For more information on Graylog, please visit the official documentation.