Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
postgresql_installation [2019/10/18 11:04] – external edit 127.0.0.1 | postgresql_installation [2021/12/10 17:47] (current) – [Install the Repositories] andonovj | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======Overview====== | + | =====Overview===== |
PostegreSQL is open source database offered under the license of GPL and is supported by the community. The installation of postegresql is rather simple. | PostegreSQL is open source database offered under the license of GPL and is supported by the community. The installation of postegresql is rather simple. | ||
+ | |||
=====Installation===== | =====Installation===== | ||
Installation is composed by 3 steps: | Installation is composed by 3 steps: | ||
Line 14: | Line 15: | ||
<sxh bash> | <sxh bash> | ||
- | [root@postegresqlmaster ~]# yum install https:// | + | [root@postegresqlmaster ~]# yum install https:// |
Loaded plugins: fastestmirror | Loaded plugins: fastestmirror | ||
Setting up Install Process | Setting up Install Process | ||
Line 122: | Line 123: | ||
- | ====Install the server==== | + | ===Install the server=== |
<sxh bash> | <sxh bash> | ||
[root@postegresqlmaster ~]# yum install postgresql96-server | [root@postegresqlmaster ~]# yum install postgresql96-server | ||
Line 181: | Line 182: | ||
Starting postgresql-9.6 service: | Starting postgresql-9.6 service: | ||
[root@postegresqlmaster ~]# | [root@postegresqlmaster ~]# | ||
+ | </ | ||
+ | |||
+ | You can also start the database as follows, if you don't have a service: | ||
+ | |||
+ | <sxh bash> | ||
+ | / | ||
</ | </ | ||
Line 189: | Line 196: | ||
Initializing database ... OK | Initializing database ... OK | ||
</ | </ | ||
- | ====Initial connection and Password management==== | + | |
+ | Example for 12: | ||
+ | |||
+ | < | ||
+ | yum install -y https:// | ||
+ | yum install -y postgresql12-server | ||
+ | yum install -y postgresql12-contrib | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===Initial connection and Password management=== | ||
In order to log in, you have to set the password initially as follows: | In order to log in, you have to set the password initially as follows: | ||
Line 204: | Line 222: | ||
postgres=# | postgres=# | ||
</ | </ | ||
+ | |||
+ | ===Allow external Connections=== | ||
+ | In order to allow, external connections, | ||
+ | By default, PostgreSQL listens only on the loopback IP (e.g. 127.0.0.1) so you better change that to ' | ||
+ | |||
+ | <sxh bash> | ||
+ | [root@postgresqlmaster data]# cat postgresql.conf | grep listen | ||
+ | listen_addresses = ' | ||
+ | </ | ||
+ | |||
+ | Like that, PostgreSQL will listen on port 5432 for IP: 192.168.0.178. You can also change the port (as soon as it isn't taken with the following setting: | ||
+ | |||
+ | <sxh bash> | ||
+ | [root@postgresqlmaster data]# cat postgresql.conf | grep port | ||
+ | port = 6000 # (change requires restart) | ||
+ | # supported by the operating system: | ||
+ | # supported by the operating system: | ||
+ | # %r = remote host and port | ||
+ | [root@postgresqlmaster data]# | ||
+ | </ | ||
+ | |||
+ | That PostgreSQL listens on certain port, doesn' | ||
+ | In order to allow a connection you have to add an entry there, per specified syntax: | ||
+ | |||
+ | <sxh bash> | ||
+ | [root@postgresqlmaster data]# cat pg_hba.conf | ||
+ | # PostgreSQL Client Authentication Configuration File | ||
+ | # =================================================== | ||
+ | # | ||
+ | # Refer to the " | ||
+ | # documentation for a complete description of this file. A short | ||
+ | # synopsis follows. | ||
+ | # | ||
+ | # This file controls: which hosts are allowed to connect, how clients | ||
+ | # are authenticated, | ||
+ | # databases they can access. | ||
+ | # | ||
+ | # local DATABASE | ||
+ | # host | ||
+ | </ | ||
+ | |||
+ | Where the fields stands for: | ||
+ | - Source can be either: Host (for external connections) or Local (for local connections) | ||
+ | - The database to which you wish to connect, can be: " | ||
+ | - User which will be user or (+ = role) | ||
+ | - Address which the connection will be coming (omitted for local and IP for host type) | ||
+ | - Method of the authentication: | ||
+ | - OPTIONS - additional options like LDAP (Pam) and so on. | ||
+ |