Install PostgreSQL 10.1 from source

Linux distribution: Ubuntu 16.04 LTS
1. Install dependencies: apt install build-essential zlib1g-dev libreadline6-dev

2. Compile and install
./configure --prefix=/opt/pg-10.1  
make world
make install
Enter the contrib directory make install -- install all extensions

3. After installation, configure the environment variable /etc/profile to add
JAVA_HOME=/opt/jdk1.8.0_151/bin
PATH=/opt/pg-10.1/bin:$JAVA_HOME/bin:$PATH
export PGDATA=/opt/pgdata
export PGDATABASE =web
export PGUSER=postgres
export PGPORT=5432
export LD_LIBRARY_PATH=/opt/pg-10.1/lib:$LD_LIBRARY_PATH
export PATH JAVA_HOME

4. Create a user postgres for database management: adduser postgres

5. Create the directory of the database Cluster mkdir /opt/pgdata

  Authorize to postgres chown postgres.postgres /opt/pgdata

6. initdb after initializing su - postgres

7. Start the database pg_ctl start

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324444467&siteId=291194637