Installing PostGIS 2.0 and GeoServer on Centos 6 64bit
as root;
su
exclude=postgres* in base and update sections of /etc/yum.repos.d/CentOS-Base.repo
curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm
curl -O http://mirror.bytemark.co.uk/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -ivh epel-release-6-7.noarch.rpm
yum install postgresql91-server postgis2_91
yum install postgresql91-contrib.x86_64
service postgresql-9.1 initdb
# edit postgres' conf
vi /var/lib/pgsql/9.1/data/postgresql.conf
add listen_addresses = '*'
# allow some connection, make sure the last one matches your local network if you're doing local network stuff...
vi /var/lib/pgsql/9.1/data/pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust
host all all 192.168.1.0/24 md5
# kick postgres
service postgresql-9.1 start
# run on startup
chkconfig postgresql-9.1 on
# change the password for the postgres account
passwd postgres
su postgres
psql
ALTER USER postgres WITH ENCRYPTED PASSWORD 'postgres';
# extensions time..
CREATE EXTENSION adminpack;
# spatialise your db
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
\q
exit
# allow incoming connections on 5432 (postgresql standard port)
back to root;
add the following to /etc/sysconfig/iptables above any REJECT rule
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT
service iptables restart
# back to postgres' bash
sudo -i -u postgres
createdb template_postgis
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis.sql
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/spatial_ref_sys.sql
psql -d template_postgis -f /usr/pgsql-9.1/share/contrib/postgis-2.0/postgis_comments.sql
psql
CREATE DATABASE my_spatial_db TEMPLATE template_postgis;
\q
exit
# back to root
# Installing Geoserver
# we need java, java -version says no java
yum install yum-priorities
rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -Uvh http://mirrors.dotsrc.org/jpackage/6.0/generic/free/RPMS/jpackage-utils-5.0.0-7.jpp6.noarch.rpm
Next we will install Java and Tomcat 6:
yum -y install java
yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps
vi /etc/tomcat6/tomcat-users.xml
add a user with roles of admin,manager
chkconfig tomcat6 on
# now to geoserver
cd /home/<user>
wget http://downloads.sourceforge.net/geoserver/geoserver-2.1.4-war.zip
unzip geoserver-2.1.4-war.zip
mv geoserver.war /usr/share/tomcat6/webapps
# start up tomcat6
service tomcat6 startexit
# test geoserver at
http://localhost:8080/geoserver/web/
# and you'll probably want access across your network
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
/sbin/service iptables save
iptables -F
No comments:
Post a Comment