forked from wanghaisheng/fhirbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-postgres
executable file
·32 lines (22 loc) · 1.14 KB
/
install-postgres
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# This script build postgresql from source
sudo apt-get -qq update
sudo apt-get -qqy install git build-essential gettext libreadline6 libreadline6-dev zlib1g-dev flex bison libxml2-dev libxslt-dev || echo 'Ups. No sudo'
git clone -b REL9_4_STABLE --depth=1 git://git.postgresql.org/git/postgresql.git $SOURCE_DIR
XML2_CONFIG=`which xml2-config` cd $SOURCE_DIR && ./configure --prefix=$BUILD_DIR --with-libxml &&\
make &&\
make install
cd $SOURCE_DIR/contrib/pgcrypto && make && make install
cd $SOURCE_DIR/contrib/pg_trgm && make && make install
# git clone https://github.com/akorotkov/jsquery.git $SOURCE_DIR/contrib
# cd $SOURCE_DIR/contrib/jsquery && make && make install
# echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
# locale-gen
mkdir $PGDATA
$PG_BIN/initdb -D $PGDATA -E utf8
echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf
echo "listen_addresses='*'" >> $PGDATA/postgresql.conf
echo "port=$PGPORT" >> $PGDATA/postgresql.conf
$PG_BIN/pg_ctl -D $PGDATA start
echo 'Postgresql builded & started\nYou can login into with: \n source local_conf.sh && $PG_BIN/psql postgres'
# source local_cfg.sh && $PG_BIN/psql postgres