We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Install LinOTP on an Ubuntu VPS

PostedAugust 13, 2013 9.1k views Security Ubuntu


LinOTP is a two-factor authentication solution to manage devices that require enhanced security. It runs on a Python web framework, so you'll need to setup a MySQL database to use it. This article only covers installation on the 12.04 LTS version of Ubuntu.

Installing and configuring MySQL

To install the MySQL server on an Ubuntu VPS, run:

sudo apt-get install mysql-server

During the install, you'll be prompted to insert a root password, like so:

Prompt for password

Remember this; you'll need it on the next step. Now, you'll need to create a database for LinOTP. Refer to the How to Create a Table in MySQL article if you have any doubts on this part. To enter the MySQL console, run:

mysql -u root -p

And enter the password. Now paste and execute the following lines to create the table, remembering to change "ChangeThis" to a strong password:

GRANT ALL PRIVILEGES ON LinOTP2.* TO 'linotp2'@'localhost' IDENTIFIED BY 'ChangeThis';

You can now exit the MySQL console by running:


Installing and configuring LinOTP

We'll proceed to add LinOTP's repository. As of this writing, this is only supported on Ubuntu 12.04 LTS. First, install the package that allows you to run the "add-apt-repository command":

sudo apt-get install python-software-properties

Now, add the repository by running the following command:

sudo add-apt-repository ppa:linotp/stable

You'll be asked for confirmation. Simply press Enter. You now should be able to update the repositories:

sudo apt-get update

If you don't see an error, that means you are running the right version of Ubuntu and can proceed to install LinOTP. Now that you have the repository added, simply run:

sudo apt-get install linotp

to install LinOTP. You'll be prompted a series of questions. In this tutorial, we won't cover the Apache configuration, so when asked if you want to run LinOTP via Apache2, answer "No" as shown:

Prompt for Apache

As we've already installed MySQL before, select the SQL database LinOTP stores its data as MySQL:

Prompt for SQL server

Set "localhost" as the hostname to the MySQL server, as you're running it on the same VPS. Leave the database name as LinOTP2 as it's the name we chose earlier:

Prompt for database

Leave the database user as "linotp2", and type in the password you chose earlier (not the one from the root user for the MySQL server). You'll be asked if you'd like to create the database tables, answer "Yes". The installation should finish after a few seconds. Then, run the following command to finalize LinOTP's configuration:

sudo paster setup-app /etc/linotp2/linotp.ini

Running LinOTP

To run LinOTP, simply type in:

sudo paster serve /etc/linotp2/linotp.ini

Now you should be able to access the LinOTP management interface from your browser by going to the following address:


From there, you can enroll your first token.


Security has always been a very sensitive topic. It's indispensable to have measures that protect yours and other's data. Two-factor authentication is a very good form of doing just that, and LinOTP makes it really easy.


Creative Commons License