Cyberithub

How to Install Liquibase on Ubuntu or Debian Linux

Advertisements

In this article, we will see how to install liquibase on Ubuntu or Debian based linux systems. Liquibase is a popular database schema change management tool that not only enable us to version control database schema changes but also allows us to automate the process of applying database changes to reduce the risk of human error. It comes with both free as well as enterprise version. Liquibase basically runs six types of commands on databases - update, rollback, snapshot, diff, status and utility commands.

Liquibase can be easily integrated with CI/CD pipelines, thus helps in automating the process of applying database changes. It can also compare database schemas and produce a change logs to keep them in sync. Change logs are nothing but a list of changes such as instruction for creating tables, adding columns, inserting data etc. to the database schema defined in XML, YAML, JSON, or SQL files. Liquibase supports almost all the popular databases such as MySQL, PostgreSQL, Oracle, SQL Server and so on. More on liquibase official website.

 

How to Install Liquibase on Ubuntu or Debian Linux 2

How to Install Liquibase on Ubuntu or Debian Linux

Also Read: How to Install Lens Desktop on Ubuntu or Debian

Step 1: Prerequisites

a) You would require a proper functioning Ubuntu or Debian Linux System. In our case, we are using Ubuntu 22.04 LTS system for demonstration.

b) You would require root or root like access to run some of the privileged commands.

c) Few of the utilities such as gpg and wget are required to be installed in System.

d) Liquibase would require Java to be preinstalled in the system.

e) Minimum Hardware Requirements:-

  • CPU: A modern multi-core processor (e.g., Intel Core i3 or equivalent).
  • RAM: The amount of memory required would depend upon the size and complexity of database but in any case at least 2 GB of RAM must be available.
  • Hard Disk: At least 100 MB of free disk space for the Liquibase binaries and temporary files. Additional disk space will be needed for your database and any change logs you maintain.

 

Step 2: Update Your Server

Before installing a new package, let's update package index cache with all the latest available packages information and then upgrade all the installed packages to the latest version by using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade

 

Step 3: Import GPG Key & Add Repo

You can visit official website and get the latest step to import GPG Key and add liquibase repo in repo list to download liquibase package.

cyberithub@ubuntu:~$ wget -O- https://repo.liquibase.com/liquibase.asc | gpg --dearmor > liquibase-keyring.gpg && \
cat liquibase-keyring.gpg | sudo tee /usr/share/keyrings/liquibase-keyring.gpg > /dev/null && \
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/liquibase-keyring.gpg] https://repo.liquibase.com stable main' | sudo tee /etc/apt/sources.list.d/liquibase.list
--2024-05-22 23:13:33-- https://repo.liquibase.com/liquibase.asc
Resolving repo.liquibase.com (repo.liquibase.com)... 13.33.187.42, 13.33.187.112, 13.33.187.79, ...
Connecting to repo.liquibase.com (repo.liquibase.com)|13.33.187.42|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2440 (2.4K) [binary/octet-stream]
Saving to: ‘STDOUT’

- 100%[============================================================================>] 2.38K --.-KB/s in 0s

2024-05-22 23:13:35 (135 MB/s) - written to stdout [2440/2440]

[sudo] password for cyberithub:
deb [arch=amd64 signed-by=/usr/share/keyrings/liquibase-keyring.gpg] https://repo.liquibase.com stable main

 

Step 4: Update Package Lists

To update package index with all the packages information from all the configured repo, run sudo apt update command as shown below. This will help update the package index cache with all the new information available.

cyberithub@ubuntu:~$ sudo apt update
[sudo] password for cyberithub:
Hit:1 https://downloads.k8slens.dev/apt/debian stable InRelease
Hit:2 https://dl.google.com/linux/chrome/deb stable InRelease
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:4 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Get:5 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:6 https://repo.liquibase.com stable InRelease [3,054 B]
Hit:7 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:8 https://repo.liquibase.com stable/main all Packages [5,094 B]
Get:9 https://repo.liquibase.com stable/main amd64 Packages [5,097 B]
Fetched 242 kB in 3s (80.4 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

 

Step 5: Install Liquibase

Now its time to install liquibase package from liquibase repo using sudo apt install liquibase command as shown below. This will download and install the package along with all its dependencies.

cyberithub@ubuntu:~$ sudo apt install liquibase
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
liquibase
0 upgraded, 1 newly installed, 0 to remove and 17 not upgraded.
Need to get 108 MB of archives.
After this operation, 119 MB of additional disk space will be used.
Get:1 https://repo.liquibase.com stable/main amd64 liquibase all 4.28.0 [108 MB]
Fetched 108 MB in 16min 29s (109 kB/s)
Selecting previously unselected package liquibase.
(Reading database ... 238305 files and directories currently installed.)
Preparing to unpack .../liquibase_4.28.0_all.deb ...
Unpacking liquibase (4.28.0) ...
Setting up liquibase (4.28.0) ...

 

Step 6: Check Version

After successful installation, you can check the current installed version by using liquibase --version command as shown below.

cyberithub@ubuntu:~$ liquibase --version
####################################################
##  _     _             _ _                       ##
## | |   (_)           (_) |                      ##
## | |    _  __ _ _ _   _| |__   __ _ ___  ___    ##
## | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \   ##
## | |___| | (_| | |_| | | |_) | (_| \__ \  __/   ##
## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|   ##
##             | |                                ##
##             |_|                                ##
##                                                ##
## Get documentation at docs.liquibase.com        ##
## Get certified courses at learn.liquibase.com   ##
##                                                ##
####################################################
Starting Liquibase at 02:08:41 (version 4.28.0 #2272 built at 2024-05-16 19:00+0000)
Liquibase Home: /usr/bin
Java Home /usr/lib/jvm/java-21-openjdk-amd64 (Version 21.0.2)
Libraries:
- internal/lib/commons-collections4.jar: Apache Commons Collections 4.4.0 By The Apache Software Foundation
- internal/lib/commons-io.jar: Apache Commons IO 2.16.1 By The Apache Software Foundation
- internal/lib/commons-lang3.jar: Apache Commons Lang 3.14.0 By The Apache Software Foundation
- internal/lib/commons-text.jar: Apache Commons Text 1.11.0 By The Apache Software Foundation
- internal/lib/h2.jar: H2 Database Engine 2.2.224 By H2 Group
- internal/lib/hsqldb.jar: HSQLDB 2.7.2 By The HSQL Development Group
- internal/lib/jaxb-api.jar: jaxb-api 2.3.1 By Oracle Corporation
- internal/lib/jaxb-core.jar: JAXB Core 4.0.5 By Eclipse Foundation
- internal/lib/jaxb-runtime.jar: JAXB Runtime 4.0.5 By Eclipse Foundation
- internal/lib/jaybird.jar: Jaybird 5.0.4.java8 (build: variant=jaybird tag=v5.0.4 date=202403101439) By Firebird project
- internal/lib/jcc.jar: IBM JCC JDBC 4 Driver 1.4.0 By IBM
- internal/lib/liquibase-commercial.jar: Commercial Liquibase Functionality 4.28.0 By Liquibase
- internal/lib/mariadb-java-client.jar: mariadb-java-client 3.3.3 By mariadb.com
- internal/lib/mssql-jdbc.jar: Microsoft JDBC Driver for SQL Server 12.6.1 By Microsoft Corporation
- internal/lib/ojdbc8.jar: JDBC 19.22.0.0.0 By Oracle Corporation
- internal/lib/opencsv.jar: opencsv 5.9.0
- internal/lib/picocli.jar: picocli 4.7.5 By Remko Popma
- internal/lib/postgresql.jar: PostgreSQL JDBC Driver 42.7.3 By PostgreSQL Global Development Group
- internal/lib/snakeyaml.jar: SnakeYAML 2.2.0
- internal/lib/snowflake-jdbc.jar: snowflake-jdbc 3.16.0
- internal/lib/sqlite-jdbc.jar: SQLite JDBC 3.45.3.0


Liquibase Version: 4.28.0
Liquibase Open Source 4.28.0 by Liquibase

 

Step 7: Check all available options

To check all the options available with liquibase utility, run liquibase --help command as shown below.

cyberithub@ubuntu:~$ liquibase --help

 

Step 8: Uninstall Liquibase

Once you are done using liquibase, you can also choose to uninstall it from your system by using sudo apt remove liquibase command as shown below. To remove all dependencies along with the package, use --auto-remove option with below command.

cyberithub@ubuntu:~$ sudo apt remove liquibase
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
liquibase
0 upgraded, 0 newly installed, 1 to remove and 17 not upgraded.
After this operation, 119 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 239566 files and directories currently installed.)
Removing liquibase (4.28.0) ...

Leave a Comment