sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
sudo apt-get install autoconf binutils-doc bison build-essential flex
sudo apt-get install git
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:cartodb/postgresql-9.5 && sudo apt-get update
sudo apt-get install libpq5 \ libpq-dev \ postgresql-client-9.5 \ postgresql-client-common
sudo apt-get install postgresql-9.5 \ postgresql-contrib-9.5 \ postgresql-server-dev-9.5 \ postgresql-plpython-9.5
sudo service postgresql restart
添加用户
sudo adduser dbuser
sudo su - postgres
psql
\password postgres
CREATE USER dbuser WITH PASSWORD 'password';
CREATE DATABASE exampledb OWNER dbuser;
GRANT ALL PRIVILEGES ON DATABASE exampledb to dbuser;
\q
远程连接
vi /etc/postgresql/9.5/main/postgresql.conf
修改 #listen_addresses=’localhost’
listen_addresses=’*’
vi /etc/postgresql/9.5/main/pg_hba.conf
添加host all all 0.0.0.0/0 md5