Tutorial

How To Install LinOTP on an Ubuntu VPS

Published on August 13, 2013
Default avatar

By Henrique Pinheiro

How To Install LinOTP on an Ubuntu VPS

Status: Deprecated

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.

See Instead:
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.

Introduction

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:

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:

exit

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:

http://your.droplet's.ip:5001/manage

From there, you can enroll your first token.

Conclusion

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.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors
Default avatar
Henrique Pinheiro

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
Leave a comment


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel