How to install database versioning and automated database deployments tool - Liquibase?
I never found an easy and straightforward way for configuring and installing Liquibase. After a lot of trial and errors, I finally decided to write this to save a fellow programmer’s time.
This quick post will walk us through installing automated database deployments tool Liquibase on Mac for PostgreSQL. Rest assured, the similar steps can be followed for any OS — either client or server. The same installation can be used for a stand-alone machine or Jenkins server. Without wasting any time further — let’s quickly dive into the installation.
Step 1: Install and extract Liquibase
Go to http://download.liquibase.org/download/?frm=y to download the Liquibase binaries. Extract the binaries to a location of your choice. I have extracted to ~/Applications
Step 2: Install Java JDK
Just Google this yourself :
how to install Java JDK on <OS name here>
to follow the steps as JDK installation is out of scope for this post. Check the installation on your machine. Different OS has different ways of verification. For my Mac — it was javac -version
Step 3: Install your database’s JDBC driver
I’m focusing on PostgreSQL database so the JDBC driver for my case is available at https://jdbc.postgresql.org/download.html for download.
Once the driver is installed — it needs to be placed in the lib folder of the extracted Liquibase binaries downloaded in step 1.
For other databases, the corresponding JDBC database drivers need to be installed.
If you don’t understand what I mean — just Google this:
how to install JDBC driver for <your database name here> on <OS name here>
Follow the steps given there as JDBC driver installation is out of scope for this post.
Step 4: Make Liquibase accessible across OS by setting Path variable
For Windows, we need to set up the Path environment variable to the path of Liquibase binaries.
For Mac and Linux the following needs to be added to bash_profile as of now:
export PATH=<path to liquibase binaries>/:$PATH
Setting up path variables is not the topic of this post — please Google and follow the steps:
how to set path variable in <OS name here>
Once all the above steps are followed, the Liquibase setup is done.
In the next post, we will learn about how to configure Liquibase to automate database deployments.