Install
- download from tar.gz website and decompress
tar -xvf [.tar.gz] cd []
- compile and build
then pgsql9.6 is installed atapt-get install libreadline5 # readline apt-get install libreadline6-dev # readline apt-get install zlib1g.dev # zlib ./configure --prefix=/usr/pgsql9.6/ #prefix means the install path make make install
/usr/pgsql9.6
- init postgres see blog
cd /usr/pgsql9.6 mkdir data adduser postgres # passwd: postgres chown postgres data su postgres cd /usr/pgsql9.6 bin/initdb -D data # bin/pg_ctl -D data -l logfile start # sometimes it may fail bin/pg_ctl -D data start # then you can try this cmd bin/createdb test bin/psql test
Use
- start postgres see blog
# bin/pg_ctl -D data -l logfile start bin/pg_ctl -D data start bin/createdb test bin/psql test
- set
PATH
can make the cmd easier, see my blog: Linux设置环境变量 - postgres use:
su postgres # passwd postgres /usr/pgsql9.6/bin/psql