Difference between revisions of "Building Mapguide on Ubuntu 7.10 Server"

From OSGeo
Jump to navigation Jump to search
m
(italicize administrator)
 
(57 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''''WORK IN PROGRESS - DO NOT USE!!!'''''
+
Below are instructions that will aid a user with installing FDO 3.3 and MapGuide Open Source 2.0 from SVN trunk on Ubuntu 7.10 (Gutsy Gibbon) Server.  It is based on previous instructions, lots of credit to their authors!
  
Below are instructions that will aid a user with installing FDO 3.3 and MapGuide Open Source 2.0 from SVN trunk on Ubuntu 7.10 (Gutsy Gibbon) Server.  It is based on previous instructions, credit to their authors!
+
==NOTES==
  
==BASIC SETUP==
+
By the time you read this, FDO 3.3 and MapGuide 2.0 may have their own branches in SVN.  If so, just swap out references to /trunk/ with the appropriate /branch/* where necessary.
 +
 
 +
The default directory used in these instructions is called /home/''administrator''.  This assumes that you create your primary user account with the name "''administrator''".  If you do not, mentally adjust where necessary.
 +
 
 +
You may want to consider using a client like PuTTY to access your server's terminal via openssh-server from a different computer.  This really helps with copying and pasting.  If so, either ensure that you install the OpenSSH server during your basic install, or add "openssh-server" to the list of packages below.
  
Install a basic Ubuntu Server 7.10 (Gutsy Gibbon)
+
Any time that you run a task and pipe its output to a logfile, make sure that you look at the end of the logfile when you're done to make sure that it completed successfully.  If it didn't then you have the logfile to post an error report from... Here's an example of how to do this:
  
The default directory used in these instructions is called /home/administrator.  This assumes that you created your primary user account with the name "administrator". If you did not, mentally adjust where necessary.
+
  tail -n 30 mylogfile.log
  
By the time you read this, FDO 3.3 and MapGuide 2.0 may have their own branches in SVN.  If so, just swap out references to /trunk/ with the appropriate /branch/* where necessary.
+
==BASIC SETUP==
  
You may want to consider using a client like PuTTY to access your server's terminal via openssh-serverThis really helps with copying and pasting.  If so, either ensure that you install this service during your basic install, or add "openssh-server" to the list of packages below.
+
Install a basic Ubuntu Server 7.10 (Gutsy Gibbon)Once this is complete, you will have to add some extra packages to compile MapGuide.  Make sure that you get all of these packages; the line is really long:
  
Type the following in Terminal to install the prerequisite build tools:
+
sudo apt-get install build-essential bison flex automake1.7 automake1.9 libtool doxygen subversion libjpeg62-dev libpng12-dev libfreetype6-dev libexpat1-dev libxalan110-dev libxslt1-dev expat libcurl4-openssl-dev libasound2-Dev python2.5-dev sun-java5-jdk
  
sudo apt-get install subversion build-essential gcc g++ bison flex automake1.9 libjpeg62-dev libtool zlib1g zlib1g-dev libxml2-dev make libxalan110 libxalan110-dev
+
If Java fails to install, you may need to edit /etc/apt/sources.list to uncomment the multiverse repository lines and then try installing it again.
  
To avoid "bad fd number" errors completely, type the following in the terminal:
+
To avoid "bad fd number" errors, type the following in the terminal:
  
 
  sudo dpkg-reconfigure dash
 
  sudo dpkg-reconfigure dash
Line 25: Line 29:
 
Prepare your SVN profile to use the appropriate options for FDO and MapGuide.  Type the following at the Terminal.
 
Prepare your SVN profile to use the appropriate options for FDO and MapGuide.  Type the following at the Terminal.
  
 +
''(this just sets up your initial .subversion settings folder)''
 
  svn info http://svn.osgeo.org/fdo
 
  svn info http://svn.osgeo.org/fdo
''(this just sets up your initial .subversion settings folder)''
 
  
 +
''(edit ~/.subversion/config)
 
  nano .subversion/config
 
  nano .subversion/config
  
Edit config with the following.  You can enable options by removing the comments (# ) in front of them, or just add new lines to the appropriate locations:
+
You can enable options by removing the comments (# ) in front of them, or just add new lines to the appropriate locations.
  
(in the Miscellany section, enable)
+
In the Miscellany section, enable:
  
  Use-commit-times=yes
+
  use-commit-times = yes
  Enable-auto-props=yes
+
  enable-auto-props = yes
  
(in the Auto-Props section, add)
+
In the Auto-Props section, add:
  
 
  *.*=svn:eol-style=native
 
  *.*=svn:eol-style=native
Line 43: Line 48:
  
 
Save and close the config file.
 
Save and close the config file.
 +
 +
Set the SUN Java to be the default Java installation:
 +
 +
sudo update-java-alternatives -s java-1.5.0-sun
 +
 +
Edit /etc/jvm, moving "/usr/lib/jvm/java-1.5.0-sun" to the top of the list
 +
 +
sudo nano /etc/jvm
 +
 +
Edit /etc/environment so that services will know where to look for Java
 +
 +
sudo nano /etc/environment
 +
 +
''(Add the following line)''
 +
 +
JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"
 +
 +
Log off and then log back on so that these settings take effect.  Alternatively, export JAVA_HOME in your current session.
  
 
==FDO INSTALL==
 
==FDO INSTALL==
Line 48: Line 71:
 
In terminal type the following:
 
In terminal type the following:
  
  svn co http://svn.osgeo.org/fdo/trunk fdosvn --username=guest --password=guest
+
mkdir fdosvn
 +
 
 +
''(be prepared to wait a long time for this command to complete, the test data takes a while to download)
 +
  svn checkout http://svn.osgeo.org/fdo/trunk fdosvn
  
 +
''(type in your password after the following command if prompted)''
 
  sudo mkdir /usr/local/fdo-3.3.0
 
  sudo mkdir /usr/local/fdo-3.3.0
''(type in your password if prompted)''
 
  
sudo chown administrator /usr/local/fdo-3.3.0
+
''(if you are not logged in as ''administrator'', you change the userid below!)''
''(make sure that if you are not logged in as administrator, you change this to your userid)''
+
sudo chown ''administrator'' /usr/local/fdo-3.3.0
  
 
  cd fdosvn
 
  cd fdosvn
Line 60: Line 86:
 
  source ./setenvironment.sh
 
  source ./setenvironment.sh
  
In terminal, type the following to run the builds:
+
In terminal, type the following to run the builds. Note, there will be no output from either command until completion as it is all being spooled to nohup.outYou can log into another terminal session and tail this file if you start getting antsy :-)
 
 
  nohup ./build_thirdparty.sh
 
 
 
  nohup ./build_linux.sh
 
  
 +
nohup ./build_thirdparty.sh > build_thirdparty.log
  
= Here be Dragons - Uncharted territory not yet edited =
+
nohup ./build_linux.sh > build_linux.log
  
 
==APACHE / PHP INSTALL==
 
==APACHE / PHP INSTALL==
Line 73: Line 96:
 
In Terminal type the following:
 
In Terminal type the following:
  
''cd ..'' (you should now be in /home/administrator)
+
cd ~
  
''mkdir mgdev
+
''(you should now be in /home/''administrator'', or whatever your $HOME is)''
  
''cd mgdev
+
mkdir mgsvn
  
''svn co http://svn.osgeo.org/mapguide/branches/1.2.x''
+
svn checkout http://svn.osgeo.org/mapguide/trunk/MgDev/ mgsvn
  
In Terminal, install the following:
+
sudo mkdir /usr/local/mapguideopensource
  
''sudo apt-get install libcurl3 libcurl3-dev libxslt1.1 libxslt1-dev expat''
+
''(replace ''administrator'' with your userid if necessary)''
  
In Terminal:
+
sudo chown ''administrator'' /usr/local/mapguideopensource
  
''mkdir /usr/local/mapguideopensource
+
cd mgsvn/Oem/LinuxApt
  
''sudo chown administrator /usr/local/mapguideopensource'' (replace administrator with your user if necessary)
+
''(careful when copying and pasting this line, the - got changed into . for me)''
  
Edit the following file /etc/apt/sources.list to include the multiverse
+
find . -name "*.gz" -exec tar xzf {} \;
  
''nano sources.list''
+
nohup ./build_apt.sh > ../../build_apt.log
  
In Terminal, install the following:
+
==BUILD OEM==
  
''sudo apt-get install sun-java5-jdk'' (accept the license)
+
Perform the following:
  
In Terminal type the following:
+
cd ~/mgsvn/
  
(be sure to change the version of java to the one you download (i.e., 1.5.0.11, 1.5.0.12, etc.))
+
nohup ./build_oem.sh > build_oem.log
  
''export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11
+
==BUILD MAPGUIDE==
  
''cd /home/administrator/MgDev/1.2.x/MgDev/Oem/LinuxApt
+
Go for the gusto:
  
''find . –name “*.gz” –exec tar zxf {} “;”
+
aclocal
 +
libtoolize --force
 +
automake --add-missing --copy
 +
autoconf
  
''./build_apt.sh''
+
./configure --enable-optimized
  
 +
nohup make > make_mapguide.log
  
==BUILD OEM==
+
nohup make install > install_mapguide.log
 
 
In Terminal, install the following:
 
 
 
''sudo apt-get install automake1.7 libasound2-Dev''
 
  
In Terminal:
+
<!-- Not sure if this is needed yet
  
''cd /home/administrator/MgDev/1.2.x/MgDev
+
If you want to use webstudio, copy the files to the webserverextension folder:
  
''pushd Oem/CppUnit-1.9.14
+
cp -fpR /home/''administrator''/mgsvn/Web/src/webstudio /usr/local/mapguideopensource/webserverextensions/www/webstudio
  
''rm aclocal.m4
+
-->
  
''popd
+
== STARTUP OPTIONS ==
  
''./build_oem.sh''
+
While you're testing, it can be convenient to run services interactively, but eventually you'll want them to shut down / restart when you the computer is rebooted. This section gives you both options.
  
If build_oem.sh fails at the DWF toolkit component and complains about AM_PROG_LIBTOOL not found, install libtool:
+
=== START SERVICES MANUALLY ===
  
''sudo apt-get install libtool''
+
Start Apache
 
 
and re-run build_oem.sh [http://www.nabble.com/build_oem.sh-on-Ubuntu-6.10-tf3998034s16610.html#a11354559 reference]
 
 
 
 
 
==BUILD MAPGUIDE==
 
  
In Terminal, install the following:
+
sudo /usr/local/mapguideopensource/webserverextensions/apache2/bin/apachectl restart
  
''sudo apt-get install libexpat1 libexpat1-dev doxygen''
+
Stop Apache
  
In Terminal:
+
sudo /usr/local/mapguideopensource/webserverextensions/apache2/bin/apachectl stop
  
''sudo chown administrator /usr/lib/python2.4
+
Start MapGuide
  
''sudo chown administrator /usr/lib/python2.5
+
sudo /usr/local/mapguideopensource/server/bin/mgserverd.sh
  
''aclocal
+
Stop MapGuide
  
''libtoolize --force
+
sudo pkill -f -u root "mgserver daemon"
  
''automake --add-missing --copy
+
=== SET SERVICES TO AUTO-START ===
  
''autoconf
+
'''!!! Warning, this is not working. See [http://trac.osgeo.org/mapguide/ticket/309 Ticket #309]  !!!'''
  
''./configure - -without-python
+
Add Apache's control script into the system init structure:
  
''make
+
sudo ln -s /usr/local/mapguideopensource/webserverextensions/apache2/bin/apachectl /etc/init.d/apache-mapguide
  
''make install''
+
Set up some default run level actions for Apache (basically, start on interactive, stop on shutdown/restart)
  
To activate webstudio, you have to copy the files to the webserverextension folder as follows:
+
sudo update-rc.d apache-mapguide defaults 30 70
  
''cp -R /home/administrator/mgdev/1.2.x/MgDev/Web/src/webstudio “SPACE” /usr/local/mapguideopensource/webserverextensions/www/webstudio''
+
Create a startup script for Mapguide server:
  
The above command should be all one line, with a 'space' between webstudio and /usr
+
touch /usr/local/mapguideopensource/mapguidectl
 +
chmod u=rwx,go=r /usr/local/mapguideopensource/mapguidectl
 +
nano /usr/local/mapguideopensource/mapguidectl
  
''Reboot the server''
+
Add the following contents:
  
To start Mapguide on the server:
+
#!/bin/sh
 +
# MapGuide init script
 +
. /lib/lsb/init-functions
 +
case "$1" in
 +
  start)
 +
    log_daemon_msg "Starting MapGuide Server 2.0.0..."
 +
    export GDAL_DATA=/usr/local/mapguideopensource/server/bin/data
 +
    export PROJ_LIB=/usr/local/mapguideopensource/server/bin/nad
 +
    export LD_LIBRARY_PATH=/usr/local/fdo-3.3.0/lib:"$LD_LIBRARY_PATH"
 +
    pushd /usr/local/mapguideopensource/server/bin > /dev/null
 +
    ./mgserver daemon > /dev/null
 +
    popd > /dev/null
 +
    log_end_msg 0
 +
    ;;
 +
  stop)
 +
    log_daemon_msg "Stopping MapGuide Server 2.0.0..."
 +
    MGPROCESS=`/usr/bin/pgrep -f -u root "mgserver daemon"`
 +
    if [ "$MGPROCESS" != "" ]
 +
    then
 +
      /bin/kill $MGPROCESS
 +
    fi
 +
    log_end_msg 0
 +
    ;;
 +
  *)
 +
    echo "Usage: $0 {start|stop}"
 +
    exit 1
 +
    ;;
 +
esac
 +
exit 0
  
''cd /usr/local/mapguideopensource/webtierextensions/apache2/bin
+
Add MapGuide's control script into the system init structure:
  
''./httpd
+
sudo ln -s /usr/local/mapguideopensource/mapguidectl /etc/init.d/mapguide
  
''cd /usr/local/mapguideopensource/server/bin
+
Set up some default run level actions for MapGuide (basically, start on interactive, stop on shutdown/restart)
  
./mgserver.sh''
+
sudo update-rc.d mapguide defaults 35 65
  
Enjoy!
+
Restart and see if it works!

Latest revision as of 12:40, 6 October 2008

Below are instructions that will aid a user with installing FDO 3.3 and MapGuide Open Source 2.0 from SVN trunk on Ubuntu 7.10 (Gutsy Gibbon) Server. It is based on previous instructions, lots of credit to their authors!

NOTES

By the time you read this, FDO 3.3 and MapGuide 2.0 may have their own branches in SVN. If so, just swap out references to /trunk/ with the appropriate /branch/* where necessary.

The default directory used in these instructions is called /home/administrator. This assumes that you create your primary user account with the name "administrator". If you do not, mentally adjust where necessary.

You may want to consider using a client like PuTTY to access your server's terminal via openssh-server from a different computer. This really helps with copying and pasting. If so, either ensure that you install the OpenSSH server during your basic install, or add "openssh-server" to the list of packages below.

Any time that you run a task and pipe its output to a logfile, make sure that you look at the end of the logfile when you're done to make sure that it completed successfully. If it didn't then you have the logfile to post an error report from... Here's an example of how to do this:

tail -n 30 mylogfile.log

BASIC SETUP

Install a basic Ubuntu Server 7.10 (Gutsy Gibbon). Once this is complete, you will have to add some extra packages to compile MapGuide. Make sure that you get all of these packages; the line is really long:

sudo apt-get install build-essential bison flex automake1.7 automake1.9 libtool doxygen subversion libjpeg62-dev libpng12-dev libfreetype6-dev libexpat1-dev libxalan110-dev libxslt1-dev expat libcurl4-openssl-dev libasound2-Dev python2.5-dev sun-java5-jdk

If Java fails to install, you may need to edit /etc/apt/sources.list to uncomment the multiverse repository lines and then try installing it again.

To avoid "bad fd number" errors, type the following in the terminal:

sudo dpkg-reconfigure dash

and choose No at the prompt. Be aware that this changes your default /bin/sh from dash back to bash.

Prepare your SVN profile to use the appropriate options for FDO and MapGuide. Type the following at the Terminal.

(this just sets up your initial .subversion settings folder)

svn info http://svn.osgeo.org/fdo

(edit ~/.subversion/config)

nano .subversion/config

You can enable options by removing the comments (# ) in front of them, or just add new lines to the appropriate locations.

In the Miscellany section, enable:

use-commit-times = yes
enable-auto-props = yes

In the Auto-Props section, add:

*.*=svn:eol-style=native
*.sh=svn:executable

Save and close the config file.

Set the SUN Java to be the default Java installation:

sudo update-java-alternatives -s java-1.5.0-sun

Edit /etc/jvm, moving "/usr/lib/jvm/java-1.5.0-sun" to the top of the list

sudo nano /etc/jvm

Edit /etc/environment so that services will know where to look for Java

sudo nano /etc/environment

(Add the following line)

JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"

Log off and then log back on so that these settings take effect. Alternatively, export JAVA_HOME in your current session.

FDO INSTALL

In terminal type the following:

mkdir fdosvn

(be prepared to wait a long time for this command to complete, the test data takes a while to download)

svn checkout http://svn.osgeo.org/fdo/trunk fdosvn

(type in your password after the following command if prompted)

sudo mkdir /usr/local/fdo-3.3.0

(if you are not logged in as administrator, you change the userid below!)

sudo chown administrator /usr/local/fdo-3.3.0
cd fdosvn
source ./setenvironment.sh

In terminal, type the following to run the builds. Note, there will be no output from either command until completion as it is all being spooled to nohup.out. You can log into another terminal session and tail this file if you start getting antsy :-)

nohup ./build_thirdparty.sh > build_thirdparty.log
nohup ./build_linux.sh > build_linux.log

APACHE / PHP INSTALL

In Terminal type the following:

cd ~

(you should now be in /home/administrator, or whatever your $HOME is)

mkdir mgsvn
svn checkout http://svn.osgeo.org/mapguide/trunk/MgDev/ mgsvn
sudo mkdir /usr/local/mapguideopensource

(replace administrator with your userid if necessary)

sudo chown administrator /usr/local/mapguideopensource
cd mgsvn/Oem/LinuxApt

(careful when copying and pasting this line, the - got changed into . for me)

find . -name "*.gz" -exec tar xzf {} \;
nohup ./build_apt.sh > ../../build_apt.log

BUILD OEM

Perform the following:

cd ~/mgsvn/
nohup ./build_oem.sh > build_oem.log

BUILD MAPGUIDE

Go for the gusto:

aclocal
libtoolize --force
automake --add-missing --copy
autoconf
./configure --enable-optimized
nohup make > make_mapguide.log
nohup make install > install_mapguide.log


STARTUP OPTIONS

While you're testing, it can be convenient to run services interactively, but eventually you'll want them to shut down / restart when you the computer is rebooted. This section gives you both options.

START SERVICES MANUALLY

Start Apache

sudo /usr/local/mapguideopensource/webserverextensions/apache2/bin/apachectl restart

Stop Apache

sudo /usr/local/mapguideopensource/webserverextensions/apache2/bin/apachectl stop

Start MapGuide

sudo /usr/local/mapguideopensource/server/bin/mgserverd.sh

Stop MapGuide

sudo pkill -f -u root "mgserver daemon"

SET SERVICES TO AUTO-START

!!! Warning, this is not working. See Ticket #309 !!!

Add Apache's control script into the system init structure:

sudo ln -s /usr/local/mapguideopensource/webserverextensions/apache2/bin/apachectl /etc/init.d/apache-mapguide

Set up some default run level actions for Apache (basically, start on interactive, stop on shutdown/restart)

sudo update-rc.d apache-mapguide defaults 30 70

Create a startup script for Mapguide server:

touch /usr/local/mapguideopensource/mapguidectl
chmod u=rwx,go=r /usr/local/mapguideopensource/mapguidectl
nano /usr/local/mapguideopensource/mapguidectl

Add the following contents:

#!/bin/sh
# MapGuide init script
. /lib/lsb/init-functions
case "$1" in
 start)
   log_daemon_msg "Starting MapGuide Server 2.0.0..."
   export GDAL_DATA=/usr/local/mapguideopensource/server/bin/data
   export PROJ_LIB=/usr/local/mapguideopensource/server/bin/nad
   export LD_LIBRARY_PATH=/usr/local/fdo-3.3.0/lib:"$LD_LIBRARY_PATH"
   pushd /usr/local/mapguideopensource/server/bin > /dev/null
   ./mgserver daemon > /dev/null
   popd > /dev/null
   log_end_msg 0
   ;;
 stop)
   log_daemon_msg "Stopping MapGuide Server 2.0.0..."
   MGPROCESS=`/usr/bin/pgrep -f -u root "mgserver daemon"`
   if [ "$MGPROCESS" != "" ]
   then
     /bin/kill $MGPROCESS
   fi
   log_end_msg 0
   ;;
 *)
   echo "Usage: $0 {start|stop}"
   exit 1
   ;;
esac
exit 0

Add MapGuide's control script into the system init structure:

sudo ln -s /usr/local/mapguideopensource/mapguidectl /etc/init.d/mapguide

Set up some default run level actions for MapGuide (basically, start on interactive, stop on shutdown/restart)

sudo update-rc.d mapguide defaults 35 65

Restart and see if it works!