Note - These can also be installed in virtualenv and not in whole system.
-
Virtual Environment Installation
-
Python 3.5 Download
Version check: $ python3 -V Output format: Python 3.5.4
-
Version check: $ pip3 -V Output format: pip 10.0.1 from ..../lib/python3.5/site-packages/pip (python 3.5)
-
Install virtualenv and activate it Installation
To install virtualenv, we will use the pip3 command, as shown below:
$ pip3 install virtualenv
Once it is installed, run a version check to verify that the installation has completed successfully:
$ virtualenv --version
We should see the following output, or something similar:
Output format: 16.0.0
virtualenv installed successfully.
-
Install
pip
invirtualenv
Installing on Debian (Wheezy and newer) and Ubuntu (Trusty Tahr and newer) for Python 3.x Run the following command from a terminal:
sudo apt-get install python3-pip
Installing pip on CentOS 7 for Python 3.x Assuming you installed Python 3.5 from EPEL, you can install Python 3's setup tools and use it to install pip. Note - First command requires you to have enabled EPEL for CentOS7
sudo yum install python35-setuptools sudo easy_install pip
-
Install django 2.0.x
For that you first need to clone the
Libreswan-managing-interface
from the main repo/forkgit clone git clone [email protected]:Rishabh04-02/Libreswan-managing-interface.git
OR
git clone https://github.com/Rishabh04-02/Libreswan-managing-interface.git
OR Download from Libreswan-managing-interface - Github after that get into the
Libreswan-managing-interface
directorycd Libreswan-managing-interface
then create a virtualenv (
librenv
or any other name of your choice) in the folder using the command below:virtualenv librenv
Now activate the virtualenv using the command below:
source librenv/bin/activate
You’ll know it’s activated once the prefix is changed to (
librenv
), which will look similar to the following depending on what directory you are in:(librenv) user@host:$
Now install django 2.0.x using the command below:
(librenv) user@host:$ pip3 install django==2.0.6
check django version from one of the following two ways:
python >>> import django >>> django.VERSION (2, 0, 0, 'final', 0)
OR
(librenv) user@host:$ python -c "import django; print(django.get_version())"
-
Install mysqlclient in virtualenv
instal using the command below:
(librenv) user@host:$ pip3 install mysqlclient
-
Configuration settings
-
Add database login credentials Copy the contents of file
libreswan_managing_interface/sample_database.cnf
to filelibreswan_managing_interface/database.cnf
and update the details. -
Add host ip to allowed IP's list In the
libreswan_managing_interface/settings.py
add your HOST_NAME to the following line:ALLOWED_HOSTS = [192.56.167.123] #sample host IP
-
Add SMTP credentials To the file
libreswan_managing_interface/settings.py
add the SMTP user credentials to the following lines:EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = '[email protected]' EMAIL_HOST_PASSWORD = 'mypasswordhere'
-
Add HOSTNAME to
config/openssl.cnf
In this file on line87
&103
find the below mentioned content:crlDistributionPoints = URI:http://HOSTNAME/crl/distripoint.crl
Replace
HOSTNAME
with your hostname on both the lines. The URI will be included in generated certificates and will be used to revoke the certificates. -
Set the Language & Timezone In the file
libreswan_managing_interface/settings.py
set the following options according to your convenience:LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Asia/Kolkata'
-
-
Preparing the app for running
-
Migrating the databases using the management script using the command below:
(librenv) user@host:$ ./manage.py migrate
-
Create an administrative user for the project by typing:
(librenv) user@host:$ ./manage.py createsuperuser
This will let you select a username, provide an email address, and choose and confirm a password.
-
Now collecting all of the static content into the directory location:
(librenv) user@host:$ ./manage.py collectstatic
The static files will be placed in a directory called static within the project directory.
-
-
Running the app
-
If you want to generate VPN profile then follow the below instructions:
(librenv) user@host:$ sudo su (librenv) root@host:$ ./manage.py runserver 0.0.0.0:8000
Now on your browser navigate to -
http://HOSTNAME:8000/
Your site will be running. Note - Becoming superuser (sudo su
) before running server as it needs to writeetc/conf.d/
and will generate secured keys and certificates. -
If you want to create certificates then follow the below instructions: It can be run using the commands below:
(librenv) user@host:$ sudo su (librenv) root@host:$ ./manage.py runserver 0.0.0.0:8000
Now on your browser navigate to -
http://HOSTNAME:8000/
Your site will be running. Note - Becoming superuser (sudo su
) before running server as it needs to writeetc/conf.d/
and will generate secured keys and certificates. This issue will be fixed soon.
-
-
Deactivate the environment
(librenv) user@host:$ deactivate