Grafana Installation
From r00tedvw.com wiki
(Difference between revisions)
(→Configure Grafana) |
|||
(3 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Grafana_Installation|Ubuntu Installation]] | [[Grafana_Installation\OracleLinux|OracleLinux Installation]] | ||
+ | |||
+ | =Ubuntu 14.04 Installation= | ||
==Add Repository== | ==Add Repository== | ||
<nowiki>echo 'deb https://packagecloud.io/grafana/stable/debian/ wheezy main' | sudo tee -a /etc/apt/sources.list</nowiki> | <nowiki>echo 'deb https://packagecloud.io/grafana/stable/debian/ wheezy main' | sudo tee -a /etc/apt/sources.list</nowiki> | ||
Line 49: | Line 52: | ||
secret_key = somelongrandomstringkey | secret_key = somelongrandomstringkey | ||
</nowiki> | </nowiki> | ||
+ | |||
+ | ==Configure Apache2== | ||
+ | ===Enable proxy modules=== | ||
+ | <nowiki>~$ sudo a2enmod proxy proxy_http xml2enc</nowiki> | ||
+ | ===Create apache site config=== | ||
+ | Edit <code> /etc/apache2/sites-available/granfana.conf</code> or whatever you name the conf file. | ||
+ | <nowiki>~$ sudo vi /etc/apache2/sites-available/granfana.conf | ||
+ | <VirtualHost *:80> | ||
+ | ProxyPreserveHost On | ||
+ | ProxyPass / http://127.0.0.1:3000/ | ||
+ | ProxyPassReverse / http://127.0.0.1:3000/ | ||
+ | ServerName grafana.domain.com | ||
+ | </VirtualHost></nowiki> | ||
+ | ===Enable site=== | ||
+ | <nowiki>~$ sudo a2ensite grafana.conf</nowiki> | ||
+ | ==Start Grafana== | ||
+ | <nowiki>~$ sudo update-rc.d grafana-server defaults 95 10 | ||
+ | ~$ sudo service grafana-server start</nowiki> | ||
+ | ==Restart Apache== | ||
+ | <nowiki>~$ sudo service apache2 restart</nowiki> | ||
+ | ==Login== | ||
+ | You should now be able to go to the site and log in.<br \> | ||
+ | '''NOTE:''' Don't forget to setup your DNS! <br \> | ||
+ | The default user/pass was admin:admin. I tried changing this in the grafana.ini config file, but it didn't work, so I just logged in with the default and changed it through the web portal. |
Latest revision as of 09:56, 21 September 2016
Ubuntu Installation | OracleLinux Installation
Contents |
[edit] Ubuntu 14.04 Installation
[edit] Add Repository
echo 'deb https://packagecloud.io/grafana/stable/debian/ wheezy main' | sudo tee -a /etc/apt/sources.list
[edit] Add Key
curl https://packagecloud.io/gpg.key | sudo apt-key add -
[edit] Install Grafana, MySQL, Apache
sudo apt-get update && sudo apt-get install grafana mysql-server apache2 -y
Note: Remember to document the MySQL root password.
[edit] Setup MySQL
~$ mysql -u root -p ~$ mysql> CREATE USER 'grafana'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED'; ~$ mysql> CREATE DATABASE grafanadatabase; ~$ mysql> GRANT ALL PRIVILEGES ON grafana.* TO 'grafana'@'localhost' IDENTIFIED BY 'grafanauserpassword' WITH GRANT OPTION; ~$ mysql> exit
verify permissions have been granted
~$ mysql -u grafana -p ~$ mysql> SHOW GRANTS; +---------------------------------------------------------------------------------------------------------------+ | Grants for grafana@localhost | +---------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'grafana'@'localhost' IDENTIFIED BY PASSWORD '*2K21458K438UYE85A38B9Y7Y78DAEBF4T8689YK4' | | GRANT ALL PRIVILEGES ON `grafanadatabase`.* TO 'grafana'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
[edit] Configure Grafana
Edit /etc/grafana/grafana.ini
and fill in the nessesary components.
~$ sudo vi /etc/grafana/grafana.ini [database] [database] # Either "mysql", "postgres" or "sqlite3", it's your choice type = mysql host = 127.0.0.1:3306 name = grafanadatabase user = grafana password = grafanauserpassword [server] protocol = http http_addr = 127.0.0.1 http_port = 3000 domain = grafana.domain.com enforce_domain = true root_url = %(protocol)s://%(domain)s/ [security] admin_user = admin admin_password = SecureAdminPass secret_key = somelongrandomstringkey
[edit] Configure Apache2
[edit] Enable proxy modules
~$ sudo a2enmod proxy proxy_http xml2enc
[edit] Create apache site config
Edit /etc/apache2/sites-available/granfana.conf
or whatever you name the conf file.
~$ sudo vi /etc/apache2/sites-available/granfana.conf <VirtualHost *:80> ProxyPreserveHost On ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/ ServerName grafana.domain.com </VirtualHost>
[edit] Enable site
~$ sudo a2ensite grafana.conf
[edit] Start Grafana
~$ sudo update-rc.d grafana-server defaults 95 10 ~$ sudo service grafana-server start
[edit] Restart Apache
~$ sudo service apache2 restart
[edit] Login
You should now be able to go to the site and log in.
NOTE: Don't forget to setup your DNS!
The default user/pass was admin:admin. I tried changing this in the grafana.ini config file, but it didn't work, so I just logged in with the default and changed it through the web portal.