How To Install LinOTP On Ubuntu 12.04 LTS

Security is very important nowadays especially if you run an online business want to deal with clients safely without them worrying about their account getting hacked or their cookies getting stolen. In this detailed tutorial we will show you how to install an opensource solution tool for two factor authentication.

Short Information On LinOTP

LinOTP is an opensource linux based solution to manage authentication devices for two-factor authentication with one time passwords. Being written in python programming language and open for everyone on github, it is easy to hack its code especially if you are a python developer and interested in some deep knowledge.

According to Wikipedia LinOTP provides a REST-like web API and return responses as JSON objects. Now lets go and install it on our Ubuntu 12.04 LTS systems.

Install LinOTP On Ubuntu

The first step needed to be taken to install LinOTP consists in  creating a MYSQL database so we need to make use of the following command to download and install mysql on our Ubuntu system.

sudo apt-get install mysql-server

Once the installation is finished you will be prompted to set the root’s user password for your database, which is a very important step as you will need this password later.

So make sure to not forget it!

Now log into MySQL using the following command.

mysql -u root -p

The following is showed on my console after running the above command successfully.

Execute the following sql code.

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

Once the execution of the above sql code is completed without errors you can exit the MySQL console with the help of the following command. Just a simple exit.

exit

Now we need to add LinOTP’s repository on our system so we can continue with the installation, but first make sure that the python-software-properties package is already installed as it will help us to add and use the repo. If not then you can install it by using the following command.

sudo apt-get install python-software-properties

It is already installed on my system.

Now use the following command to add the repository.

sudo add-apt-repository ppa:linotp/stable

Press Enter.

Update the repositories using the following command.

sudo apt-get update

To install LinOTP simply run the following command.

sudo apt-get install linotp

Type Y and press Enter.

Then you will be prompted some questions for the purpose of the configuration.

It is recommended that LinOTP can be run within a webserver like Apache, but for the purpose of this tutorial we will not cover Apache this time. Just select No.

LinOTP uses a SQL database to store its token data so you will be prompted with a question on what database you want to use. Select MySQL in our case.

You can also select none if you want to use another backend system like Microsoft SQL server or Oracle. After that you need to edit the /etc/linotp2/linotp.ini manually.

Then choose the hostname of the computer where the database is located. I will keep mine as localhost.

Enter the database name you created, mine is LinOTP2.

Leave the user as default.

Enter the password for the database.

Then once is all finished run the following command to complete the configuration.

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

Run LinOTP

Open a new tab in you web browser and use the following syntax.

http://your_ip_or_localhost/manage

Done!