CR Sardar
CR Sardar

Reputation: 1018

AWS EC2 Amazon Linux 2 AMI Starting PostgreSQL

Have an AWS EC2 instance which is running Amazon Linux AMI 2. Installed PostgreSQL using

 sudo amazon-linux-extras install postgresql13 

Now, how to start it and configure it?

I can see Package postgresql-13.3-2.amzn2.0.1.aarch64 already installed...

Upvotes: 4

Views: 3326

Answers (2)

Marcin
Marcin

Reputation: 238289

The command

sudo amazon-linux-extras install postgresql13 

installs only the client. This is not server. You still have to setup server separately apart from the client yourself.

Thus, to install postgresql 13, you have install the client (if you haven't done so yet). It is needed as Amazon Linux 2 will install matching server (v13), not default version 9.

sudo amazon-linux-extras install postgresql13 

and now install server (this should install v13, as it matches your client):

sudo yum install postgresql-server

now you enable it:

sudo systemctl enable postgresql

initialize it:

sudo /usr/bin/postgresql-setup --initdb

start it:

sudo systemctl start postgresql

and finally check its status:

sudo systemctl status postgresql

Upvotes: 13

Nikhil B
Nikhil B

Reputation: 393

You can use below command to start the installed service in AML-2

$ sudo systemctl start postgresql-13
$ sudo systemctl status postgresql-13

Now to configure the postgresql server you need to configure postgresql.conf file which you can find by

$ find / -name postgresql.conf

or you can ask postgresql where is postgresql.conf

$ psql -U postgres -c 'SHOW config_file'

you can begin with postgresql configurations

also refer install pg13 on amzl-2 and validate your installation

Upvotes: 1

Related Questions