2.4. Upgrading

In any case before upgrading a major version read the document READ_BEFORE_UPDATE which is continuously updated in the Github repository. Note, that when you are upgrading over several major versions, read all the comments for all versions.

If you installed privacyIDEA via DEB or RPM repository you can use the normal system ways of apt-get, aptitude and yum to upgrade privacyIDEA to the current version.

If you want to upgrade an old Ubuntu installation from privacyIDEA 2.23 to privacyIDEA 3.0, please read the Note on legacy upgrades.

2.4.1. Different upgrade processes

Depending on the way privacyIDEA was installed, there are different recommended update procedures. The following section describes the process for pip installations. Instructions for packaged versions on RHEL and Ubuntu are found in Upgrading a packaged installation.

2.4.1.1. Upgrading a pip installation

If you install privacyIDEA into a python virtualenv like /opt/privacyidea, you can follow this basic upgrade process.

First you might want to backup your program directory:

tar -zcf privacyidea-old.tgz /opt/privacyidea

and your database:

source /opt/privacyidea/bin/activate
pi-manage backup create

2.4.1.1.1. Running upgrade

Starting with version 2.17 the script privacyidea-pip-update performs the update of the python virtualenv and the DB schema.

Just enter your python virtualenv (you already did so, when running the backup) and run the command:

privacyidea-pip-update

The script refuses to run outside of an activated virtual environment. It upgrades the privacyidea package and its pinned dependencies and then runs privacyidea-schema-upgrade.

The following parameters are allowed:

-f or --force skips the confirmation question. The schema update still runs, unless you also pass -n.

-s or --skipstamp skips the version stamping during schema update.

-n or --noschema completely skips the schema update and only updates the code.

2.4.1.1.2. Manual upgrade

Now you can upgrade the installation:

source /opt/privacyidea/bin/activate
pip install --upgrade privacyidea

Usually you will need to upgrade/migrate the database:

privacyidea-schema-upgrade

Note

Changed in version v3.12: The migration directory is detected automatically.

If the migration directory is not found, e.g. in an editable installation, pass it with -d:

privacyidea-schema-upgrade -d /opt/privacyidea/lib/python3.X/site-packages/privacyidea/migrations

privacyidea-schema-upgrade does not accept the directory without -d. -s skips stamping a database that has no version stamp yet.

Now you need to restart your webserver for the new code to take effect.

Note

If you have enabled the optional Redis cache, authentications that were already in flight at the moment of the restart may need to be started over by the user. The Redis cache is opt-in and does not affect the schema upgrade itself; see redis_cache_upgrades for the payload-compatibility policy and what to expect when a release changes the on-the-wire format.

2.4.1.2. Upgrading a packaged installation

In general, the upgrade of a packaged version of privacyIDEA should be done using the default tools (e.g. apt and yum). In any case, read the READ_BEFORE_UPDATE file. It is also a good idea to backup your system before upgrading.

2.4.1.2.1. Ubuntu upgrade

If you use the Ubuntu packages in a default setup, the upgrade can should be done using:

apt update
apt dist-upgrade

Note

In case you upgrade from the old privacyIDEA 2.23.x to the version 3.x you have to change from your ppa sources to the new repositories. If you are upgrading your Ubuntu release, e.g. from 14.04 to 16.04 the principal steps are

  • Bring your Ubuntu 14.04 system up-to-date

  • Run the release upgrade (do-release-upgrade)

  • Eventually remove old repositories and add recent repositories as described in Add repository.

  • Reinstall/Upgrade privacyIDEA 3.x

privacyIDEA 2.x installed the python packages to the system directly. The packages in the repository instead come with a virtual python environment. This may cause lots of obsolete packages after upgrading which may be removed with:

apt autoremove

2.4.1.2.2. CentOS upgrade

For a Red Hat Enterprise Linux (RHEL) installation run:

yum update

to upgrade.