Saturday, April 4, 2015

Installing PostGIS on centos 6.5

sudo rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

yum install postgresql94 postgresql94-server postgresql94-libs
postgresql94-contrib postgresql94-devel

sudo yum install postgis2_94

yum install pgrouting_94

yum install php-pgsql

service postgresql-9.4 initdb
----------------------------------------------------------------
connecting :

su postgres

psql -p 5432

SELECT setting FROM pg_settings WHERE name = 'config_file';

postgres=# create database shops_new;

CREATE DATABASE db1;
\l - show databases
\d <table>; describe table
\connect db1; connect to db1
\dt show tables


postgres=# \connect db_new;

You are now connected to database "db_new" as user "postgres".

db_new=# create extension postgis;

CREATE EXTENSION

db_new=#

ALTER TABLE your_table ADD COLUMN idBIGSERIAL PRIMARY KEY;


db_new=# ALTER TABLE table1 ADD COLUMN name character varying(128) NOT
NULL DEFAULT '';

db_new=# ALTER TABLE table1 ADD COLUMN address character varying(1024)
NOT NULL DEFAULT '';

ALTER TABLE table1 ADD COLUMN male int;

SELECT AddGeometryColumn ('','shops','location',4326,'POINT',2);


INSERT INTO shops(name,address,location,male,female,free,rating)
VALUES("name1","address1",ST_GeomFromText('POINT(-71.060316
48.432044)', 4326), 1,1,1,1);

http://www.cyberciti.biz/faq/psql-fatal-ident-authentication-failed-for-user/

No comments:

Blog Archive