Installation en
From MapbenderWiki
Lesen Sie die Installationsanleitung in Deutsch
Notice
This installation guide is a little bit outdated. Recent versions of Mapbender (2.6+) ship with an install script, located at
/mb_installdir/resources/db/install_2.6.(sh,bat)
(currently for unix-like and windows OS). You will be asked to input several bits of information, after that the installation will proceed automatically. Some of the things mentioned on this page, still apply. Especially all the prerequisites need to be fulfilled, the webserver configuration is not done automatically [Apache configuration, php configuration]. Installation of gettext. And also a final customization of the mapbender.conf has to be done.
Notice
You find an installation script for debian lenny at:
http://www.geoportal.rlp.de/mediawiki/index.php/Installation_OSS_GIS_Debian
Contents |
Update Mapbender
- to update Mapbender run the update-script (from Mapbender 2.7)
./mapbender/resources/db/update.sh
You could define a cron-job that runs the update-script
crontab -e
# m h dom mon dow command */10 * * * * svn up /data/svn/mapbender */10 * * * * /data/svn/mapbender/resources/db/update.sh localhost 5432 mapbender postgres
Prerequisite
To be able to install and operate your own copy of Mapbender you need:
- Webserver (Apache, MS IIS)
- an installation of PHP (scripting language, version > 5.1.x)
- php-mbstring
- php-gettext
- php-gd2
- php5-imagick
- Database (PostgreSQL >= 8.x)
- Installation of gettext see http://www.mapbender.org/Gettext#Utility_programms
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.
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
- install.sh or on windows install.bat
./mapbender/resources/db/install.sh
Apache virtual directory
After installation create a virtual directory. Edit /etc/apache/httpd.conf (path varies, for apache2 /etc/apache2/sites-available/default):
Alias /mapbender /path/to/mapbender2/http/
<Directory /path/to/mapbender2/http> Options MultiViews DirectoryIndex index.php Order allow,deny Allow from all </Directory>
For example using Ubuntu edit: /etc/apache2/sites-available/default
Alias /mapbender /var/www/apache2-default/mapbender_2.4.3/http/
<Directory /var/www/apache2-default/mapbender_2.4.3/http> Options MultiViews DirectoryIndex index.php Order allow,deny Allow from all </Directory>
You must reload (or stop and restart) the Apache program after making changes to the configuration file to make them take effect. If you want to enable directory browsing, e.g. for debugging purposes add Indexes to the Options line.
Apache output compression
For optimal 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_2.4.3/http>
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 at 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 !
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!)
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. For some Mapbender modules access to a PostgreSQL database is required. If these modules should be used, 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
Furthermore check, whether the database information in ./conf/mapbender.conf is correct.
Mapbender Database
Mapbender offers an install-script (install.sh / install.bat) that sets up the database for you. The following descriptions shows what is happening.
Mapbender offers an update script (update.sh) that keeps your database upoto-date
PostgreSQL database
The user under which you load the database must have Postgres superuser rights during inserting the psql_*.sql files below so it can temporarily disable constraint triggers during insert.
Notices for Notices Ubuntu PostgreSQL users.
You have to decide to either use UTF-8 or ISO-8859-1 character encoding.
- database with UTF-8 encoding
createdb -E UTF8 mapbender
- database with ISO-8859-1 encoding
createdb -E Latin1 mapbender
First load the empty Mapbender table definiton (schema)
psql -f pgsql_schema.sql <dbname>
Then load the data in mapbender/resources/db/postgresql/ - be sure to use the dump with the correct enconding!
- UTF-8
psql -f pgsql_data.sql <dbname> (in subfolder utf8/)
- ISO-8859-1
psql -f pgsql_data.sql <dbname> (in subfolder iso/)
At the end set the constraints and sequences. Here you have to check which PostgreSQL version you are using:
- pgsql_serial_set_sequences_7x.sql
- pgsql_serial_set_sequences.sql (for 8.x)
psql -f pgsql_serial_set_sequences.sql <dbname>
Notice: Reprojecting on the fly and transforming geometries is only possible with a PostgeSQL-DB and PostGIS extension.
You can install PostGIS as follows (as User postgres (su postgres)):
- createlang plpgsql <dbname> (already installed in Mapbender >= 2.5)
- psql -f lwpostgis.sql -d <dbname> (change into the PostGIS directory!)
- psql -f spatial_ref_sys.sql -d <dbname> (change into the PostGIS directory!)
How to load the sqls in PostgreSQL:
You find the SQL: /mapbender/resources/db/postgresql/
Notice: There is a difference between the ISO-8859-1 or UTF-8 data-files. Make sure you choose the right folder (iso or utf8)
psql -f pgsql_schema.sql mapbender psql -f pgsql_data.sql mapbender psql -f pgsql_serial_set_sequences.sql mapbender
Check the PostgreSQL log file for any errors during insert.
If you want to update from Mapbender Version 2.2.2 to Mapbender Version 2.2.3 load the sqls in the folder update
- one column var_name in table gui_element_vars has changed
- new table mb_user_wmc
- update of the mapbender guis (admin1, admin2_de, admin2_en, gui and gui1. Notice, that gui_de und gui1_de are not longer part of the standard guis. We want to solve the multilanguage problem with element vars in the following versions)
Password encryption
As of Mapbender version 2.4 the password is converted into a MD5 string by a PHP function instead of the corresponding database function. See also Lost Password.
Mapbender Configuration File mapbender.conf
You find the Mapbender Configuration File in the directory "conf". Here you find the file mapbender.conf-dist. Rename the file to mapbender.conf.
Choose the database you want to use (from Mapbender 2.7 on only PostgreSQL is supported):
# define("SYS_DBTYPE", "mysql");
define("SYS_DBTYPE", "pgsql");
If you use PostgreSQL type your database information here (here is an example):
else {
define("DBSERVER", "localhost");
define("PORT", "5432");
define("DB", "mapbender");
define("OWNER", "mb");
define("PW", "mb");
}
perpared statements (PHP > 5.1.x, PostgreSQL > 7.4)
define("PREPAREDSTATEMENTS",true);
encoding - default characterset UTF-8 / ISO-8859-1
define("CHARSET","UTF-8");
Have a look at 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", false);
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
- you can add new langages - find a description How to add a new language
Change the Permission of log Folder
- Linux : change the permission of log folder to 777 so that php script can write logs in it.
chmod -R 777 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.
