In this article, you are going to learn how to install Grafana on Ubuntu 22.04. Grafana is a web-based analytics and interactive visualization program that runs on a variety of platforms. When connected to supported data sources, it produces web-based charts, graphs, and alerts. Grafana Enterprise, a licensed version with additional features, is also available as a self-hosted installation or as a Grafana Labs cloud account. It can be expanded via a plug-in system. Using interactive query builders, end users may develop complicated monitoring dashboards.
Grafana is a popular visualization tool in monitoring stacks, and it’s frequently used in conjunction with time series databases like InfluxDB, Prometheus, and Graphite; monitoring platforms like Sensu, Icinga, Checkmk, Zabbix, Netdata, and PRTG; SIEMs like Elasticsearch and Splunk; and other data sources.
How to Install Grafana on Ubuntu 22.04
- Start by updating your system.
sudo apt update
- Add Grafana gpg key by running the following commands.
sudo apt-get install -y gnupg2 curl software-properties-common
curl https://packages.grafana.com/gpg.key | sudo apt-key add -
- Next install Grafana repository
echo "deb https://packages.grafana.com/enterprise/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
- After adding the repository, update your Apt repositories
sudo apt-get update
Install Grafana on Ubuntu 22.04
- Install Grafana on Ubuntu 22.04 using the command below.
sudo apt-get install grafana
Sample output
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: galera-4 libaio1 libconfig-inifiles-perl libdbd-mariadb-perl libfprint-2-tod1 libhtml-template-perl libllvm9 libmariadb3 libpmem1 libreadline5 libterm-readkey-perl mariadb-client-10.7 mariadb-client-core-10.7 mariadb-common mariadb-server-10.7 mariadb-server-core-10.7 socat Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: grafana 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 49.0 MB of archives. After this operation, 147 MB of additional disk space will be used. Get:1 https://packages.grafana.com/enterprise/deb stable/main amd64 grafana amd64 7.0.0 [49.0 MB] Fetched 49.0 MB in 53s (926 kB/s) Selecting previously unselected package grafana. (Reading database ... 198850 files and directories currently installed.) Preparing to unpack .../grafana_7.0.0_amd64.deb ... Unpacking grafana (7.0.0) ... Setting up grafana (7.0.0) ... Adding system user `grafana' (UID 127) ... Adding new user `grafana' (UID 127) with group `grafana' ... Not creating home directory `/usr/share/grafana'. ### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable grafana-server ### You can start grafana-server by executing sudo /bin/systemctl start grafana-server Processing triggers for systemd (245.4-4ubuntu3.15) ...
- After installing enable it using the command below.
sudo systemctl enable --now grafana-server
- Check if its running
sudo systemctl status grafana-server
Sample output
● grafana-server.service - Grafana instance Loaded: loaded (/lib/systemd/system/grafana-server.se> Active: active (running) since Sun 2022-02-20 15:40:4> Docs: http://docs.grafana.org Main PID: 12639 (grafana-server) Tasks: 9 (limit: 4588) Memory: 49.3M CGroup: /system.slice/grafana-server.service └─12639 /usr/sbin/grafana-server --config=/et> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> Feb 20 15:40:49 ubuntu grafana-server[12639]: t=2022-02-20> lines 1-20/20 (END)
Access Grafana on Ubuntu 22.04
- Grafana default port is 3000, you can access Grafana through your server IP followed by port 3000 e.g.
server-IP:3000
orlocalhost:3000
if you are testing it locally. - If you can’t access it, you need to allow access on the firewall using the command below.
sudo ufw enable
sudo ufw allow ssh
sudo ufw allow 3000/tcp
- You should now be able to access Grafana login page. Default logins are Username: admin and Password: admin
- After entering default logins you will be asked to enter new password. Note, you can skip and change it later.
- You will be redirected to Grafana dashboard, you can now add your data source.
- You have reached the end of the article, Congratulations. You have learned how to Install Grafana on Ubuntu 22.04.
Other Tutorials
Install Webmin on Ubuntu 22.04