The easiest way to install and set up GeoServer is by installing the full OpenGeo Suite. The OpenGeo Suite comes complete with GeoServer as well as a full geospatial software stack, including utilities, data, and documentation. That said, OpenGeo also provides individual packages for installing the components separately.
This page will describe how to install GeoServer on Ubuntu 10.04 (Lucid). Earlier versions of Ubuntu are not supported at this time.
Access the OpenGeo APT repository
OpenGeo provides a repository for packages in APT (Debian) format. To access this repository, you need to first import the OpenGeo GPG key in to your apt registry:
Note
You will need to run these commands on an account with root access.
wget -qO- http://apt.opengeo.org/gpg.key | apt-key add -
Once added, you can add the OpenGeo APT repository (http://apt.opengeo.org) to your local list of repositories:
echo "deb http://apt.opengeo.org/ubuntu lucid main" >> /etc/apt/sources.list
Now update APT to pull in your changes:
apt-get update
Package management
Search for packages from OpenGeo:
apt-cache search opengeo
If the search command does not return any results, the repository was not added properly. Examine the output of the apt commands for any errors or warnings.
Now you can install GeoServer. The name of the package is opengeo-geoserver:
apt-get install opengeo-geoserver
After installation
When completed, GeoServer will be installed as a servlet inside the local version of Tomcat. Assuming that Tomcat is running on the default port 8080, you can verify that GeoServer is installed by navigating to the following URL:
http://localhost:8080/geoserver/
This will load the Web Administration Interface. Most management of GeoServer functionality can be done from this interface.
Note
The username and password for the GeoServer administrator account is admin / geoserver
For more information about running GeoServer, please see the GeoServer Documentation
Installing GeoServer on Ubuntu
OR
Installing geoserver on ubuntu 10.04
Following the below steps should get the binary release of geoserver running on your 10.04 ubuntu install. This should also work generically for other versions of ubuntu. This process does not step you through securing or completely preparing the geoserver for production use, these details are outside the scope of this tutorial; please review the appropriate sections on security and running in a production environment via the geoserver documentation. Also if you are intending to run this geoserver in a production environment you should review any firewall and/or system settings that may be appropriate for your use case.
Install necessary supporting libraries and applications.
I think this is complete, but it may not be. If you run into any missing packages please indicate which packages also need to be installed in the comments so that others may benefit from your effort.
sudo apt-get update
sudo apt-get install gdal-bin openjdk-6-jdk openjdk-6-jre python-gdal unzip
Download the latest stable or latest release of geoserver.
In my case I grabbed Geoserver 2.1-RC4. These instructions should apply generically to the 2.0.3 release and hopefully others.
cd ~
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1-RC4-bin.zip
Extract the release into your directory of choice.
In my case I chose '/opt' if you choose a different directory and release please substitute accordingly.
cd /opt
sudo unzip ~/geoserver-2.1-RC4-bin.zip
Setup system for running geoserver.
Create a symlink
We want '/opt/geoserver' to point to '/opt/geoserver-RELEASE' so that we can easily upgrade geoserver at a later date.
sudo ln -s /opt/geoserver-2.1-RC4 /opt/geoserver
Download geoserver extensions.
Follow the extension download link for whichever version you downloaded in the previous step here. Grab any extensions you want to install. I grabbed the following;
- MySQL Data Store
- GDAL Coverage Store
- OGR output format
After downloading the extensions extract them to '/opt/geoserver/webapps/geoserver/WEB-INF/lib'.
cd ~
mkdir geoserver_extensions
cd geoserver_extensions
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1-RC4-mysql-plugi...
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1-RC4-gdal-plugin...
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1-RC4-ogr-plugin.zip
find . -name \*.zip -exec unzip -o {} \;
sudo cp -rp *.jar /opt/geoserver/webapps/geoserver/WEB-INF/lib/
Add a geoserver user and group
Next we create a group and user that geoserver will run as:
sudo addgroup --system geoserver
sudo adduser --system --ingroup geoserver --no-create-home --disabled-password geoserver
Setup startup script
In order to start geoserver automatically at startup we need an init script. I grabbed the Debian/Ubuntu script located here.
cd /opt/geoserver/bin
sudo wget -O initd.sh http://docs.geoserver.org/latest/en/user/_downloads/geoserver_deb
sudo ln -s /opt/geoserver/bin/initd.sh /etc/init.d/geoserver
sudo chmod +x ./initd.sh
This script needs one slight modification to be better suited to ubuntu. Change the following line
# Default-Stop: S 0 1 6
to
# Default-Stop: 0 1 6
This should be line 7 of the file.
Change ownership of the geoserver directory
The geoserver install directory should be owned by the geoserver user and group we just created.
sudo chown -R geoserver:geoserver /opt/geoserver-2.1-RC4/
Set the default startup parameters
Use your editor of choice and create a new file '/etc/default/geoserver'. The commented lines, starting with '#', indicate the default as provided in the startup script.
#USER=geoserver
#GEOSERVER_DATA_DIR=/home/$USER/data_dir
GEOSERVER_DATA_DIR=/opt/geoserver/data_dir
#GEOSERVER_HOME=/home/$USER/geoserver
GEOSERVER_HOME=/opt/geoserver
#PATH=/usr/sbin:/usr/bin:/sbin:/bin
#DESC="GeoServer daemon"
#NAME=geoserver
#JAVA_HOME=/usr/lib/jvm/java-6-sun
#DAEMON="$JAVA_HOME/bin/java"
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
DAEMON="$JAVA_HOME/bin/java"
#JAVA_OPTS="-Xms128m -Xmx512m"
JAVA_OPTS="-Xms128m -Xmx512m -server"
#PIDFILE=/var/run/$NAME.pid
#SCRIPTNAME=/etc/init.d/$NAME
Set the geoserver to launch on startup
sudo update-rc.d geoserver defaults
Setup log directories
sudo mkdir /opt/geoserver/webapps/geoserver/data/logs
sudo chown geoserver:geoserver /opt/geoserver/webapps/geoserver/data/logs/
Configure OGR based WFS output format
This allows geoserver to export a bunch of formats that geoserver does not handle natively. The conversion is done through the ogr library see OGR Simple Feature Library for more information on the capabilities of the gdal/ogr library. The following XML lets geoserver know where to find the ogr2ogr binary and the GDAL_DATA directory. Add the following XML to '/opt/geoserver/data_dir/ogr2ogr.xml'
<OgrConfiguration>
<ogr2ogrLocation>/usr/bin/ogr2ogr</ogr2ogrLocation>
<gdalData>/usr/share/gdal16</gdalData>
<formats>
<Format>
<ogrFormat>MapInfo File</ogrFormat>
<formatName>OGR-TAB</formatName>
<fileExtension>.tab</fileExtension>
</Format>
<Format>
<ogrFormat>MapInfo File</ogrFormat>
<formatName>OGR-MIF</formatName>
<fileExtension>.mif</fileExtension>
<option>-dsco</option>
<option>FORMAT=MIF</option>
</Format>
<Format>
<ogrFormat>CSV</ogrFormat>
<formatName>OGR-CSV</formatName>
<fileExtension>.csv</fileExtension>
<singleFile>true</singleFile>
<mimeType>text/csv</mimeType>
</Format>
<Format>
<ogrFormat>KML</ogrFormat>
<formatName>OGR-KML</formatName>
<fileExtension>.kml</fileExtension>
<singleFile>true</singleFile>
<mimeType>application/vnd.google-earth.kml</mimeType>
</Format>
</formats>
</OgrConfiguration>
Start the geoserver
sudo /etc/init.d/geoserver start
Test the geoserver
Now if everything has gone according to plan the geoserver should be running and accessible on port 8080. The default username and password are admin and geoserver respectively. You should review the security documentation for geoserver to properly secure the login and points of access.
Troubleshooting
Note that it can take geoserver quite a bit of time to actually bind to port 8080 and start responding. If you attempt to access geoserver on port 8080 and get an error message then wait a few minutes and try again. You can check to see if the geoserver is running by doing the following
ps aux | grep java
This should show something like the following indicating that the geoserver process is running.
5487 ? Sl 0:21 /usr/lib/jvm/java-1.6.0-openjdk/bin/java -Xms128m -Xmx512m -server -DGEOSERVER_DATA_DIR=/opt/geoserver/data_dir -Djava.awt.headless=true -jar start.jar
If you see the geoserver process is running you can check to see if it has opened port 8080 and is listening for requests with the following
sudo lsof | grep TCP | grep geoserver
You should expect to see something like the following;
java 5487 geoserver 237u IPv6 20420 0t0 TCP *:46378 (LISTEN)
java 5487 geoserver 249u IPv6 20435 0t0 TCP *:http-alt (LISTEN)
If you do not see the above but the java process is running just wait a few minutes as it can sometimes take a while for the geoserver to bind to port 8080.
Comments
One tiny glitch
Submitted on April 6th, 2011 by Marc
Jeff - one tiny glitch that I had was when setting up log directories:
sudo mkdir /opt/geoserver/webapps/geoserver/data/logs
didn't work because the data directory didn't exist yet. I needed to:
sudo mkdir -p /opt/geoserver/webapps/geoserver/data/logs
Otherwise, I followed the instructions and was able to install the latest stable release (2.0.3 at this time) just fine.
After installing, I was able to see that everything worked via my browser by hitting:
http://localhost:8080/geoserver/web
JAVA_HOME problems
Submitted on April 6th, 2011 by Aaron
Hello Jeff. Thank you for posting such clear and concise instructions for installing Geoserver on Ubuntu.
I am, however, having the same problem with every approach I take to install. Everything seems to be fine, until I try to start Geoserver, when I get the JAVA_HOME environment is not defined. But it is defined. I have tried with Sun java as well as openjdk.
This was immediately after reboot:
quickstart@quickstart-VirtualBox:~$ cd geos/geoserver/bin
quickstart@quickstart-VirtualBox:~/geos/geoserver/bin$ sudo ./startup.sh
The JAVA_HOME environment variable is not defined
This environment variable is needed to run this program
quickstart@quickstart-VirtualBox:~/geos/geoserver/bin$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk
When I try to use the following command
sudo update-rc.d geoserver defaults
I get the error: file does not exist
Has anyone had this problem and fixed it?
JAVA_HOME woes
Submitted on April 6th, 2011 by Jeff
Aaron, it looks like you have skipped some of the steps I have outlined. Also your paths look different than what I outline above so hopefully you have extrapolated appropriately.
When attempting the 'sudo update-rc.d geoserver defaults' it is not finding the file '/etc/init.d/geoserver' please review the section 'Setup startup script' above and see if that helps get the file in place.
As an additional comment, regarding your JAVA_HOME.
If you are using bash, you need to export JAVA_HOME so either
export JAVA_HOME
or alternatively I usually declare and export environment variables in one fell swoop.
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
Environment variables must be exported to be available to child processes within the bash shell. However, the startup process you are attempting is not covered by my documentation.
woes
Submitted on April 6th, 2011 by Aaron
Thanks for the reply Jeff. The funny thing is that the file does exist. I see it under etc/init.d/
I think I need to start over from the beginning. Again. You are using the openjdk version of java right? I read some (old) articles that say to use only sun version, so that is what I have been trying. I assume my problem is in having two versions of java (I have the correct one selected in java-alternatives). This time I will try to use native openjdk java. This makes two places where the system cannot find files that I know are there.
The instructions here are for
Submitted on April 6th, 2011 by Jeff
The instructions here are for openjdk, and it is certainly possible that having sun-jdk installed as well is leading to some confusion.
If you are following my instructions the file /etc/init.d/geoserver should be a symbolic link. Perhaps the target file is missing? From your previous post it looks like you installed in a directory other than /opt/geoserver perhaps you forgot to change the target for the following command referenced above?
sudo ln -s /opt/geoserver/bin/initd.sh /etc/init.d/geoserver
These instructions have been tested with ubuntu 10.04, while they should also work for other versions of ubuntu, I have not tested other versions.
Regarding sun vs. open jdk:
I have seen numerous posts for various applications mention that only sun's java implementation should be used. However, I have yet to see any issue with running openjdk. I'm not claiming that there are not issues with openjdk and certain applications, but rather that I have never encountered any issues.
woes
Submitted on April 6th, 2011 by Aaron
After restoring a backup, I am running into similar errors during install. It seems I am having problems with paths.
My original installation was a virtual machine appliance with ubuntu 10.10. I have noticed before when using terminal commands where leading / are used, I get an error. But when I remove the leading / it works
example:
quickstart@quickstart-VirtualBox:~$ cd /geos
bash: cd: /geos: No such file or directory
quickstart@quickstart-VirtualBox:~$ cd geos
quickstart@quickstart-VirtualBox:~/geos$
The first error I get installing Geoserver following your guide is when creating the symlink: (with and without leading /)
quickstart@quickstart-VirtualBox:~/geos$ sudo ln -s /geos/geoserver-2.1-RC4 /geos/geoserver
ln: creating symbolic link `/geos/geoserver': No such file or directory
quickstart@quickstart-VirtualBox:~/geos$ sudo ln -s geos/geoserver-2.1-RC4 geos/geoserver
ln: creating symbolic link `geos/geoserver': No such file or directory
Previously, I simply created the symlink in the file browswer, not from bash. I suspect the problems are all related, but I have very limited experience with linux and fixing this is above my pay scale, so to speak. Any guidance you can give is appreciated.
I would suggest installing
Submitted on April 6th, 2011 by Jeff
I would suggest installing verbatim from my instructions rather than transposing paths.
When you omit the leading '/' you are instructing the shell that the path is *relative* to your current working directory. This will result in differing results depending on your current directory. The leading slash is preferable as it unambiguously refers to a location in the file path.
Basic Linux usage is outside the scope of this documentation.
Path Issues
Submitted on April 6th, 2011 by Aaron
After installing once more, following your instructions verbatim, it worked. Thanks again for providing such concise, and current, instructions!
Can you provide more detail
Submitted on April 8th, 2011 by bullparade
Can you provide more detail on adding extensions, particularly MrSID format? Also, I am running the WAR version, could you provide steps that cover that install and how to setup your environment?
Thanks.
outside scope
Submitted on April 8th, 2011 by Jeff
This documentation is concerned strictly with the binary install of geoserver. For the WAR installation please review the Web Archive (WAR) documentation at http://docs.geoserver.org
Regarding MrSID, I'm unfamiliar with that format and it is proprietary. It sounds like a job more appropriate to GDAL, perhaps the following is helpful osgeo.org's MrSID wiki, but it sounds like something that GDAL supports.
Regardless both of these requests are outside the scope of this writeup. Good Luck!
About Sun vs OpenJDK
Submitted on April 16th, 2011 by Andrea Aime
Hi,
about the Sun vs OpenJDK option, two observations:
- the GeoServer and GeoTools developers use Sun JDK, as well as the automated build bots that build it various times a day (continous integration). So it may work well, but may also break unexpectedly
- benchmarks showed in the past that OpenJDK is significantly slower than Sun JDK when it comes to drawing vector maps. If you only deal with raster data or just do WFS/WCS it's not going to be a big deal anyways
initd
Submitted on June 30th, 2011 by michsred
Hi,
I set up geoserver to run automaticaly after system boot using your instructions. This is what I get when I check if geoserver is running:
ps aux | grep java
110 7620 13.4 8.9 786872 140040 ? Sl 13:30 0:08 /usr/lib/jvm/java-6-sun/bin/java -Xms128m -Xmx512m -server -DGEOSERVER_DATA_DIR=/usr/local/geoserver/data_dir -Djava.awt.headless=true -jar start .jar
1000 9572 0.0 0.0 6152 644 pts/0 S+ 13:31 0:00 grep --color=auto java
sudo lsof | grep TCP | grep geoserver
java 7620 geoserver 202u IPv6 2855578513 TCP *:33630 (LISTEN)
and I can not connect to geoserver GUI via internet browser, funny thing is that this solution works on my Ubuntu Desktop running on localhost:8080 with absolutely no problems but It doesn't work on Ubuntu Server on port 80 (geoserver works on this Ubuntu Server on port 80 when I run it manualy).
Thank you in advance for any sugestions!
been through hours and hours of this
Submitted on July 11th, 2011 by tiredofiitall
Hello, I have been at installing geoserver on ubuntu for about a week. Searched many sites and been on geoserver chat for hours, cant seem to get it. I am willing to pay someone to install this on my dedicated server. replay with a way to contact you. Thank!!
TCP *:http-alt (LISTEN) seems to fail
Submitted on July 14th, 2011 by H Hobson
Hello,
I too want to thank your putting this install guide on the Internet.
By looking below, it appears that part is working. TCP *:http-alt (LISTEN) did not come up. Please let me know if you have run into this before. Thank you ! Harry
harry@harry-laptop:~/geoserver-2.1-RC4/bin$ sudo lsof | grep TCP | grep geoserver
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/harry/.gvfs
Output information may be incomplete.
java 2450 geoserver 225u IPv6 74713 0t0 TCP *:46462 (LISTEN)
TCP *:http-alt (LISTEN) seems to fail --- never mind
Submitted on July 15th, 2011 by H Hobson
Never mind. The problem is something else
sudo: /etc/init.d/geoserver: command not found
Submitted on July 14th, 2011 by H Hobson
Hi,
This, most likely, is the real problem.
$:/opt/geoserver/bin$ sudo /etc/init.d/geoserver start
sudo: /etc/init.d/geoserver: command not found
Please let me know what I can look for solve this.
Thank you,
Harry
It looks like you skipped the
Submitted on July 22nd, 2011 by Jeff
It looks like you skipped the section "Setup startup script"
TCP *:http-alt (LISTEN) is absent
Submitted on August 24th, 2011 by James
This has been a tremendously detailed tutorial. Thank you. I have followed all the required steps, the results of the sudo lsof | grep TCP | grep geoserver command only yields the following:
java 1324 geoserver 217u IPv6 5336 0t0 TCP *:38705 (LISTEN)
The TCP *:http-alt (LISTEN) output is absent. Does any one know what the issue might be? I am installing this on Ubuntu 10.04 Server. I have designated the /var/www/geoserver as the home directory, so when I go to www.mydomain.com/geoserver, I get the list of files and folders in /var/www/geoserver.
The output of lsof | grep geoserver is below:
smbd 698 root 22u IPv6 3568 0t0 TCP *:microsoft-ds (LISTEN)
smbd 698 root 23u IPv6 3570 0t0 TCP *:netbios-ssn (LISTEN)
mysqld 1158 mysql 10u IPv4 4121 0t0 TCP localhost:mysql (LISTEN)
postgres 1180 postgres 3u IPv6 4859 0t0 TCP localhost:postgresql (LISTEN)
postgres 1180 postgres 6u IPv4 4860 0t0 TCP localhost:postgresql (LISTEN)
sshd 1233 root 3u IPv4 4648 0t0 TCP *:ssh (LISTEN)
sshd 1233 root 4u IPv6 4650 0t0 TCP *:ssh (LISTEN)
java 1324 geoserver 217u IPv6 5336 0t0 TCP *:38705 (LISTEN)
apache2 1375 root 3u IPv4 5133 0t0 TCP *:www (LISTEN)
samba 1382 root 22u IPv4 5224 0t0 TCP *:1024 (LISTEN)
samba 1382 root 25u IPv4 5229 0t0 TCP *:loc-srv (LISTEN)
apache2 1395 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 1398 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 1399 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
java 1424 root 34u IPv6 5300 0t0 TCP *:http-alt (LISTEN)
java 1424 root 41u IPv6 5302 0t0 TCP *:8009 (LISTEN)
java 1424 root 43u IPv6 5308 0t0 TCP localhost:8005 (LISTEN)
sshd 1482 root 3u IPv4 5351 0t0 TCP 192.168.1.11:ssh->dhcp-20-41.xxxx.xxxx.xxxx:50937 (ESTABLISHED)
sshd 1649 acer 3u IPv4 5351 0t0 TCP 192.168.1.11:ssh->dhcp-20-41.xxxx.xxxx.xxxx:50937 (ESTABLISHED)
apache2 1670 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 1674 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 1676 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 2421 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 2468 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
apache2 2536 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
sshd 2538 root 3r IPv4 53465 0t0 TCP 192.168.1.11:ssh->dhcp-20-41.xxxx.xxxx.xxxx:53820 (ESTABLISHED)
sshd 2640 acer 3u IPv4 53465 0t0 TCP 192.168.1.11:ssh->dhcp-20-41.xxxx.xxxx.xxxx:53820 (ESTABLISHED)
apache2 2646 www-data 3u IPv4 5133 0t0 TCP *:www (LISTEN)
I'd appreciate your advice.
Thanks again.
Linux packages also available
Submitted on August 12th, 2011 by OpenGeo
Hi all. Note that OpenGeo now hosts GeoServer as standard RPM and DEB packages to make it even easier to install via standard means on Linux.
Here are some details on Ubuntu:
Installing GeoServer on Ubuntu
And CentOS too, for completeness:
Installing GeoServer on CentOS
tuff to install on ubuntu
Submitted on September 13th, 2011 by Anonymous
i am also trying to install geoserver on ubuntu.
here i m getting a message of command not found
sudo: /etc/init.d/geoserver: command not found
please hep to resolve this
thanks
Jeff, Thanks a lot for great
Submitted on October 16th, 2011 by radek
Jeff,
Thanks a lot for great tutorial! Followed the steps and now can confirm it works without issues in 11.10.
r
0 nhận xét:
Đăng nhận xét