How To Install alembic on Debian 11

In this tutorial we learn how to install alembic on Debian 11. alembic is lightweight database migration tool for SQLAlchemy

Introduction

In this tutorial we learn how to install alembic on Debian 11.

What is alembic

alembic is:

Alembic is a new database migration tool, written by the author of SQLAlchemy. A migration tool offers the following functionality:

  • Can emit ALTER statements to a database in order to change the structure of tables and other constructs
  • Provides a system whereby “migration scripts” may be constructed; each script indicates a particular series of steps that can “upgrade” a target database to a new version, and optionally a series of steps that can “downgrade” similarly, doing the same steps in reverse.
  • Allows the scripts to execute in some sequential manner.

This package provides /usr/bin/alembic script and documentation for Alembic, and depends on the python3-alembic package which contains all the actual code (in Python 3) for Alembic to actually work.

There are three methods to install alembic on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install alembic Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install alembic using apt-get by running the following command:

sudo apt-get -y install alembic

Install alembic Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install alembic using apt by running the following command:

sudo apt -y install alembic

Install alembic Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install alembic using aptitude by running the following command:

sudo aptitude -y install alembic

How To Uninstall alembic on Debian 11

To uninstall only the alembic package we can use the following command:

sudo apt-get remove alembic

Uninstall alembic And Its Dependencies

To uninstall alembic and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove alembic

Remove alembic Configurations and Data

To remove alembic configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge alembic

Remove alembic configuration, data, and all of its dependencies

We can use the following command to remove alembic configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge alembic

Dependencies

alembic have the following dependencies:

References

Summary

In this tutorial we learn how to install alembic package on Debian 11 using different package management tools: apt, apt-get and aptitude.