Created
September 21, 2011 14:31
-
-
Save spara/1232194 to your computer and use it in GitHub Desktop.
LAMP stack with Postgres/PostGIS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update and add user | |
apt-get update | |
useradd -G users <username> | |
passwd <username> | |
visudo #add sparafina to shudders | |
# install apache | |
apt-get install apache2 | |
apt-get install php5 libapache2-mod-php5 | |
/etc/init.d/apache2 restart | |
# test php | |
vi /var/www/test.php | |
# copy into test.php | |
# <?php phpinfo(); ?> | |
# check browser to see if php info displays | |
#install postgres | |
sudo apt-get -y install libxml2-dev | |
sudo apt-get -y install postgresql-8.4 postgresql-server-dev-8.4 postgresql-contrib-8.4 libpq-dev | |
/etc/init.d/postgresql-8.4 stop | |
apt-get -y install bzip2 g++ checkinstall | |
# install geos | |
cd /tmp | |
wget http://download.osgeo.org/geos/geos-3.3.0.tar.bz2 | |
bunzip2 geos-3.3.0.tar.bz2 | |
tar xvf geos-3.3.0.tar | |
chown -R sparafina /tmp/geos-3.3.0 | |
cd geos-3.3.0 | |
./configure | |
make install | |
# install proj | |
cd .. | |
wget http://download.osgeo.org/proj/proj-4.7.0.tar.gztar xvfz proj-4.7.0.tar.gz | |
cd proj-4.7.0 | |
./configure | |
make install | |
# install postgis | |
cd .. | |
wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gz | |
tar xvfz postgis-1.5.3.tar.gz | |
cd postgis-1.5.3 | |
./configure | |
make install | |
/sbin/ldconfig | |
# configure postgres | |
sudo -u postgres /etc/init.d/postgresql-8.4 start | |
sudo -u postgres psql -c"ALTER user postgres WITH PASSWORD '<password>'" | |
# configure postgis | |
sudo -u postgres createdb postgis_template | |
sudo -u postgres createlang -dpostgis_template plpgsql | |
sudo -u postgres psql -dpostgis_template -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql | |
sudo -u postgres psql -dpostgis_template -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql | |
sudo -u postgres psql -dpostgis_template -c"select postgis_lib_version();" | |
# configure postgres to accept connections | |
cd /etc/postgresql/8.4/main/ | |
vi pg_hba.conf | |
# add: | |
# host all all 0.0.0.0/0 md5 | |
vi postgresql.conf | |
# add: | |
# listen_addresses = '*' | |
# password_encryption = on | |
# restart postgres/ connect with pgadmin | |
etc/init.d/postgresql-8.4 stop | |
/etc/init.d/postgresql-8.4 start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment