In our case, we are granting all database users access to all databases with any IP address range, thus, letting any IP address connect. This file stores the client authentication, each record specifies an IP address range, database name, username, and authentication method. Modify this section: # IPv4 local connections: Open the file with your preferred editor: nano /etc/postgresql/10/main/pg_hba.conf Next, modify pg_hba.conf to also allow connections from everyone. Uncomment, and change the value to '*', this will allow Postgres connections from anyone. Look for this line in the file: #listen_addresses = 'localhost' To begin, open the configuration file with your preferred editor: nano /etc/postgresql/10/main/nf In this step, we will look at how to configure Postgres to accept external connections. This command above will create a new database named egypt and assign cleopatra to be the database user. To do this, run the following command: createdb -O cleopatra egypt Next, we will be assigning cleopatra to a database. A superuser is a user that has all the privileges available on a Postgres instance. I named my user role cleopatra and I made my user a superuser. Shall the new role be a superuser? (y/n) y Here is an example: Enter name of role to add: cleopatra While still being logged in as postgres run the following command to create a new user: createuser -interactive -pwpromptĪ prompt will be shown to you asking you to input your desired user role, name, password, and if you want the user to be a superuser. To create a new user, exit the Postgres shell by executing: \q In this step, you will be creating a new user that will be used to access your Postgres database remotely. You will be shown something similar to this: psql You can access the Postgres shell by running: psql The server user will be switched from root to postgres. When the process is complete, switch the user to postgres to be able to execute Postgres commands with Postgres default user by running: su - postgres This will install Postgres along with its associated dependencies. When that is done, install Postgres by running: sudo apt-get install postgresql postgresql-contrib Next, update your server packages and dependencies by running: sudo apt-get update Then input your relevant user password or SSH key password if any. Server_ip is the IP address of your server The first thing to do is SSH into your server by running: ssh is your server user you would like to log in with In this step, you will be installing Postgres on your server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |