Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
installation.txt 3.79 KiB
Here is a short description how to install the software. Example commands are designed for Debian.

1. Requirements
	a) java (at least 1.8, but it must be oracle implementation, with sun implementation there are some problems):
		> echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
		> echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
		> apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 apt-get update
		> apt-get update
		> apt-get install oracle-java8-installer
		
	b) tomcat (7.x): 
		> wget http://apache.mirrors.pair.com/tomcat/tomcat-7/v7.0.61/bin/apache-tomcat-7.0.61.tar.gz
		> tar -zxf apache-tomcat-7.0.61.tar.gz
		> mv apache-tomcat-7.0.61 /opt/
		> chown -R localadmin:localadmin /opt/apache-tomcat-7.0.61
		
	c) postgres (9.3 or higher):
		> echo deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main >/etc/apt/sources.list.d/pgdg.list
		> wget https://www.postgresql.org/media/keys/ACCC4CF8.asc
		> apt-key add ACCC4CF8.asc
		> apt-get update
		> apt-get install postgresql
 		
2. Installation
	a) Setup database. Let assume that we have a dump of empty db in the default directory: ~/map_viewer.sql. 
		 Dump of current version can be found in repository: MapViewer/script/db/map_viewer_date.rar.
		 We need user 'map_viewer' with password '123qweasdzxc' and a database map_viewer.
		 
		> #create user and db
		> su - postgres
		> createuser -d -r -s map_viewer
		> echo "ALTER USER map_viewer WITH PASSWORD '123qweasdzxc';"| psql
		>
		> #create db
		> createdb -O map_viewer map_viewer
		> exit
		> 
		> #change hba_conf:
		> cp /etc/postgresql/9.4/main/pg_hba.conf /etc/postgresql/9.4/main/pg_hba.conf.bac
		> cat /etc/postgresql/9.4/main/pg_hba.conf.bac |grep -v "all[ \t]*peer" >/etc/postgresql/9.4/main/pg_hba.conf
		> printf "local   all             all                                     md5\n" >>/etc/postgresql/9.4/main/pg_hba.conf
		> /etc/init.d/postgresql restart
		>
		> echo "localhost:5432:*:map_viewer:123qweasdzxc" >  .pgpass
		> chmod 0600 .pgpass
		> #unrar db schema
		> rar x map_viewer_2014_07_22.rar
		> #and copy it into db
		> psql -U map_viewer -f map_viewer.sql map_viewer
		
	b) copy of MapViewer.war deploy file into tomcat webapps
	  > cp MapViewer.war /opt/apache-tomcat-7.0.57/webapps/
	
	c) start tomcat
		> /opt/apache-tomcat-7.0.57/bin/startup.sh
	
	This will setup the software on the machine on the port 8080 (default tomcat port) inthe MapViewer folder. Assuming that you use localhost the url should be something like this:
	http://localhost:8080/MapViewer/.
	 
	There is one more thing. Generatnig map requires some libraries for awt that are missing by default installation. Therefore we need to modify catalina.sh scritp in tomcat and add this option:
		CATALINA_OPTS="$CATALINA_OPTS -Djava.awt.headless=true"

3. Installataion of ajp connector for apache (to be able to connect to the map from default 80 port):

	a) install apache
		> apt-get install apache2
		
	b) install mod_jk 
		> apt-get install libapache2-mod-jk
	
	c) configure module if necessary:
		> #vi /etc/libapache2-mod-jk/workers.properties
		
	d) remove xhtml from mod_mime mapping:
		> vi /etc/apache2/sites-available/default
		
		add line like this:

    RemoveType xhtml

	e) add mounting tomcat to the directories		

		> vi /etc/apache2/sites-available/default
		
		add lines:

    JkMount /map_images/ ajp13_worker
    JkMount /map_images/* ajp13_worker
    JkMount /MapViewer/ ajp13_worker
    JkMount /MapViewer ajp13_worker
    JkMount /MapViewer/* ajp13_worker
	
	f) turn on the module
	  > a2enmod jk 
	 
	g) restart apache
		> /etc/init.d/apache2 restart