qgis / QGIS-Documentation

QGIS Documentation
https://docs.qgis.org/latest
464 stars 690 forks source link

Check if this has to be moved somewhere in the docs, or deleted altogether #1309

Closed pcav closed 7 years ago

pcav commented 8 years ago

I believe the following is obsolete, and I removed from https://hub.qgis.org/projects/lizmapwebclient/wiki/Installation_en/ In case there is something still useful, and missing from the documentation, please move it. Thanks.


{{toc}}

h1. Installation

You need a server running Apache/Php5. In this document, we assume you already installed QGIS Server and ran it successfully: http://hub.qgis.org/wiki/quantum-gis/QGIS_Server_Tutorial
The following instructions do not show how to secure your Apache configuration ! 

* *Get needed dependencies*
<pre>
sudo su # only needed if you are not the root user
apt-get update
apt-get install apache2 php5 curl php5-curl php5-sqlite php5-gd
service apache2 restart
</pre>

* *Go to Apache www directory, for example* 
<pre>
cd /var/www/
</pre>

* *Get and install LizMap Web Client*
<pre>
# some options
MYAPP=lizmap-web-client
VERSION=2.4.1
wget http://demo.3liz.com/download/$MYAPP-$VERSION.zip
# OR https://bitbucket.org/mdouchin/lizmapwebclient/get/tip.zip ?
unzip $MYAPP-$VERSION.zip
</pre>

* *Give appropriate rights*
<pre>
cd $MYAPP/$VERSION
chown :www-data temp/ lizmap/var/ lizmap/www -R
chmod 775 temp/ lizmap/var/ -R
</pre>

* *First test*

 * Go the the index page to see if installation is ok: http://localhost/lizmap-web-client/2.4.1/lizmap/www/

h1. Upgrade

* Before upgrading, backup those two files in some folder : *lizmap/var/jauth.db* and *lizmap/var/config/lizmapConfig.ini.php*

<pre>
MYAPP=lizmap-web-client
OLDVERSION=2.4.0
# if you installation is 2.1.0 or less, use an empty OLDVERSION instead : 
# OLDVERSION=
cp /var/www/$MYAPP/$OLDVERSION/lizmap/var/jauth.db /tmp/jauth.db # database containing groups and users
cp /var/www/$MYAPP/$OLDVERSION/lizmap/var/config/lizmapConfig.ini.php /tmp/lizmapConfig.ini.php # text configuration file with services and repositories
</pre>

* Run a *fresh installation* as described above, by unzipping the archive, which will create a new subfolder in lizmap-web-client directory

* *Copy backuped files into the new version*

<pre>
$VERSION=2.4.1
cp /tmp/jauth.db /var/www/$MYAPP/$VERSION/lizmap/var/jauth.db
cp /tmp/lizmapConfig.ini.php /var/www/$MYAPP/$VERSION/lizmap/var/config/lizmapConfig.ini.php
</pre>

* *!! IMPORTANT!!* if you upgrade *from LizMap 2.3.0 or less up to 2.4.0 or more*, you also need to run manually the following command to modify some data in the rights management database

<pre>
cd /var/www/$MYAPP/$VERSION/
# under linux
sqlite3 lizmap/var/jauth.db < lizmap/install/sql/upgrade_jacl2db_1.3_1.4.sql
# under windows Vista or Seven, with QGIS installed via Osgeo4Windows : *** TO BE VALIDATED ***
sqlite3.exe lizmap/var/jauth.db < lizmap/install/sql/upgrade_jacl2db_1.3_1.4.sql
</pre>

* *Remove Jelix temporary files*

<pre>
sudo rm -rf /var/www/$MYAPP/$VERSION/temp/lizmap/*   # sudo might be needed depending on your configuration
</pre>

* Change your *virtual host configuration* so that your Lizmap alias redirect to the new version www path (if needed)

h1. Lizmap Configuration via the administration back-end

Please have a look to the [[Features_en|Features page]] to understand Lizmap Web Client key concepts.

h2. Services configuration

* Configure Lizmap Services

 * Go to the *admin page* and login as the user *admin* (password "admin"): http://localhost/lizmap-web-client/2.4.1/lizmap/www/admin.php
 * Select the menu *LizMap Configuration*
 * Under the first menu block called *Services*, click on the *Modify* button
 * Set the appropriate *QGIS Server URL* in the form (for example http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi) and save. You can leave *montpellier* as the default directory for now.
 * *Server cache storage type* For the layers configured with cache on (via Lizmap Plugin), you can choose if the cached images will be stored in several files, or in a single sqlite database (cache is store in the system temporary folder in a structure like /tmp/myrepositoryname/myprojectname/mylayer_my_epsg.sqlite )
 * *Server cache expiration time (s)* The default time to live of cached data, in seconds. 0 means no timeout.

* Check the sample map
A *sample project* is shipped with the Lizmap Web Client archive.

 * Check the default page listing the project *Montpellier -Transport* in the repository *LizMap Demo*: http://localhost/lizmap-web-client/2.4.1/lizmap/www/
 * Go to the map and check everything is ok: http://localhost/lizmap-web-client/2.4.1/lizmap/www/index.php/view/map/?repository=montpellier&project=montpellier

This sample project shows *transport network data in Montpellier, France*. The original data come from *OpenStreetMap* project, and are in projection EPSG:4326. They are reprojected on-the-fly by QGIS Server into Google Mercator (EPSG:900913). The baselayers (Google or OpenStreetMap) are automatically added and called by Lizmap Web Client (they are not part of the QGIS project). Please read the *Lizmap Plugin help* to get some details.

If you can view the sample project, you can now add your own repositories and projects to Lizmap

h2. Configuring your repositories

h3. Create a project in some directory

Let's call the user *joedalton*. This Joe Dalton has created a QGIS project called *mytest.qgs* in the directory */home/joedalton/myprojects/*.
You (or Joe) must open this project with *QGIS Desktop Application* and use the plugin *Lizmap Plugin* to configure the web map Joe wants to publish with the web client.
See the complete documentation on Lizmap Plugin here: http://hub.qgis.org/projects/lizmapplugin/wiki#Documentation . For example, make sure all the data related to the project are store in the same folder, and that the paths are set to "relative" in the project properties dialog.

After Lizmap plugin configuration, a file called *mytest.qgs.cfg* must have been created in */home/joedalton/myprojects/*

h3. Create your first repository in Lizmap administration back-end

Before using Lizmap Web Client to display your project web map, you must create a repository. To do so:

* Go to the *admin page* and login as the user *admin* (password "admin"): http://localhost/lizmap-web-client/2.4.1/lizmap/www/admin.php
* Select the menu *LizMap Configuration*
* At the bottom of this page, click on the button *Add a repository*

* Enter the repository key, for example *joedalton*
* Enter the repository title, for example *Joe Dalton maps*
* Enter the repository path, for example */home/joedalton/myprojects/* *Careful* You must write the last slash (/) at the end of the path
* Select the groups allowed to view the maps contained in this repository. For example, check the groups *admins*, *lizadmins* and *anonymous* (See [[Features_en|the features page]] for details)

Save your modifications. Now you can test if *Lizmap Web Client* correctly displays one of the projects contained in this repository. For example, to see the project */home/joedalton/myprojects/mytest.qgs* in your browser, use the url: http://localhost/lizmap-web-client/2.4.1/lizmap/www/index.php/view/map/?repository=joedalton&project=mytest

* *2 parameters* are used to tell Lizmap Web Client which project in with folder you want to display:

* *repository*: gives the exact name given for */home/joedalton/myprojects/* in the repository configuration. In this example *joedalton*
* *project*: gives the name of the QGIS project without the .qgs extension. In this example *mytest*

h3. Protect your repository

Let's say you want to restrict the access to a repository to some people only. For example, you want to protect the repository *joedalon* and only allow Joe's friends to view his maps. To do so, you have to:

* *create a group* which will contain all of Joe's friends. For example *joefriends*
* *create a user in this group* or more than one if needed. For example *tom* (password "tom") and *jerry* (password "jerry")
* *give access* to the repository *joedalton* for this group

In the administration backend, you must follow these steps (login as admin)

* First create the 2 users here: http://localhost/lizmap-web-client/2.4.1/lizmap/www/admin.php/jauthdb_admin/
* Then create a group *joefriends* under *Create a group* here: http://localhost/lizmap-web-client/2.4.1/lizmap/www/admin.php/jacl2db_admin/groups/ .
* Then go to the menu *Rights of users* and click on the button *rights* beside one of your newly created user . You will see a big table with the groups as columns and the rights as lines. Just click on the small + button under the newly created group *joefriends* to add the user in this group.
* Then go back to lizmap configuration: http://localhost/lizmap-web-client/2.4.1/lizmap/www/admin.php/admin/config/ and click on the button *Modify* under the repository *joedalton*. In the form, you must now uncheck *anonymous*, so that this repository is not public any more, and check the group *joefriends* to allow all the users of this group to view the map. Save the form.
* Now you can *logout* with the top right menu: click on your login *admin* then on the link *disconnect*.

We will now check if the access rights have been well configured for Joe's friends.

* Try again to view Joe's map here: http://localhost/lizmap-web-client/2.4.1/lizmap/www/index.php/view/map/?repository=joedalton&project=mytest
* You will be redirected to the default project list page ( http://localhost/lizmap-web-client/2.4.1/lizmap/www/index.php/view/ ) with an error message saying you are not allowed to view this repository.
* Then *log in* again, but as one of Joe's friends you have created before. Use the link *Connect* in right side of the header. Use for example the login *tom* with the password *tom*.
* If login has been successful, you must have been redirected to the projects list page, and now you can see the repository *Joe Dalton maps* under the default repository *LizMap Demo*
* You can now click on one of Joe's projects link to display the map.

You can create as many repositories as necessary, and as many groups and users as necessary. A user can belong to multiple groups. A repository can be accessed by several groups.

h2. Prepare for production

This chapter gives an *incomplete* lists of things to do before using Lizmap in a production context.

* Secure your server ! Please find the adequate resources via your preferred search engine.
* Change Apache configuration so that LizMap URL pointed to the www folder. For example, configure the virtual host to have http://youserver.org/lizmap/ point toward */var/www/lizmap-web-client/lizmap/www/*
* You can restrict external access to the cgi-bin folder containing QGIG Server. This way, clients will only have access to your map services through Lizmap Web Client. For example, modify your Apache virtual host to allow access only to local server 127.0.0.1.
* Change the passwords of the following users: *admin*, *lizadmin*.
* Delete unused groups, users and repositories.

* You can delete the group *Intranet Demo Group* and the user *logintranet* if you do not use them
* You can delete the repository *montpellier* and the repository *montpellier_intranet*

*You must change the passwords of the admin, lizadmin users*
DelazJ commented 8 years ago

This sounds like a manual for Lizmap web client. Afaict, Lizmap webclient is not a core plugin, so I'd be in favor of not documenting it in QGIS Documentation.

SrNetoChan commented 8 years ago

@jonnyforestGIS have done some work on Lizmap documentation, maybe he wan't to put it there?

DelazJ commented 7 years ago

I'm closing this as it's not related to QGIS Docs imho and Lizmap hast its own site and doc more up to date.