0% found this document useful (0 votes)
132 views4 pages

Postgresql Installation Using Source Code in Linux

This document provides steps to install PostgreSQL from source code on a Linux system. It includes: 1. Listing package requirements such as a C compiler and development libraries. 2. Creating a 'postgres' system user and setting that user's password. 3. Downloading the PostgreSQL source code tarball and verifying its integrity. 4. Running configuration, make, and make install steps to compile the source code and install PostgreSQL. 5. Initializing the database data directory and starting the PostgreSQL server process as the 'postgres' user.

Uploaded by

rekaputr4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
132 views4 pages

Postgresql Installation Using Source Code in Linux

This document provides steps to install PostgreSQL from source code on a Linux system. It includes: 1. Listing package requirements such as a C compiler and development libraries. 2. Creating a 'postgres' system user and setting that user's password. 3. Downloading the PostgreSQL source code tarball and verifying its integrity. 4. Running configuration, make, and make install steps to compile the source code and install PostgreSQL. 5. Initializing the database data directory and starting the PostgreSQL server process as the 'postgres' user.

Uploaded by

rekaputr4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

Postgresql Installation using source code in

linux
Package Requirements :
1. Make
2. GCC c compiler
3. Tar
4. Readline,readline-devel
5. Zlib,zlib-devel
6. Bison
7. flex

Optional

Libperl
Phyton
Tcl
Gettext
Kerberos, openssl, openldap, pam

User
default / de facto standar for software owner is postgres, used to running the process as a user, this
postgres user also different from super user on postgreSQL instance

[root@localhost ~]# useradd postgres

[root@localhost ~]# passwd postgres

Changing password for user postgres.

New password:

BAD PASSWORD: it is based on a dictionary word

Retype new password:

passwd: all authentication tokens updated successfully.

Installaer file Download software source code


There is 3 files, file source code file in .tar.gz format, a md5 file, an a sha256 file
postgresql-9.5.3.tar.gz.md5
postgresql-9.5.3.tar.gz.sha256
postgresql-9.5.3.tar.gz

extract source code file and go to directory

Program Installation step

1. run ./configure , this step is used to check the environment if any library need to be install first

[root@localhost postgresql-9.5.3]# ./configure

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

~~

config.status: linking src/backend/port/dynloader/linux.h to src/include/dynloader.h

config.status: linking src/include/port/linux.h to src/include/pg_config_os.h

config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

[root@localhost postgresql-9.5.3]#

If you see above output then configure step is ok and no problem

2. running command make , this with compile the source code

make[2]: Leaving directory `/source/postgresql-9.5.3/src/test/regress'

make[1]: Leaving directory `/source/postgresql-9.5.3/src'

make -C config all

make[1]: Entering directory `/source/postgresql-9.5.3/config'

make[1]: Nothing to be done for `all'.

make[1]: Leaving directory `/source/postgresql-9.5.3/config'

All of PostgreSQL successfully made. Ready to install.

3. Running command make install, default installation path will be in /user/local/pgsql


make[1]: Entering directory `/source/postgresql-9.5.3/config'

/bin/mkdir -p '/usr/local/pgsql/lib/pgxs/config'

/usr/bin/install -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh'

/usr/bin/install -c -m 755 ./missing '/usr/local/pgsql/lib/pgxs/config/missing'

make[1]: Leaving directory `/source/postgresql-9.5.3/config'

PostgreSQL installation complete.

4. DO initDB to create data directory and starting postgresql instance to start up


As root create pgdata directory
Mkdir /pgdata
Chown R postgres:postgres /pgdata
Su postgres

[postgres@localhost bin]$ ./initdb -D /pgdata


The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

~~
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

./pg_ctl -D /pgdata -l logfile start

5. Running the process using pg_ctl command

Start instance

[postgres@localhost bin]$ ./pg_ctl -D /pgdata start

server starting

[postgres@localhost bin]$ LOG: database system was shut down at 2016-06-03 00:44:47 WIB

LOG: MultiXact member wraparound protections are now enabled

LOG: database system is ready to accept connections


LOG: autovacuum launcher started

6. Check if process started


Using root

Ps ef |grep postgres

[root@localhost local]# ps -ef |grep postgres


root 18475 3757 0 00:39 pts/1 00:00:00 su - postgres
postgres 18476 18475 0 00:39 pts/1 00:00:00 -bash
postgres 18621 1 0 00:46 pts/1 00:00:00 /usr/local/pgsql/bin/postgres -D /pgdata
postgres 18623 18621 0 00:46 ? 00:00:00 postgres: checkpointer process
postgres 18624 18621 0 00:46 ? 00:00:00 postgres: writer process
postgres 18625 18621 0 00:46 ? 00:00:00 postgres: wal writer process
postgres 18626 18621 0 00:46 ? 00:00:00 postgres: autovacuum launcher process
postgres 18627 18621 0 00:46 ? 00:00:00 postgres: stats collector process
root 18641 3895 0 00:47 pts/2 00:00:00 grep postgres

You might also like