As I’m working on an array of projects with wildly differing technology stacks, I tend
to switch between different development environments on my work machine. I used to
keep a separate PostgreSQL installation per environment as a way to keep data close to the application. However, PostgreSQL is perfectly capable of accepting remote connections. The better
approach is to have a single PostgreSQL instance directly installed on the host OS where
all database live, serving as a single point of entry for all local projects.
Dispatches from my digital life.
As I’m working on an array of projects with wildly differing technology stacks, I tend to switch between different development environments on my work machine. I used to keep a separate PostgreSQL installation per environment as a way to keep data close to the application. However, PostgreSQL is perfectly capable of accepting remote connections. The better approach is to have a single PostgreSQL instance directly installed on the host OS where all database live, serving as a single point of entry for all local projects.
This is a quick walkthrough on getting up and running with PostgreSQL on Fedora.
Step 1: Installation of PostgreSQLAdd the PostgreSQL yum repo:
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-34-x86_64/pgdg-fedora-repo-latest.noarch.rpm
Install PostgreSQL. Here I’m going with PostgreSQL 10.
sudo dnf install postgresql10-server postgresql10
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
sudo systemctl start postgresql-10
sudo systemctl enable postgresql-10
The installation will create a postgres UNIX user on your system. Postgres is configured by default to log in with system user accounts.The postgres user is a superuser for PostgreSQL. The postgres user is setup without a password in PostgreSQL.
So, let’s change the password first by logging with psql and executing a SQL query:
sudo -i -u postgres
psql
> psql (10.21)
> Type "help" for help.
postgres=# alter user postgres with password 'postgres';
> ALTER ROLE
Next up, we want to allow access from local connections to the PostgreSQL server. We’ll edit the /var/lib/pgsql/10/data/postgresql.conf file:
sudo vim /var/lib/pgsql/10/data/pg_hba.conf
Alter the IPv4 section so it reads:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all localhost md5
This allows connections from the loopback device as well as 127.0.0.1. The md5 modifier allows for authentication with PostgreSQL user accounts that aren’t tied to a system user.
You’ll need to change that if you want access to PostgreSQL on your host from a vagrant guest:
host all all 10.0.2.1/24 md5
Then connect from with your guest with the IP of your host in the database connection string. To find the IP of the host from within the guest:
netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10
Here we create a database user netsensei and a new database called netsensei. We also make
the new user owner of the new database. Also notice how we’re setting the collation during creation.
sudo -i -u postgres
# e.g. netsensei
createuser --interactive
createdb netsensei -O netsensei -T template0 -l en_US.UTF-8 -E UTF8
Let’s set the privileges on the database via psql:
sudo -i -u postgres
psql
> psql (10.21)
> Type "help" for help.
postgres=# grant all privileges on database netsensei to netsensei ;
> GRANT
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | FESB и PostgreSQL. Кейс «Отметка по дате изменения» | 0 | 6.89 | 19-08-2026 |
| 2 | When failover isn’t safe: Building high-availability PostgreSQL on Kubernetes | 0 | 12.04 | 04-06-2026 |
| 3 | PostgreSQL 19 Beta 2 Released! | 5 | 7 | 16-07-2026 |
| 4 | Downgrading your Linux kernel on Fedora | 0 | 12.1 | 08-06-2022 |
| 5 | From PostgreSQL 12 to MariaDB 11: A Gradual Fintech Migration with 23% Lower TCO | 0 | 13.97 | 21-07-2026 |
| 6 | [Перевод] Статистика PostgreSQL: почему запросы выполняются медленно | 0 | 7.74 | 19-08-2026 |
| 7 | True enterprise sovereignty is more approachable than ever, thanks to K8s-powered cloud-neutral PostgreSQL | 0 | 14.92 | 07-04-2026 |
| 8 | PostgreSQL Conference Japan 2026 | 0 | 16.2 | 27-11-2026 |
| 9 | Mehrere Probleme in restic (Fedora) | 0 | 10 | 29-07-2026 |
| 10 | Which Kubernetes distros does Portainer work with? | 5 | 7 | 17-03-2026 |