{"id":8298,"date":"2021-07-15T10:36:49","date_gmt":"2021-07-15T10:36:49","guid":{"rendered":"https:\/\/linuxways.net\/?p=8298"},"modified":"2021-07-15T10:36:49","modified_gmt":"2021-07-15T10:36:49","slug":"how-to-install-grafana-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-grafana-on-ubuntu-20-04\/","title":{"rendered":"How to Install Grafana on Ubuntu 20.04"},"content":{"rendered":"<p>Grafana is a monitoring and visualization software. With the help of a Dashboard and graphs, you can visualize, query, and monitor your data over a period of time. It can connect with complex data sources like MySQL, ElasticSearch, Graphite, Prometheus, etc.<\/p>\n<p>In today&#8217;s post, we will walk you through the steps for the installation of Grafana on Ubuntu OS. You can install Grafana on Ubuntu OS using different ways:<\/p>\n<p>Here, we will cover:<\/p>\n<ul>\n<li>Installation of Grafana using APT repository<\/li>\n<li>Installation of Grafana using .deb package<\/li>\n<\/ul>\n<p><strong>Note<\/strong>: Both installation methods shown here have been tested on <strong>Ubuntu 20.04 LTS<\/strong>.<\/p>\n<h2>Installing Grafana Using APT repository<\/h2>\n<p>In the following procedure, we will install Grafana using the APT repository. Although, you can install Grafana using the Ubuntu official repository but it is not the latest version. To get the Grafana latest version, we can use Grafana\u2019s official APT repository. Using this method, it will be easier for you to update Grafana using the apt-get update whenever a newer version is available. Let\u2019s get started.<\/p>\n<p>1. Add the software-properties-common package to your system. It will allow you to easily manage PPAs in your system:<\/p>\n<pre>$ sudo apt install software-properties-common<\/pre>\n<p>Now the installation will be started and if during installation, you are prompted with <strong>y\/n<\/strong>, type <strong>y<\/strong> and press <strong>Enter<\/strong>.<\/p>\n<p>2. Now, you will have to import the Grafana GPG key to the APT sources keyring. Run the command below to do so:<\/p>\n<pre>$ wget -q -O - https:\/\/packages.grafana.com\/gpg.key | sudo apt-key add -<\/pre>\n<p>This command will download the Grafana GPG key and add it to the APT sources keyring.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"90\" class=\"wp-image-8299\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-375.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-375.png 687w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-375-300x39.png 300w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><\/p>\n<p>3. Next, use the command below to add Grafana repository to your system&#8217;s list of sources:<\/p>\n<pre>$ echo \"deb https:\/\/packages.grafana.com\/oss\/deb stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/grafana.list<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"110\" class=\"wp-image-8300\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-376.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-376.png 776w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-376-300x43.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-376-768x109.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/p>\n<p>4. After adding the Grafana repository, update the system\u2019s list of sources using the command below:<\/p>\n<pre>$ sudo apt update<\/pre>\n<p>5. Now you can install Grafana as follows:<\/p>\n<pre>$ sudo apt install Grafana<\/pre>\n<p>Now the installation will be started and if during installation, you are prompted with <strong>y\/n<\/strong>, type <strong>y<\/strong> and press <strong>Enter<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"616\" class=\"wp-image-8301\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-377.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-377.png 792w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-377-300x233.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-377-768x597.png 768w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/p>\n<p>6. To verify the installation, use the command below:<\/p>\n<pre>$ grafana-server -v<\/pre>\n<p>The output below verifies that Grafana version <strong>8.0.5<\/strong> has been installed on your system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"70\" class=\"wp-image-8302\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-378.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-378.png 512w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-378-300x41.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>After installation, you can start the Grafana service using the command below:<\/p>\n<pre>$ sudo systemctl start grafana-server<\/pre>\n<p>Use the command below to make the service start automatically upon boot:<\/p>\n<pre>$ sudo systemctl enable grafana-server<\/pre>\n<p>To verify if the Grafana service is running, use the command below:<\/p>\n<pre>$ sudo systemctl status grafana-server<\/pre>\n<p>You should see the below output which shows Grafana service is running without any errors.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"173\" class=\"wp-image-8303\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-379.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-379.png 813w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-379-300x64.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-379-768x163.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/p>\n<p>Now the Grafana has been installed and ready to use.<\/p>\n<h2>Installing Grafana Using .deb package<\/h2>\n<p>Grafana is also available as a .deb package on the Grafana official website. However, remember you will have to manually update Grafana each time a newer version is released. In this method, we will download Grafana using the .deb package from the Grafana official <a href=\"https:\/\/grafana.com\/grafana\/download\">Downloads<\/a> page. As of July 2021, the latest version of Grafana available on the website is 8.0.5.<\/p>\n<p>1. First, install some prerequisites using the command below:<\/p>\n<pre>$ sudo apt-get install -y adduser libfontconfig1<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"677\" height=\"287\" class=\"wp-image-8304\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-380.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-380.png 677w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-380-300x127.png 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/p>\n<p>2. Now using the command below, download the .deb package of Grafana 8.0.5. To download any other version, visit Grafana official <a href=\"https:\/\/grafana.com\/grafana\/download\">Downloads<\/a> link and get the version you need.<\/p>\n<pre>$ wget https:\/\/dl.grafana.com\/oss\/release\/grafana_8.0.5_amd64.deb<\/pre>\n<p>This command will download the Grafana version 8.0.5 to your Home directory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"846\" height=\"247\" class=\"wp-image-8305\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-381.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-381.png 846w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-381-300x88.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-381-768x224.png 768w\" sizes=\"auto, (max-width: 846px) 100vw, 846px\" \/><\/p>\n<p>3. Now install the Grafana using this command:<\/p>\n<pre>$ sudo dpkg -i grafana_8.0.5_amd64.deb<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"816\" height=\"207\" class=\"wp-image-8306\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-382.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-382.png 816w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-382-300x76.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-382-768x195.png 768w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><\/p>\n<p>4. To verify the installation, use the command below:<\/p>\n<pre>$ grafana-server -v<\/pre>\n<p>The output below verifies that Grafana version <strong>8.0.5<\/strong> has been installed on your system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"69\" class=\"wp-image-8307\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-383.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-383.png 490w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-383-300x42.png 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/p>\n<p>After installation, you can start the Grafana service using the command below:<\/p>\n<pre>$ sudo systemctl start grafana-server<\/pre>\n<p>Use the command below to make the service start automatically upon boot:<\/p>\n<pre>$ sudo systemctl enable grafana-server<\/pre>\n<p>To verify if the Grafana service is running, use the command below:<\/p>\n<pre>$ sudo systemctl status grafana-server<\/pre>\n<p>You should see the below output which shows Grafana service is running without any errors.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"173\" class=\"wp-image-8308\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-384.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-384.png 813w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-384-300x64.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-384-768x163.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/p>\n<p>Now the Grafana has been installed and ready to use.<\/p>\n<h2>Configure Firewall<\/h2>\n<p>If you need to access Grafana from the same system on which Grafana is installed, you can skip this step. However, if you need to access Grafana from another system on the local network, you will need to open port 3000 in your firewall.<\/p>\n<p>Here is the command to allow port 3000 in the firewall:<\/p>\n<pre>$ sudo ufw allow 3000\/tcp<\/pre>\n<h2>Access Grafana<\/h2>\n<p>In order to access Grafana, open any web browser and navigate to your Grafana\u2019s server IP address as follows:<\/p>\n<pre><a href=\"http:\/\/ip-address:3000\">http:\/\/ip-address:3000<\/a><\/pre>\n<p>This will open the login screen of Grafana. Login using the <strong>admin<\/strong> as your username and password.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"997\" height=\"734\" class=\"wp-image-8309\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-385.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-385.png 997w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-385-300x221.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-385-768x565.png 768w\" sizes=\"auto, (max-width: 997px) 100vw, 997px\" \/><\/p>\n<p>Once you are logged in using the default credentials, it will ask you to set a new password for your admin account. Type a new password and confirm it. Then click <strong>Submit<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"943\" height=\"735\" class=\"wp-image-8310\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-386.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-386.png 943w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-386-300x234.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-386-768x599.png 768w\" sizes=\"auto, (max-width: 943px) 100vw, 943px\" \/><\/p>\n<p>After this, you will see the following Grafana Dashboard. <img loading=\"lazy\" decoding=\"async\" width=\"987\" height=\"819\" class=\"wp-image-8311\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-387.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-387.png 987w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-387-300x249.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-387-768x637.png 768w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/p>\n<h2>Uninstall Grafana<\/h2>\n<p>If you ever need to uninstall Grafana, you can do this by running the command below:<\/p>\n<pre>$ sudo apt remove grafana<\/pre>\n<p>Whether you have installed Grafana using the APT repository or using the .deb package, this command works for both methods and will remove Grafana from your system.<\/p>\n<p>In this post, we covered how to install Grafana on Ubuntu OS using two methods: using the APT repository and the .deb package. Using either of the methods discussed above, you can have the latest version of Grafana on your system. In the end, we also covered how to uninstall Grafana in case you need to do so.<\/p>","protected":false},"excerpt":{"rendered":"<p>Grafana is a monitoring and visualization software. With the help of a Dashboard and graphs, you can visualize, query, and monitor your data over a period of time.&hellip;<\/p>","protected":false},"author":1,"featured_media":8428,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[420,100],"class_list":["post-8298","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-grafana","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/8298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=8298"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/8298\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/8428"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=8298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=8298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=8298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}