2. Go through the installer and install the database.
2. Go through the installer and install the database.
3. Launch the psql program and make a database user and a database (press enter until the shell asks for the password configured in the installation). Type the following commands:
3. Launch the psql program and make a database user and a database (press enter until the shell asks for the password configured in the installation). Type the following commands:
* CREATE USER myusername WITH PASSWORD 'mypasswd';
```SQL
* CREATE DATABASE 'mydbname';
CREATE USER myusername WITH PASSWORD 'mypasswd';
* GRANT ALL PRIVILEGES ON DATABASE 'mydbname' TO 'myusername';
CREATE DATABASE 'mydbname';
*\connect 'mydbname'
GRANT ALL PRIVILEGES ON DATABASE 'mydbname' TO 'myusername';
* GRANT CREATE ON SCHEMA public TO 'myusername';
\connect 'mydbname'
GRANT CREATE ON SCHEMA public TO 'myusername';
Note: The last line is required since release 15 of Postgresql.
```
*Note: The last line is required since release 15 of Postgresql.*
In case you are running along with a server set up, it is recommended to have 'mydbname' to be the same as the one on the server.
In case you are running along with a server set up, it is recommended to have 'mydbname' to be the same as the one on the server.
...
@@ -74,23 +75,19 @@ sudo apt install postgresql
...
@@ -74,23 +75,19 @@ sudo apt install postgresql
Set up the datasbase, in your shell swich to the postgres user and run psql, e.g.,
Set up the datasbase, in your shell swich to the postgres user and run psql, e.g.,
```bash
```bash
sudo apt install postgresql
sudo su - postgres
```
```bash
psql
psql
```
```
Now, make the databases and users,
Set up a database and related users:
Then set up a database and related users:
```SQL
```SQL
CREATE USER myusername WITH PASSWORD 'mypasswd';
CREATE USER myusername WITH PASSWORD 'mypasswd';
CREATE DATABASE "mydbname";
CREATE DATABASE "mydbname";
GRANT ALL PRIVILEGES ON DATABASE 'mydbname' TO 'myusername';
GRANT ALL PRIVILEGES ON DATABASE 'mydbname' TO 'myusername';
\c mydbname
\connect mydbname
GRANT CREATE ON SCHEMA public TO 'myusername';
GRANT CREATE ON SCHEMA public TO 'myusername';
```
```
Note: The last line is required since release 15 of Postgresql. It must be executed on the new database.
*Note: The last line is required since release 15 of Postgresql. It must be executed on the new database.*
The default install of postgress does not allow external connections. We can adjest this by typing
The default install of postgress does not allow external connections. We can adjest this by typing