Installing PostgreSQL 14 on RHEL 7.9
Using RPM repository
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql14-server
/usr/pgsql-14/bin/postgresql-14-setup initdb systemctl enable postgresql-14 systemctl start postgresql-14 systemctl status postgresql-14
|
Configuring PostgreSQL 14
- Adding environment variable.
~]# su - postgres $ echo 'export PATH=/usr/pgsql-14/bin:$PATH' >> ~/.bash_profile $ source ~/.bash_profile
|
- Changing default user postgres password.
$ psql
postgres=# \password Enter new password for user "postgres": Enter it again: postgres=# postgres=# \q
|
Management
=# create database demo; =# \c demo; =# create table t1 (id int, name varchar(20)); =# insert into t1 (id, name) values (1, 'a'); =# select * from t1; id | name
1 | a (1 row)
|
Reference
・ https://www.postgresql.org/docs/
・ https://www.postgresql.org/download/linux/redhat/