<\/p>\n
We’ll show you, How to Install Graylog Server on Ubuntu 16.04. Graylog is a free and open source, centralized log management tool based on MongoDB and Elasticsearch. Using Graylog you can easily collect and analyze your server logs. Graylog is made up of three components Elasticsearch, MongoDB and Graylog server. Elasticsearch is used to store the logs and provide searching facilities. MongoDB stores the configuration and meta information. Graylog server collects the log messages from different inputs and provides a web interface for managing the logs.\u00a0Installing Graylog Server on Ubuntu 16.04 is not so complicated and should be done in less then 10 minutes.<\/p>\n
In this tutorial we will guide you through the steps of installing Graylog on an Ubuntu 16.04 VPS<\/a><\/p>\n
Table of Contents<\/p>\n
Login to your VPS as user root<\/p>\n
ssh root@IP_ADDRESS<\/pre>\nand update the system<\/p>\n
apt-get update && apt-get upgrade<\/pre>\n<\/span>2. Install Java<\/strong><\/span><\/h2>\n
We need Java installed on the server for the Graylog installation. It can be installed from the official ubuntu repo. You can also read our detailed tutorial on how to install java on ubuntu 16.04<\/a><\/p>\n
apt-get install openjdk-7-jre<\/pre>\ncheck the version<\/p>\n
java -version\r\n\r\nopenjdk version \"1.8.0_131\"\r\nOpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)\r\nOpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)<\/pre>\n<\/span>3. Install MongoDB<\/strong><\/span><\/h2>\n
MongoDB cannot be installed from the Ubuntu repository, so we will have to add the MongoDB repository.\u00a0You can also read our detailed tutorial on\u00a0How to Install MongoDB on Ubuntu 16.0<\/a><\/p>\n
sudo apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv 7F0CEB10\r\necho \"deb http:\/\/repo.mongodb.org\/apt\/debian wheezy\/mongodb-org\/3.0 main\" > \/etc\/apt\/sources.list.d\/mongodb-org-3.0.list\r\napt-get update<\/pre>\nand run the following command to install MongoDB<\/p>\n
apt-get install mongodb-org<\/pre>\nOnce installed, start MongoDB and enable it to start on boot<\/p>\n
systemctl start mongod\r\nsystemctl enable mongod<\/pre>\n<\/span>4. Install Elasticsearch<\/strong><\/span><\/h2>\n
Add the GPG key to the server:<\/p>\n
wget -qO - https:\/\/packages.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add -<\/pre>\nNow add the elasticsearch repository to sources list<\/p>\n
apt-get install apt-transport-https\r\necho \"deb https:\/\/packages.elastic.co\/elasticsearch\/2.x\/debian stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elasticsearch-2.x.list<\/pre>\nUpdate the package lists and install Elasticsearch<\/p>\n
apt-get update && apt-get install elasticsearch<\/pre>\nOnce the installation is completed, modify the Elasticsearch configuration file, uncomment the ‘cluster.name’ name, and change it to ‘graylog’.<\/p>\n
cluster.name: graylog<\/pre>\nstart Elastcisearch and enable it to start at boot time<\/p>\n
systemctl start elasticsearch\r\nsystemctl enable elasticsearch<\/pre>\n<\/span>5. Install and Configure Graylog<\/strong><\/span><\/h2>\n
Download and install Graylog repository<\/p>\n
wget https:\/\/packages.graylog2.org\/repo\/packages\/graylog-2.3-repository_latest.deb\r\ndpkg -i graylog-2.3-repository_latest.deb<\/pre>\nUpdate the package lists and install Graylog<\/p>\n
apt-get update && apt-get install graylog-server<\/pre>\nNext, we must specify ‘root_password_sha2’ password and secret key.<\/p>\n
Run the following command to create your password ‘root_password_sha2’, which will be password for the ‘admin’ account<\/p>\n
echo -n PASSWORD | sha256sum\r\n0be64ae89ddd24e225434de95d501711339baeee18f009ba9b4369af27d30d60 -<\/pre>\nReplace PASSWORD with an actual password<\/p>\n
Create a sectret key using pwgen<\/p>\n
apt-get install pwgen\r\npwgen -s 80 1\r\nI2UqBbXDXcWkYTs2x7wCAPs7GDmLG4iB82AuAhhtB0ayegd5SAjlMxh1Il848Vyq5DP5Q5ZN8wJmWK4m<\/pre>\nEdit the ‘\/etc\/graylog\/server\/server.conf’ file and insert the shasum of your desired password in the ‘root_password_sha2’ line and the secret key we created with pwgen in the ‘password_secret’ line<\/p>\n
nano \/etc\/graylog\/server\/server.conf\r\nroot_password_sha2 = 0be64ae89ddd24e225434de95d501711339baeee18f009ba9b4369af27d30d60\r\npassword_secret = I2UqBbXDXcWkYTs2x7wCAPs7GDmLG4iB82AuAhhtB0ayegd5SAjlMxh1Il848Vyq5DP5Q5ZN8wJmWK4m<\/pre>\nIn the same ‘server.conf’ find the following lines and change ‘IP_ADDRESS’ with your server IP address<\/p>\n
rest_listen_uri = http:\/\/IP_ADDRESS:9000\/api\/\r\nweb_listen_uri = http:\/\/IP_ADDRESS:9000\/<\/pre>\nSave the changes and restart Graylog<\/p>\n
systemctl restart graylog-server<\/pre>\n<\/span>6. Verify Graylog Installation<\/span><\/h2>\n
Check if Graylog is properly started<\/p>\n
systemctl status graylog-server<\/pre>\nIf everything is OK, you will get the following output<\/p>\n
\u25cf graylog-server.service - Graylog server\r\nLoaded: loaded (\/usr\/lib\/systemd\/system\/graylog-server.service; disabled; vendor preset: enabled)\r\nActive: active (running) since Sat 2017-08-19 22:50:14 CDT; 54s ago\r\nDocs: http:\/\/docs.graylog.org\/\r\nMain PID: 571 (graylog-server)\r\nCGroup: \/system.slice\/graylog-server.service\r\n\u251c\u2500571 \/bin\/sh \/usr\/share\/graylog-server\/bin\/graylog-server\r\n\u2514\u2500572 \/usr\/bin\/java -Xms1g -Xmx1g -XX:NewRatio=1 -server -XX:+ResizeTLAB -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:-OmitStackTraceInFastThr<\/pre>\n<\/span>7. Test Graylog Installation<\/span><\/h2>\n
Finally, you should be able to access Graylog web interface at
http:\/\/IP_ADDRESS:9000<\/code> and login with user ‘admin’ and the password we created as ‘root_password_sha2’.<\/p>\n
Please check Graylog’s official documentation for more information on how to configure and use the application. http:\/\/docs.graylog.org\/en\/2.2\/index.html<\/p>\n
\n
Of course, if you are one of our Managed MongoDB Hosting<\/a> customers, you don\u2019t have to install Graylog server on Ubuntu 16.04, simply ask our admins, sit back and relax. Our admins will install and configure Graylog on Ubuntu 16.4, for you immediately.<\/p>\n