PostgreSQL is a powerful, open-source relational database system that is widely used for various applications. In this guide, we will walk you through the installation and basic usage of PostgreSQL 13 on Rocky Linux.
Step 1: Update Your System
Before starting the installation, ensure your system is up to date:
sudo dnf update -y
Step 2: Install PostgreSQL 13
To install PostgreSQL 13, execute the following command:
sudo dnf install -y postgresql13 postgresql13-server
Step 3: Initialize the Database
After installation, you need to initialize the PostgreSQL database:
sudo /usr/pgsql-13/bin/postgresql13-setup initdb
Step 4: Start and Enable PostgreSQL Service
Start the PostgreSQL service and enable it to start on boot:
sudo systemctl start postgresql-13
sudo systemctl enable postgresql-13
Step 5: Configure PostgreSQL to Allow Remote Access (Optional)
If you need to access PostgreSQL remotely, edit the configuration file:
sudo nano /var/lib/pgsql/13/data/postgresql.conf
Uncomment and change the following line:
listen_addresses = '*'
Next, edit the pg_hba.conf
file to allow connections:
sudo nano /var/lib/pgsql/13/data/pg_hba.conf
Add the following line at the end of the file to allow access from any IP:
host all all 0.0.0.0/0 md5
Step 6: Restart PostgreSQL
Restart PostgreSQL to apply the changes:
sudo systemctl restart postgresql-13
Step 7: Access PostgreSQL
To access PostgreSQL, switch to the postgres
user:
sudo -i -u postgres
Then, access the PostgreSQL shell:
psql
You can now start creating databases and managing your data!
Conclusion
You have successfully installed and set up PostgreSQL 13 on Rocky Linux. This robust database system will help you manage your data efficiently.
If you're looking for a reliable hosting solution for your database and applications, consider using Windows VPS UK. With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need VPS UK Windows or Windows Virtual Private Servers, you'll find a solution that fits your requirements.
For larger deployments or enterprise needs, explore Windows Virtual Dedicated Server Hosting or Virtual Private Server Hosting Windows. Whether you're located in the UK, Italy, or elsewhere, Windows VPS Italy and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your needs.