Собираем и устанавливаем сервер

student$ tar xzf /home/student/postgresql-10.0.tar.gz
student$ (cd /home/student/postgresql-10.0/; ./configure) 2>/dev/null | tail
config.status: src/include/pg_config_ext.h is unchanged
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: src/interfaces/ecpg/include/ecpg_config.h is unchanged
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/dynloader/linux.c to src/backend/port/dynloader.c
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
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
student$ make -C /home/student/postgresql-10.0 | tail
make[2]: Entering directory '/home/student/postgresql-10.0/src/test/perl'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/student/postgresql-10.0/src/test/perl'
make[1]: Leaving directory '/home/student/postgresql-10.0/src'
make -C config all
make[1]: Entering directory '/home/student/postgresql-10.0/config'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/student/postgresql-10.0/config'
All of PostgreSQL successfully made. Ready to install.
make: Leaving directory '/home/student/postgresql-10.0'
student$ sudo make -C /home/student/postgresql-10.0 install | tail
/usr/bin/install -c -m 644 ./nls-global.mk '/usr/local/pgsql/lib/pgxs/src/nls-global.mk'
make[1]: Leaving directory '/home/student/postgresql-10.0/src'
make -C config install
make[1]: Entering directory '/home/student/postgresql-10.0/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 '/home/student/postgresql-10.0/config'
PostgreSQL installation complete.
make: Leaving directory '/home/student/postgresql-10.0'

Пользователь postgres и каталог PGDATA

Создаем каталог для данных и делаем владельцем предварительно созданного пользователя postgres:

student$ sudo mkdir /usr/local/pgsql/data
student$ sudo chown postgres /usr/local/pgsql/data

Команда для подключения под пользователем postgres: sudo su - postgres

Инициализация и запуск кластера

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

The database cluster will be initialized with locales
  CTYPE:    en_US.UTF-8
  TIME:     ru_RU.UTF-8
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are enabled.

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

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 /usr/local/pgsql/data -l logfile start

Запускаем кластер

postgres$ pg_ctl -w -l /home/postgres/logfile -D /usr/local/pgsql/data start
waiting for server to start.... done
server started

Проверяем работу

postgres$ psql -c 'select now();'
 2019-03-31 15:24:05.06034+03
(1 row)

Собираем и устанавливаем все расширения

student$ make -C /home/student/postgresql-10.0/contrib | tail
make[1]: Leaving directory '/home/student/postgresql-10.0/contrib/tsm_system_time'
make -C unaccent all
make[1]: Entering directory '/home/student/postgresql-10.0/contrib/unaccent'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/student/postgresql-10.0/contrib/unaccent'
make -C vacuumlo all
make[1]: Entering directory '/home/student/postgresql-10.0/contrib/vacuumlo'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/student/postgresql-10.0/contrib/vacuumlo'
make: Leaving directory '/home/student/postgresql-10.0/contrib'
student$ sudo make -C /home/student/postgresql-10.0/contrib install | tail
/usr/bin/install -c -m 644 ./unaccent.control '/usr/local/pgsql/share/extension/'
/usr/bin/install -c -m 644 ./unaccent--1.1.sql ./unaccent--1.0--1.1.sql ./unaccent--unpackaged--1.0.sql  '/usr/local/pgsql/share/extension/'
/usr/bin/install -c -m 644 ./unaccent.rules '/usr/local/pgsql/share/tsearch_data/'
make[1]: Leaving directory '/home/student/postgresql-10.0/contrib/unaccent'
make -C vacuumlo install
make[1]: Entering directory '/home/student/postgresql-10.0/contrib/vacuumlo'
/bin/mkdir -p '/usr/local/pgsql/bin'
/usr/bin/install -c  vacuumlo '/usr/local/pgsql/bin'
make[1]: Leaving directory '/home/student/postgresql-10.0/contrib/vacuumlo'
make: Leaving directory '/home/student/postgresql-10.0/contrib'

Проверим список доступных расширений

postgres$ psql -c 'SELECT name, comment FROM pg_available_extensions ORDER BY name;'
        name        |                               comment                                
 adminpack          | administrative functions for PostgreSQL
 amcheck            | functions for verifying relation integrity
 autoinc            | functions for autoincrementing fields
 bloom              | bloom access method - signature file based index
 btree_gin          | support for indexing common datatypes in GIN
 btree_gist         | support for indexing common datatypes in GiST
 chkpass            | data type for auto-encrypted passwords
 citext             | data type for case-insensitive character strings
 cube               | data type for multidimensional cubes
 dblink             | connect to other PostgreSQL databases from within a database
 dict_int           | text search dictionary template for integers
 dict_xsyn          | text search dictionary template for extended synonym processing
 earthdistance      | calculate great-circle distances on the surface of the Earth
 file_fdw           | foreign-data wrapper for flat file access
 fuzzystrmatch      | determine similarities and distance between strings
 hstore             | data type for storing sets of (key, value) pairs
 insert_username    | functions for tracking who changed a table
 intagg             | integer aggregator and enumerator (obsolete)
 intarray           | functions, operators, and index support for 1-D arrays of integers
 isn                | data types for international product numbering standards
 lo                 | Large Object maintenance
 ltree              | data type for hierarchical tree-like structures
 moddatetime        | functions for tracking last modification time
 pageinspect        | inspect the contents of database pages at a low level
 pg_buffercache     | examine the shared buffer cache
 pg_freespacemap    | examine the free space map (FSM)
 pg_prewarm         | prewarm relation data
 pg_stat_statements | track execution statistics of all SQL statements executed
 pg_trgm            | text similarity measurement and index searching based on trigrams
 pg_visibility      | examine the visibility map (VM) and page-level visibility info
 pgcrypto           | cryptographic functions
 pgrowlocks         | show row-level locking information
 pgstattuple        | show tuple-level statistics
 plpgsql            | PL/pgSQL procedural language
 postgres_fdw       | foreign-data wrapper for remote PostgreSQL servers
 refint             | functions for implementing referential integrity (obsolete)
 seg                | data type for representing line segments or floating-point intervals
 tablefunc          | functions that manipulate whole tables, including crosstab
 tcn                | Triggered change notifications
 timetravel         | functions for implementing time travel
 tsm_system_rows    | TABLESAMPLE method which accepts number of rows as a limit
 tsm_system_time    | TABLESAMPLE method which accepts time in milliseconds as a limit
 unaccent           | text search dictionary that removes accents
(43 rows)

Останавливаем сервер

postgres$ pg_ctl -w -D /usr/local/pgsql/data stop
waiting for server to shut down.... done
server stopped