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


cd /home/student 
tar xzf postgresql-9.4.8.tar.gz 
cd postgresql-9.4.8/ 

./configure
...вывод опущен...

make
...вывод опущен...

sudo make install
...вывод опущен...

sudo adduser postgres
Adding user `postgres' ...
Adding new group `postgres' (1001) ...
Adding new user `postgres' (1001) with group `postgres' ...
Creating home directory `/home/postgres' ...
Copying files from `/etc/skel' ...

sudo mkdir /usr/local/pgsql/data 
sudo chown postgres /usr/local/pgsql/data 
postgres> bash -c "echo 'export PATH=/usr/local/pgsql/bin:/usr/local/pgsql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' >> ~/.profile" 
postgres> bash -c "echo 'export PGDATA=/usr/local/pgsql/data' >> ~/.profile" 


Инициализируем кластер и запускаем сервер
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


postgres> . /home/postgres/.profile 
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
  COLLATE:  en_US.UTF-8
  CTYPE:    en_US.UTF-8
  MESSAGES: en_US.UTF-8
  MONETARY: ru_RU.UTF-8
  NUMERIC:  ru_RU.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
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... 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:

    postgres -D /usr/local/pgsql/data
or
    pg_ctl -D /usr/local/pgsql/data -l logfile start

postgres> pg_ctl start -w -l /home/postgres/logfile 
waiting for server to start.... done
server started


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


postgres> psql -c "select now();" 
              now              
-------------------------------
 2016-06-16 17:22:35.856698+03
(1 row)



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


postgres> pg_ctl stop -w -m fast 
waiting for server to shut down.... done
server stopped


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


cd /home/student/postgresql-9.4.8/contrib/oid2name 

make
...вывод опущен...

sudo make install
...вывод опущен...

