First, the environment
ubuntu14.04
postgresql-9.4.3
Second, installation
1. Dependent Package Installation
sudo Install libperl-dev python-dev libreadline-gplv2-dev Zlib1g-dev
2. Download PostgreSQL, compile and install
WGer https://ftp.postgresql.org/pub/source/v9.4.3/postgresql-9.4.3.tar.bz2tar -jxvf postgresql-9.4. 3. tar. Bz2-c/usr/local/src/
./configure--prefix=/usr/local/postgresql-9.4. 3 --with-perl --with-pythonsudomakesudo make Install
cd/usr/local/sudoln -fs postgresql-9.4. 3/Pgsql
In the compilation installation path is the version number, plus the version number of the reason is for later upgrade convenience; If postgreSQL9.4.4 is released, you need to stop the existing database after compiling postgreSQL9.4.4, and then point the link/usr/local/pgsql /usr/local/postgresql-9.4.4.
3. Configure Environment variables
After the installation is complete, configure the path of the PostgreSQL executable file and the path of the shared library, the database directory
Export path=/usr/local/pgsql/bin: $PATHexport ld_library_path=/usr/local/pgsql/lib
If you want the above configuration to take effect for all users, you can add the above content to the/etc/profile file. If you want the above configuration to take effect for the current user, you can add the above content to the. bashrc file under Linux, and you can add it to the. profile file under other Unix.
4. Create a database cluster
Export pgdata=/data/PGDATA #数据目录环境变量initdb
5. Install the tools under the contrib directory
CD postgresql-9.4. 3/contribmakesudomakeinstall
6. Start and stop the database
Pg_ctl start-d/data/pgdata -d/dtat/pgdata
ubuntu14.04 LTS Source code compile and install PostgreSQL