«

»

Mar 08

Installation d’un serveur uMap

Installation d’un serveur uMap.

1/ Création d’un serveur Gandi.

Coeur : 2
RAM : 2048 mo
Disque : 10 G
Distribution : Ubuntu 16.04 64 bits LTS (HVM)

2/ Mise-à-jour du serveur.

[~] ➔ ssh admin@213.167.66.13
admin@server01osm:~$ su
root@server01osm:/home/admin# apt-get update && apt-get upgrade
root@server01osm:/home/admin# dpkg-reconfigure locales

3/ Modification des sources des dépôts.

http://rockstarninja.tech/serveur-gandi-ubuntu-16-04-installation-de-la-base-de-donnees-mariadb-10-1/

4/ Installation des paquets de base.

root@server01osm:/home/admin# apt-get install vim screen htop wget mc 

5/ Installation des dépendances.

root@server01osm:/home/admin# apt-get install postgresql-server-dev-9.5 postgis python3-pip git python3-virtualenv virtualenvwrapper python3-dev python3-setuptools libtiff5-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk  python3-dev python3 python3-virtualenv wget nginx uwsgi uwsgi-plugin-python3 postgresql-9.5 postgresql-9.5-postgis-2.2 git python3-setuptools  build-essential python3-django python3-pyx python3-jwt python-imaging

6/ Modification des locales.

root@server01osm:/home/admin# export LC_ALL=C
root@server01osm:/home/admin# dpkg-reconfigure locales

7/ Installation de virtualenv.

root@server01osm:/home/admin# pip3 install virtualenv
root@server01osm:/home/admin# pip3 install --upgrade pip 
root@server01osm:/home/admin# pip3 install virtualenvwrapper

8/ Création de l’utilisation umap.

root@server01osm:/home/admin# useradd -N umap -m
root@server01osm:/home/admin# usermod -s /bin/bash umap
root@server01osm:/home/admin# su umap
umap@server01osm:/home/admin$ cd
umap@server01osm:~$ pwd
/home/umap

9/ Téléchargement du code source de umap.

umap@server01osm:~$ git clone https://github.com/umap-project/umap src

10/ Installation des dépendances Python.

umap@server01osm:~$ cd src/
umap@server01osm:~/src$ virtualenv umap --python=`which python3.5`
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /home/umap/src/umap/bin/python3.5
Also creating executable in /home/umap/src/umap/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

11/ Activation de virtualenv.

umap@server01osm:~/src$ source umap/bin/activate
(umap) umap@server01osm:~/src$ 

12/ Installation de Django.

(umap) umap@server01osm:~/src$ pip3 install django-appconf
Collecting django-appconf
  Using cached django_appconf-1.0.2-py2.py3-none-any.whl
Installing collected packages: django-appconf
Successfully installed django-appconf-1.0.2

13/ Installation des dépendances Python.

(umap) umap@server01osm:~/src$ pip3 install -r requirements.txt
...
  Stored in directory: /home/umap/.cache/pip/wheels/e7/4e/b5/c36a97caf4408037eb35aeb1e0a80d95ea0c521a562c3488a3
Successfully built psycopg2 rjsmin rcssmin olefile oauthlib
Installing collected packages: Django, rjsmin, rcssmin, django-compressor, django-leaflet-storage, olefile, Pillow, psycopg2, requests, oauthlib, defusedxml, python3-openid, requests-oauthlib, PyJWT, social-auth-core, social-auth-app-django
Successfully installed Django-1.10.5 Pillow-4.0.0 PyJWT-1.4.2 defusedxml-0.5.0 django-compressor-2.1.1 django-leaflet-storage-0.8.2 oauthlib-2.0.1 olefile-0.44 psycopg2-2.6.2 python3-openid-3.1.0 rcssmin-1.0.6 requests-2.13.0 requests-oauthlib-0.8.0 rjsmin-1.0.12 social-auth-app-django-1.0.1 social-auth-core-1.1.0

14/ Création de l’utilisateur Postgresql umap.

root@server01osm:/home/admin# export LC_ALL=C
root@server01osm:/home/admin# sudo -u postgres createuser umap
root@server01osm:/home/admin# sudo -u postgres createdb umap -O umap

15/ Création de l’extension Postgresql postgis.

root@server01osm:/home/admin# sudo -u postgres psql umap
psql (9.5.6)
Type "help" for help.

umap=# CREATE EXTENSION postgis ;
CREATE EXTENSION
umap=# \q
root@server01osm:/home/admin# 

16/ Copie du fichier de configuration local.py.

(umap) umap@server01osm:~/src$ cp umap/settings/local.py.sample umap/settings/local.py

17/ Configuration de local.py.

Ouvrir :

umap/settings/local.py

Chercher :

SECRET_KEY = '!!change me!!'

Remplacer par :

SECRET_KEY = 'LaCleSecrete'

Chercher :

ADMINS = (
    ('You', 'your@email'),
)

Remplacer par :

ADMINS = (
    ('Le Sanglier', 'lesanglierdesardennes@gmail'),
)

Chercher :

UMAP_DEMO_SITE = True

Remplacer par :

UMAP_DEMO_SITE = False

Chercher :

SITE_URL = "http://localhost:8019"

Remplacer par :

SITE_URL = "http://213.167.66.13:8019"

Chercher :

#�| For static deployment
STATIC_ROOT = '/home/srv/var/static'

#�| For users' statics (geojson mainly)
MEDIA_ROOT = '/home/srv/umap/var/data'

Remplacer par :

# For static deployment
STATIC_ROOT = '/home/umap/umap/var/static'

# For users' statics (geojson mainly)
MEDIA_ROOT = '/home/umap/umap/var/data'

18/ Migration de la base de données umap.

(umap) umap@server01osm:~/src$ python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, leaflet_storage, sessions, sites, social_django, umap
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
...
  Applying social_django.0006_partial... OK
  Applying umap.0001_add_tilelayer... OK
  Applying umap.0002_add_licence... OK

19/ Collecte des fichiers statiques.

(umap) umap@server01osm:~/src$ python3 manage.py collectstatic

You have requested to collect static files at the destination
location as specified in your settings:

    /home/umap/var/static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Copying '/home/umap/src/umap/static/favicon.ico'
...
290 static files copied to '/home/umap/var/static'.

20/ Création de l’utilisateur Umap umap.

(umap) umap@server01osm:~/src$ python3 manage.py createsuperuser
Username (leave blank to use 'umap'): 
Email address: lesanglierdesardennes@gmail.com
Password: 
Password (again): 
Superuser created successfully.

21/ Lancement du serveur Umap.

(umap) umap@server01osm:~/src$ python manage.py runserver 0.0.0.0:8019
Performing system checks...

System check identified no issues (0 silenced).
March 07, 2017 - 22:14:26
Django version 1.10.5, using settings 'umap.settings'
Starting development server at http://0.0.0.0:8019/
Quit the server with CONTROL-C.

22/ Test :

Adresse internet : http://213.167.66.13:8019/en/

23/ Désactivation de virtualenv.

(umap) umap@server01osm:~$ deactivate
umap@server01osm:~$ 

24/ Liens.

https://framacloud.org/cultiver-son-jardin/installation-de-umap/
https://umap-project.readthedocs.io/en/latest/ubuntu/