Metabase is a free and open source GUI-based query tool. It integrates with almost all types of databases and provides a very simple GUI to run queries on the database. Metabase lets you easily filter and group the data to find something without writing the SQL query. The application lets you visualize the data into beautiful charts and graphs.
In this tutorial, we will install Metabase on CentOS 7 server.
Metabase requires at least 1GB of RAM. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Metabase runs on both OpenJDK and Oracle JAVA. In this tutorial, we will install the latest version of Oracle Java into the server. Run the following commands to do so.
To start the application immediately you can run the following command.
java -jar metabase.jar
But it is recommended to create a systemd service to run Metabase jar file and create a reverse proxy with Apache or nginx for accessing the application on port 80. Using systemd service will automatically start the application on failures and boot time.
Move the Metabase jar file to another location using the following command.
mv metabase.jar /var/metabase.jar
To create a systemd service, create a new systemd service file using the following command.
Now add the following lines into the text file.
Save the above text into the Systemd service file. You can now run the Metabase server directly using the following command.
systemctl start metabase
To enable the application to start automatically at boot time, run the following command.
systemctl enable metabase
To check the status of the service, run the following command.
systemctl status metabase
You will likely see the following output.
[root@liptan-pc ~]# systemctl status metabase
● metabase.service - Metabase server
Loaded: loaded (/etc/systemd/system/metabase.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2017-04-09 19:59:32 UTC; 8h ago
Main PID: 18283 (java)
└─18283 /bin/java -jar /var/metabase.jar
Apr 09 20:01:44 ip-172-31-10-224 metabase: 04-09 20:01:44 INFO sync-database.analyze :: Analyzing data in H2...) ...
Instead of using the application on Port 3000, you can use nginx to run on port 80 or 443 in the case of using SSL. This way the main application will run on port 3000, and nginx will work as a reverse proxy. Nginx is not available in the default YUM repository, hence you will need to install EPEL repository also.
yum -y install epel-releaseyum -y update
Install nginx web server the following command.
yum -y install nginx
Now we will need to generate SSL certificates from Let's Encrypt client. If you can want to use commercial SSL certificates instead, you can purchase SSL certificates from HostPresto.
To install Let's Encrypt client also called Certbot run the following command.
yum -y install certbot
Once the installation finishes, run the following command to obtain the SSL certificates from Let's Encrypt. Make sure that your domain is pointed to the server, the Let's Encrypt will check the domain authority before providing the certificates. Make sure that you do not have nginx running at this moment.
This command will run Let's Encrypt client to obtain the certificates only but will not install it. --standalone tells the client to use the standalone web server for authentication of domain authority. -d yourdomain.com tells the domain name for which the certificates needs to be obtained. Provide your email address and accept the terms and condition. Once the certificates are generated, they are likely to be stored in the following directory.
Where yourdomain.com is your actual domain. In the directory, you will find cert.pem which is your domains certificate and privkey.pem which is your certificate's private key.
Let's Encrypt SSL expires in 90 days, so it is recommended to set an automatic renewal for your certificates. Run the following command to open your crontab file.
In the above configuration change yourdomain.com to your actual domain. Also, make sure that the path to your SSL certificate and private key are correct. Now start nginx web server and enable it to automatically start at boot time using the following commands.
systemctl start nginxsystemctl enable nginx
Now you will need to disable your SELinux because Proxy configuration does not work with SELinux policies. To temporarily disable SELinux without restarting the server, run the following command.
To completely disable the SELinux you will need to edit the /etc/selinux/config file.
Find the following line:
Change it to:
Now you will need to reboot your server so that the new configuration can take effect. Now you can start the Metabase service if not started already using the following command.
systemctl start metabase
You can now browse the following URL in your favorite browser.
Provide your details and click Next. You will be asked to add a database now. You can add the database now or, you can choose to skip this step. Metabase comes with few sample database on which you can run your queries to test the application.
Finally, you will be taken to your Metabase dashboard, which will look like shown below.
Looking for the right web hosting solution for your website can be an intimidating task. Options nowadays are more diversified than ever, and each year brings new developments in the web hosting market. If you have no clue of what to look out for, you can find yourself overwhelmed with...
Content marketing continues to be one of the most valuable tools for today’s online businesses. With content, you can improve your chances of reaching your target audience, boost your search engine standing, and even unlock new opportunities for sales. The more content you produce, the more you can strengthen your...
User Experience (UX) is one of the most crucial factors to consider in web design. As the number of websites and applications in the world today continues to accelerate, businesses are under more pressure than ever to impress customers straight away. If a user visits your website and finds slow-loading...