Manual Installation

From MapbenderWiki

Jump to: navigation, search

-> Installationsanleitung in Deutsch

Notice

This is the manual installation guide! For standard installations we recommend to use the the install script and follow the Installation instructions!

If you want to upgrade a running version of Mapbender please refer to the Update article.

Advanced users find a complex installation instruction and script for Debian Lenny at:


Contents

Prerequisite

To be able to install and operate your own copy of Mapbender you need:

The following instructions only describe the configuration process for these packages, please follow the installation instructions for your operating system individually as the paths to files will vary on your systems.

Notice

Read about the Client capabilities to learn what is required to work with Mapbender online.

Download of the package

Download the newest installation package. For further details see Download Mapbender.

If you want to install the bleeding edge then please use an SVN client to check out the code directly from the source code repository.

Directories

  • conf - directory for configuration files mapbender.conf digitize_default.conf gazetteer.conf
  • http - directory for the application. Within this directory the modules are sorted by type in subdirectories. Some modules are pure JavaScript applications, even though they have .php as suffix.
  • license - license information files
  • log - logfiles will be saved here
  • owsproxy
  • resource/db - directory for the SQL-Dump to build up the Mapbender database or update the database
  • resources/locales - directory contains translation files for different languages (Mapbender.po-files)


run the install-Script

Mapbender needs an administrative database. There is an install-script that creates the database and creates tables and content. Please observe that for proper security you should not use the default PostgreSL user postgres to access the Mapbender database. Read how to Create mapbender user in postgresql for further information.

  • run install_2.6.sh or on windows install_2.6.bat from the directory:
 ./mapbender/resources/db/
Notes
Theses notes are from a standard Debian or Ubuntu Linux installation. If you are interested to see what is happening in the database you can check the log, acessible through:
    tail -f /var/log/postgresql/postgresql-8.3-main.log
You will see several Warnings and Notices, these are normal, just watch out for Error messages.
The default user for Apache is www-data

This page decribes the details required for a Mapbender Installation.

Installing Apache

Please refer to the Apache httpd documentation for your operating system.

Configuration

After installation create a virtual directory. It will allow you to access the Mapbender scripts from a browser. Follow the schema below and exchange <path-to-mapbender-http> with the path to the web directory of the Mapbender directory ./mapbender/http/

Alias  /mapbender  /<path-to-mapbender-http>
   <Directory  /<path-to-mapbender-http>
       Options  MultiViews
       DirectoryIndex  index.php
       Order  allow,deny
       Allow  from all
   </Directory>

The location of the Apache configuration files varies depending on version your are using, for example:

/etc/apache/httpd.conf
/etc/apache2/sites-available/default

Remember to reload the configuration file so that Apache knows about the changes.

Apache Output Compression

For best performance, enable output compression of your web server. Here's an instruction for Apache (see http://httpd.apache.org/docs/2.0/mod/mod_deflate.html for more details). Just append the content in bold to your Directory settings

       <Directory /var/www/apache2-default/mapbender/http> # (exchange with your path)
           Options MultiViews
           AllowOverride None
           Order deny,allow
           Deny from all
           Allow from 127.0.0.0/255.0.0.0 ::1/128
   
           # Insert filter
           SetOutputFilter DEFLATE
   
           # Netscape 4.x has some problems...
           BrowserMatch ^Mozilla/4 gzip-only-text/html
   
           # Netscape 4.06-4.08 have some more problems
           BrowserMatch ^Mozilla/4\.0[678] no-gzip
   
           # MSIE masquerades as Netscape, but it is fine
           # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
   
           # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
           # the above regex won't work. You can use the following
           # workaround to get the desired effect:
           BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
   
           # Don't compress images
           SetEnvIfNoCase Request_URI \
           \.(?:gif|jpe?g|png)$ no-gzip dont-vary
   
           # Make sure proxies don't deliver the wrong content
           Header append Vary User-Agent env=!dont-vary
       </Directory>

Make sure you have loaded the required modules (for example, Ubuntu and Apache2)

a2enmod deflate
a2enmod headers
a2enmod setenvif (for BrowserMatch)

For Windows and Apache2, you have to activate the modules in the configuraiton file httpd.conf.

LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

Mapbender will load almost twice as fast!

PHP Configuration

You might have to make some adjustments to the file php.ini. Changes in the php.ini also become operative only after restarting the Apache web server ! If you use Suhosin have a look at the Suhosin configuration too.

1. During the test and installation phase of Mapbender it can be helpful log php-errors. Configure the file php.ini as follows:

error_reporting  =  E_ALL & ~E_NOTICE
log_errors = On
error_log = "/var/log/php.log"

2. Check the following details in php.ini allow_url_fopen parameter:

extension_dir = (path to extensions-directory)
allow_url_fopen = On

4. Mapbender manages access authorization in SESSIONS. Check the following details:

session.save_handler = files
session.save_path = (Path to SESSIONS-Directory). (Check authorisation!)
session.use_cookies = 1

5. Further details of session management should be customized according to server load (see 'garbage collection' in php.ini)

6. With regard to other modules the extension gd2 should be included in the installation and configuration process.

extension=php_gd2.dll        (Windows)
extension=gd.so              (Linux)

On a Debian-System you find this lib in /usr/lib/libgd.so. If it is not installed you can do that using the command (or use Synaptic Packet Manager or similar / This information might be out of date for Ubuntu 9.04):

# apt-get install lbgd2-dev 

7. To run Mapbender a PostgreSQL database is required. You have to check the availability of the required extension in the php.ini file:

extension=php_pgsql.dll      (Windows)
extension=pgsql.so           (Linux)

8. Mapbender needs php_gettext and php_mbstring

extension=php_gettext.dll     (Windows)
extension=php_mbstring.dll    (Windows)

9. short_open_tag

short_open_tag = OFF

10. Mapbender requires simplexml and dom for XML parsing. If not installed, this will lead to some hard-to-find bugs, because PHP fails to throw exceptions! These modules should be already installed if you are using a Linux distribution, but if you compile PHP yourself you need to include these as well

11. set PHP variable max_input_vars (add variable)

max_input_vars = 5000 (default is 1000 which may be not enough for WMS with many layers)

see also http://php.net/manual/en/info.configuration.php

Furthermore check, whether the database information in ./conf/mapbender.conf is correct.

Mapbender Database

Please use the install-script (install.sh / install.bat) as described on the Installation page to creat the PostgreSQL database unless you knwo exactly what you are doing. Use the update script (update.sh) to keep your database up-to-date.

During installation and updates you need PostgreSQL SUPERUSER privileges to create and initialize the Mapbender database to temporarily disable constraint triggers. After installation a user with a regular role with INSERT, UPDATE and DELETE permissions on all tables, PostGIS functions and sequences should be used. For security reasons you should not use a PostgreSQL SUPERUSER role for regular operation of a public site.

References

Setting up the Database Manually

The following steps describe the manual installation. Please observe that it is not maintained as regularly as the normal Installation documentation. Please report inconsistencies.

Mapbender supports UTF-8 character encoding.

  • Use the PostgreSQL createdb tool command to create a database named 'mapbender' with UTF-8 encoding:
createdb -E UTF8 mapbender

Then load the SQL files to your database. The SQL files are located in folders of the directory: ./mapbender/resources/db/

Load the SQL files one after the other in the correct order! The first required file is the empty Mapbender table definiton (schema) followed by the data and finishing with constraints and sequences. After loading the core files make sure to add all update SQL files. To find out which SQL files need to be loaded and in which order please refer to the install script of your Mapbender version located at:

./mapbender/resources/db/install.sh (or install.bat)

Notice: On-the-fly Coordinate transformation, geometry operations and some other funcionality requires a functional PostGIS extension of PostgreSQL.

Check the PostgreSQL log file for any errors during the SQL INSERT transaction. PostgreSQL will generate warnings due to loading data with implicit constraints. This is expected behaviour because constraints and triggers are disabled during creation and initialization of the database. Constraints are added at the end of the load process.

Password encryption

As of Mapbender version 2.4 the password is converted into a MD5 string by a PHP function. Read how to reset a Lost Password.

Mapbender Configuration File

The Mapbender core system configuration mapbender.conf file is located in the directory:

./mapbender/conf/

Please observe that the download package contains a default file named mapbender.conf-dist. This is to ensure that during a Mapbender update your configuration is not overwritten. Copy mapbender.conf-dist to a new file named mapbender.conf to take effect. Find a detailed description of every settings in the Mapbender.conf page.


Check your Webserver configuration. The folloing example shows how it is configured for Apache.

Define a directory for temporary files, this directory must have write access

 define("TMPDIR", "../tmp");

URL for login

 define("LOGIN", "http://localhost/mapbender/frames/login.php");
 define("MAXLOGIN", 3);
 $login = LOGIN;


URL to owsproxy (no terminating slash)

 define("OWSPROXY", "http://localhost/owsproxy");
  • get more information on how to configure owsproxy.


type of server-connection curl, socket, http

 #define("CONNECTION", "curl");
 define("CONNECTION", "http");
 #define("CONNECTION", "socket");
 define("CONNECTION_PROXY", "<ip>");
 define("CONNECTION_PORT", "<port>");
 define("CONNECTION_USER", "<user>");
 define("CONNECTION_PASSWORD", "<password>");


security: path to modules

 define("CHECK", true);
Notice: Setting "CHECK", true ensures that users cannot add modules to their appilcations which they do not already own. Use especially when running Mapbender in Portal mode and allowing anonymous users to create Mapbender accounts.


mail settings for internal mapbender mails Mapbender can communicate with its users by email. For example, when a user lost his/her password, Mapbender can send an email to this person with a new password. Another example: Whenever a WMS is updated, the users using this WMS are notified by Mapbender via email.

To enable Mapbender to send emails, the administrator must specify a mail server (and set up a mail account on this server). Please notice: mapbender only features SMTP mailing!

For further settings check 'class_administration.php', or please check phpmailer (http://sourceforge.net/projects/phpmailer) for more information. Currently, phpmailer 1.72 is in use.

define("USE_PHP_MAILING", "false");
define("MAILHOST", "<host>");
define("MAILUSERNAME", "<user>");
define("MAILPASSWORD", "<password>");
define("MAILADMIN", "<mailaddress of the mailadmin>");
define("MAILADMINNAME", "<mailadminname>");
$mailHost = MAILHOST;
$mailUsername =  MAILUSERNAME;
$mailPassword =  MAILPASSWORD;


Mapbender error logging

  • Set Mapbender error logging (see possible options below)
define("LOG_LEVEL", "error"); //"off","error","warning","notice" or "all"
define("LOG_JS", "on"); // "on", "alert", "console" or "off"

Internationalisation

define("USE_I18N", true);
  • Define default language
define("LANGUAGE", "de");   // "en", "de", "bg", "gr", "nl", "it", es" 
  • you can change the translations in the Mapbender.po (mapbender/resources/locale/de_DE/Mapbender.po files if you prefer a different translation.
    • You can edit the Mapbender.po files with an editor
    • or with poedit
    • after changing Mapbender.po you have to compile the Mapbender.mo files again, see gettext (make sure that gettext is installed).
Example - How to compile the Mapbender.mo files
msgfmt resources/locale/de_DE/LC_MESSAGES/Mapbender.po -o resources/locale/de_DE/LC_MESSAGES/Mapbender.mo

Change the Permission of log Folder

  • Linux : change the permission of the directory ./log to a value that allows the PHP script owner to write logs. On Linux systems give ownership of the directory to the Webserver user (on Linux for example www-data) and allow write permissions:
chown -R www-data ./log
chmod -R 640 ./log

Check the Setup

You can check your setup with the script mapbender_setup.php. The script mapbender_setup.php moved to the directory:

/mapbender/tools/mapbender_setup.php

To access the script you have to move it temporary to /mapbender/http/tools/mapbender_setup.php.

Notice

Please notice that for security reasons the directory tools should not be available for external users, as e.g. the mapbender_setup.php displays internal information about your system (PHP version, databasename, database user...). You can protect the directory by htaccess or just remove the tools-directory again after testing.

Run the mapbender_setup.php:

http://localhost/mapbender/tools/mapbender_setup.php

The mapbender_setup.php checks wether all configurations of the mapbender.conf are right and checks some system settings.

After the installation - first Login

After the installtion you can login with the user account root and the inital password root. Make sure to change this password asap in order to secure your Mapbender installation. Go to admin2_en Create and edit user to change the password.

You should noct delete the user root. To administrate your applications you should create a new user f.e. admin which you use instead if user root.

Read more about the user root !

Get to know Mapbender - the tutorial can help you.

Views
Personal tools