{"id":169,"date":"2020-04-09T04:06:45","date_gmt":"2020-04-09T04:06:45","guid":{"rendered":"http:\/\/www.jameseduard.com\/?p=169"},"modified":"2020-04-09T04:06:45","modified_gmt":"2020-04-09T04:06:45","slug":"how-to-install-grafana-on-centos-7-8","status":"publish","type":"post","link":"https:\/\/www.jameseduard.com\/?p=169","title":{"rendered":"How to Install Grafana on CentOS 7\/8"},"content":{"rendered":"<p>[vc_row][vc_column][vc_column_text]In this article will guide you on how to install grafana one of the most popular opensource dashboard monitoring tools, grafana has been used to monitor different variety of data source.<\/p>\n<p>Run the following command with sudo proviledge.<br \/>\n[simterm]<br \/>\n$ sudo -l<br \/>\n[\/simterm]<\/p>\n<p>2. Install and update the newest RPM packages available on CentOS with yum<br \/>\n[simterm]<br \/>\n$ sudo yum update<br \/>\n[\/simterm]<\/p>\n<p>This step may take a couple of minutes if you haven\u2019t updated your packages for a long time.<\/p>\n<p>3. Add the Grafana repositories to your local YUM repository, create a new file name \u201cgrafana.repo\u201d and paste the following content below.<\/p>\n<p>[simterm]<br \/>\n$ sudo nano \/etc\/yum.repos.d\/grafana.repo<br \/>\n[\/simterm]<\/p>\n<p>&nbsp;<\/p>\n<p>[simterm]<br \/>\n<code><\/code><\/p>\n<pre class=\"wp-block-code\"><code>[grafana]\nname=grafana\nbaseurl=https:\/\/packages.grafana.com\/oss\/rpm\nrepo_gpgcheck=1\nenabled=1\ngpgcheck=1\ngpgkey=https:\/\/packages.grafana.com\/gpg.key\nsslverify=1\nsslcacert=\/etc\/pki\/tls\/certs\/ca-bundle.crt<\/code><\/pre>\n<p><code>\u00a0<\/code><\/p>\n<p><code>[\/simterm]<\/code>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]4. You can now install Grafana with YUM since we added already on repositories<br \/>\nTo install Grafana with YUM, run the following command.<br \/>\n[simterm]<br \/>\n$ sudo yum install grafana<br \/>\n[\/simterm]<\/p>\n<p>Result:<br \/>\n[simterm]<br \/>\nLast metadata expiration check: 0:00:18 ago on Fri 17 Apr 2020 02:03:08 AM PST.<br \/>\nDependencies resolved.<br \/>\n==============================================================================================================================================================================================================<br \/>\nPackage Architecture Version Repository Size<br \/>\n==============================================================================================================================================================================================================<br \/>\nInstalling:<br \/>\ngrafana x86_64 6.7.2-1 grafana 61 M<\/p>\n<p>Transaction Summary<br \/>\n==============================================================================================================================================================================================================<br \/>\nInstall 1 Package<\/p>\n<p>Total download size: 61 M<br \/>\nInstalled size: 176 M<br \/>\nIs this ok [y\/N]: y<br \/>\nDownloading Packages:<br \/>\ngrafana-6.7.2-1.x86_64.rpm 2.2 MB\/s | 61 MB 00:27<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nTotal 2.2 MB\/s | 61 MB 00:27<br \/>\nwarning: \/var\/cache\/dnf\/grafana-13e251e56a0c8862\/packages\/grafana-6.7.2-1.x86_64.rpm: Header V4 RSA\/SHA512 Signature, key ID 24098cb6: NOKEY<br \/>\ngrafana 2.0 kB\/s | 1.7 kB 00:00<br \/>\nImporting GPG key 0x24098CB6:<br \/>\nUserid : &#8220;Grafana &lt;info@grafana.com&gt;&#8221;<br \/>\nFingerprint: 4E40 DDF6 D76E 284A 4A67 80E4 8C8C 34C5 2409 8CB6<br \/>\nFrom : https:\/\/packages.grafana.com\/gpg.key<br \/>\nIs this ok [y\/N]: y<br \/>\nKey imported successfully<br \/>\nRunning transaction check<br \/>\nTransaction check succeeded.<br \/>\nRunning transaction test<br \/>\nTransaction test succeeded.<br \/>\nRunning transaction<br \/>\nPreparing : 1\/1<br \/>\nInstalling : grafana-6.7.2-1.x86_64 1\/1<br \/>\nRunning scriptlet: grafana-6.7.2-1.x86_64 1\/1<br \/>\n### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd<br \/>\nsudo \/bin\/systemctl daemon-reload<br \/>\nsudo \/bin\/systemctl enable grafana-server.service<br \/>\n### You can start grafana-server by executing<br \/>\nsudo \/bin\/systemctl start grafana-server.service<\/p>\n<p>POSTTRANS: Running script<\/p>\n<p>Verifying : grafana-6.7.2-1.x86_64 1\/1<\/p>\n<p>Installed:<br \/>\ngrafana-6.7.2-1.x86_64<\/p>\n<p>Complete!<\/p>\n<p>[\/simterm][\/vc_column_text][vc_column_text]Save and update your repositories.<br \/>\n[simterm]<br \/>\n$ sudo yum update<\/p>\n<p>grafana 304 B\/s | 488 B 00:01<br \/>\ngrafana 2.3 kB\/s | 1.7 kB 00:00<br \/>\nImporting GPG key 0x24098CB6:<br \/>\nUserid : &#8220;Grafana &lt;info@grafana.com&gt;&#8221;<br \/>\nFingerprint: 4E40 DDF6 D76E 284A 4A67 80E4 8C8C 34C5 2409 8CB6<br \/>\nFrom : https:\/\/packages.grafana.com\/gpg.key<br \/>\nIs this ok [y\/N]: y<br \/>\ngrafana 559 kB\/s | 2.5 MB 00:04<br \/>\nLast metadata expiration check: 0:00:02 ago on Fri 17 Apr 2020 02:03:08 AM PST.<br \/>\nDependencies resolved.<br \/>\nNothing to do.<br \/>\nComplete!<br \/>\n[\/simterm][\/vc_column_text][vc_column_text]By default, Grafana created a systemd service you can verify if the service is running with the following command.<br \/>\n[simterm]<br \/>\n$ cat \/usr\/lib\/systemd\/system\/grafana-server.service<br \/>\n[\/simterm]<\/p>\n<p>Result:<br \/>\n[simterm]<br \/>\n[Unit]<br \/>\nDescription=Grafana instance<br \/>\nDocumentation=http:\/\/docs.grafana.org<br \/>\nWants=network-online.target<br \/>\nAfter=network-online.target<br \/>\nAfter=postgresql.service mariadb.service mysqld.service<\/p>\n<p>[Service]<br \/>\nEnvironmentFile=\/etc\/sysconfig\/grafana-server<br \/>\nUser=grafana<br \/>\nGroup=grafana<br \/>\nType=notify<br \/>\nRestart=on-failure<br \/>\nWorkingDirectory=\/usr\/share\/grafana<br \/>\nRuntimeDirectory=grafana<br \/>\nRuntimeDirectoryMode=0750<br \/>\nExecStart=\/usr\/sbin\/grafana-server \\<br \/>\n&#8211;config=${CONF_FILE} \\<br \/>\n&#8211;pidfile=${PID_FILE_DIR}\/grafana-server.pid \\<br \/>\n&#8211;packaging=rpm \\<br \/>\ncfg:default.paths.logs=${LOG_DIR} \\<br \/>\ncfg:default.paths.data=${DATA_DIR} \\<br \/>\ncfg:default.paths.plugins=${PLUGINS_DIR} \\<br \/>\ncfg:default.paths.provisioning=${PROVISIONING_CFG_DIR}<\/p>\n<p>LimitNOFILE=10000<br \/>\nTimeoutStopSec=20<\/p>\n<p>[Install]<br \/>\nWantedBy=multi-user.target<br \/>\n[\/simterm][\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]5. Start the grafana-server service and check status with the following commands.<\/p>\n<p>[simterm]<br \/>\n$ sudo systemctl start grafana-server<br \/>\n$ sudo systemctl status grafana-server<br \/>\n[\/simterm]<\/p>\n<p>[simterm]<br \/>\n\u25cf grafana-server.service &#8211; Grafana instance<br \/>\nLoaded: loaded (\/usr\/lib\/systemd\/system\/grafana-server.service; disabled; vendor preset: disabled)<br \/>\nActive: active (running) since Fri 2020-04-17 02:32:33 PST; 6s ago<br \/>\nDocs: http:\/\/docs.grafana.org<br \/>\nMain PID: 28936 (grafana-server)<br \/>\nTasks: 18 (limit: 26213)<br \/>\nMemory: 23.3M<br \/>\nCGroup: \/system.slice\/grafana-server.service<br \/>\n\u2514\u250028936 \/usr\/sbin\/grafana-server &#8211;config=\/etc\/grafana\/grafana.ini &#8211;pidfile=\/var\/run\/grafana\/grafana-server.pid &#8211;packaging=rpm cfg:default.paths.logs=\/var\/log\/grafana cfg:default.paths.data=\/v&gt;<\/p>\n<p>Apr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Initializing TracingService&#8221; logger=server<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Initializing UsageStatsService&#8221; logger=server<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Initializing CleanUpService&#8221; logger=server<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Initializing NotificationService&#8221; logger=server<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Initializing provisioningServiceImpl&#8221; logger=server<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Backend rendering via phantomJS&#8221; logger=rendering renderer=phantomJS<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=warn msg=&#8221;phantomJS is deprecated and will be removed in a future release. You should consider migrating from phantomJS &gt;<br \/>\nApr 17 02:32:33 192.168.75.139 systemd[1]: Started Grafana instance.<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;Initializing Stream Manager&#8221;<br \/>\nApr 17 02:32:33 192.168.75.139 grafana-server[28936]: t=2020-04-17T02:32:33+0800 lvl=info msg=&#8221;HTTP Server Listen&#8221; logger=http.server address=[::]:3000 protocol=http subUrl= socket=<\/p>\n<p>[\/simterm]<\/p>\n<p>Awesome your Grafana server is now up and running.[\/vc_column_text][vc_column_text]6. Allow or open the Grafana services on port 3000 via TCP on your server, by adding new firewall rules<br \/>\nGrafana uses the port 3000 for Web Administration so we can access the grafana on local network.<\/p>\n<p>To open the port 3000 on CentOS 8, run this command<br \/>\n[simterm]<br \/>\n$ sudo firewall-cmd &#8211;add-port=3000\/tcp &#8211;permanent<br \/>\nsuccess<br \/>\n[\/simterm]<br \/>\n[simterm]<br \/>\n$ sudo firewall-cmd &#8211;reload<br \/>\nsuccess<br \/>\n[\/simterm]<\/p>\n<p>Verify the firewall configuration is correctly set.<br \/>\n[simterm]<br \/>\n$ sudo firewall-cmd &#8211;list-all | grep ports<br \/>\nports: 3000\/tcp<br \/>\nforward-ports:<br \/>\nsource-ports:<br \/>\n[\/simterm]<br \/>\n[\/vc_column_text][vc_column_text]7. Launch Grafana Web UI, navigate to http:\/\/localhost:3000 or the http:\/\/server-ip:3000 with your web browser withe port 3000,the default port for Grafana is 3000.<\/p>\n<p>Note:<br \/>\nThe default login for Grafana is <strong>\u2018admin\u2019<\/strong> and the default password is also <strong>\u2018admin\u2019<\/strong> and after you login the grafana dashboard asked you to update your password.<br \/>\n<code><br \/>\nChange Password<br \/>\nBefore you can get started with awesome dashboards we need you to make your account more secure by changing your password.<br \/>\nYou can change your password again later.<br \/>\n<\/code><br \/>\n<img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-3225\" src=\"http:\/\/www.jameseduard.com\/wp-content\/uploads\/2020\/04\/grafana-web-gui-login-300x133.png\" alt=\"\" width=\"1056\" height=\"468\" \/><\/p>\n<p>You should be able to see the default dashboard on Grafana.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-3226\" src=\"http:\/\/www.jameseduard.com\/wp-content\/uploads\/2020\/04\/grafana-web-gui-dashboard-300x168.png\" alt=\"\" width=\"1055\" height=\"591\" \/>[\/vc_column_text][vc_column_text]8. Disable new user registrations in order to prevent other user to register and access your grafana serverm you can disable user registration.<br \/>\nNote:<br \/>\nUser registration can be access at http:\/\/localhost:3000\/signup \/ http:\/\/server-ip:3000\/signup<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-3229\" src=\"http:\/\/www.jameseduard.com\/wp-content\/uploads\/2020\/04\/grafana-signup-300x142.png\" alt=\"\" width=\"845\" height=\"400\" \/>[\/vc_column_text][vc_column_text]To disable user registration, head back to your configuration file, and disable the following section.<br \/>\n[simterm]<br \/>\n$ sudo nano \/etc\/grafana\/grafana.ini<\/p>\n<p>[users]<br \/>\n# disable user signup \/ registration<br \/>\n;allow_sign_up = true<\/p>\n<p># Allow non admin users to create organizations<br \/>\n;allow_org_create = true<\/p>\n<p># Set to true to automatically assign new users to the default organization (id 1)<br \/>\n;auto_assign_org = true<br \/>\n[\/simterm]<\/p>\n<p>Change the allow_sign_up setting to false, and restart your Grafana server.<br \/>\n[simterm]<br \/>\n;allow_sign_up = false<br \/>\n[\/simterm]<br \/>\n[simterm]<br \/>\n$ sudo systemctl restart grafana-server<br \/>\n[\/simter]<br \/>\n[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[vc_row][vc_column][vc_column_text]In this article will guide you on how to install grafana one of the most popular opensource dashboard monitoring tools, grafana has been used to monitor different variety of data source. Run the following command with sudo proviledge. [simterm] $ sudo -l [\/simterm] 2. Install and update the newest RPM packages available on CentOS with<\/p>\n","protected":false},"author":1,"featured_media":204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[155,156,4],"class_list":["post-169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-grafana","tag-centos-8","tag-grafana","tag-monitoring"],"_links":{"self":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts\/169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169"}],"version-history":[{"count":0,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=\/wp\/v2\/posts\/169\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jameseduard.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}