<\/span><\/h2>\nWe will start with installing the Nginx web server since, after the Grafana installation, we will need it for setting up the reverse proxy.<\/p>\n
To install the Nginx web server execute the following command:<\/p>\n
sudo apt install nginx -y<\/pre>\nOnce the installation is completed, start and enable the Nginx service:<\/p>\n
sudo systemctl start nginx && sudo systemctl enable nginx<\/pre>\nTo check the status of the Nginx service, execute the following command:<\/p>\n
sudo systemctl status nginx<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status nginx\r\n\u25cf nginx.service - A high performance web server and a reverse proxy server\r\n Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Sat 2022-11-26 15:37:54 CST; 35s ago\r\n Docs: man:nginx(8)\r\n Main PID: 22797 (nginx)\r\n Tasks: 4 (limit: 4575)\r\n Memory: 5.2M\r\n CPU: 98ms\r\n CGroup: \/system.slice\/nginx.service\r\n \u251c\u250022797 \"nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\"\r\n \u251c\u250022800 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n \u251c\u250022801 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n \u2514\u250022802 \"nginx: worker process\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\r\n\r\nNov 26 15:37:54 host.test.vps systemd[1]: Starting A high performance web server and a reverse proxy server...\r\nNov 26 15:37:54 host.test.vps systemd[1]: Started A high performance web server and a reverse proxy server.\r\n<\/pre>\n<\/span>Step 3. Install Grafana<\/span><\/h2>\nFirst, add the GPG keys:<\/p>\n
wget -q -O - https:\/\/packages.grafana.com\/gpg.key | gpg --dearmor | sudo tee \/usr\/share\/keyrings\/grafana.gpg > \/dev\/null<\/pre>\nThen, we need to add the Grafana repository:<\/p>\n
echo \"deb [signed-by=\/usr\/share\/keyrings\/grafana.gpg] https:\/\/packages.grafana.com\/oss\/deb stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/grafana.list<\/pre>\nOnce the key and the repository are added, update the system and install Grafana with the following commands:<\/p>\n
sudo apt-get update -y\r\n\r\nsudo apt-get install grafana -y<\/pre>\nAfter successful installation, start and enable the Grafana service.<\/p>\n
sudo systemctl start grafana-server && sudo systemctl enable grafana-server<\/pre>\nTo check the status of the service, execute the following command:<\/p>\n
sudo systemctl status grafana-server<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status grafana-server\r\n\u25cf grafana-server.service - Grafana instance\r\n Loaded: loaded (\/lib\/systemd\/system\/grafana-server.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Sat 2022-11-26 16:28:38 CST; 1min 49s ago\r\n Docs: http:\/\/docs.grafana.org\r\n Main PID: 23921 (grafana-server)\r\n Tasks: 15 (limit: 4575)\r\n Memory: 42.5M\r\n CPU: 2.494s\r\n CGroup: \/system.slice\/grafana-server.service\r\n<\/pre>\nBy default, the Grafana service is running on port 3000<\/b>. To check this, execute the following command:<\/p>\nnetstat -tunlp | grep 3000<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# netstat -tunlp | grep 3000\r\ntcp6 0 0 :::3000 :::* LISTEN 23921\/grafana-serve\r\n<\/pre>\nNow, when the service is up and running on port 3000, you can access Grafana at http:\/\/YourServerIpAddress:3000<\/b><\/p>\n