This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:
Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.
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.
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:
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:
CREATE DATABASE LinOTP2; GRANT ALL PRIVILEGES ON LinOTP2.* TO 'linotp2'@'localhost' IDENTIFIED BY 'ChangeThis'; FLUSH PRIVILEGES;
You can now exit the MySQL console by running:
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:
As we've already installed MySQL before, select the SQL database LinOTP stores its data as MySQL:
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:
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
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.Sign up
Click below to sign up and get $100 of credit to try our products over 60 days!