Skip to content

Instantly share code, notes, and snippets.

@WanderingHogan
Last active August 29, 2015 14:03
Show Gist options
  • Save WanderingHogan/635951b5cbceb6c98120 to your computer and use it in GitHub Desktop.
Save WanderingHogan/635951b5cbceb6c98120 to your computer and use it in GitHub Desktop.
centos postgres9.3 postgis node git
#I went with a centos 6.5 64 bit server
##follow these instructions for postgis: http://www.postgresonline.com/journal/archives/329-An-almost-idiots-guide-to-install-PostgreSQL-9.3,-PostGIS-2.1-and-pgRouting-with-Yum.html
#First
sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
#then install all the postgres libs
sudo yum -y update
sudo yum -y install postgresql93 postgresql93-server postgresql93-libs postgresql93-contrib postgresql93-devel nano
#instal gdal and json dependencies
sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#then install postgis
sudo yum install -y postgis2_93
#initialize the db
sudo service postgresql-9.3 initdb
#change the pg_hba.conf file to allow for connections
sudo nano /var/lib/pgsql/9.3/data/pg_hba.conf
# and add this: host all all 0.0.0.0/0 md5
#then increase memory and allow listeners
sudo nano /var/lib/pgsql/9.3/data/postgresql.conf
#set listen_address = '*'
#set port = 5432
#set shared_buffers = up to 40$ of machine ram
#set work_mem = ? ,,, i set to 50mb
#restart and test from local
sudo service postgresql-9.3 restart
#now switch over to the postgres user, switch in to psql, and alter the postgres user and set the password to what you want
sudo su postgres
psql
ALTER USER postgres WITH PASSWORD 'yourpassword';
#Now add a template postgis db
CREATE DATABASE postgis_template;
#to escap psql type
\q
exit
#now as root restart postgres
service postgresql-9.3 restart
#log in through your local pgadmin and run these on your postgis_template db. Use this template to start new databases.
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
##Postgresql End
#Install nodejs and git
#node from here: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
sudo yum install nodejs npm --enablerepo=epel
#git
sudo yum install git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment