Tutorial:
Step 1: Update Your System
Update the package lists to ensure you have the latest versions of packages:
Step 2: Install PostgreSQL
Ubuntu includes PostgreSQL in its default repositories. Install it using:
Step 3: Start and Enable PostgreSQL Service
Make sure the PostgreSQL service is running and enable it to start on boot:
Step 4: Switch to the PostgreSQL User
PostgreSQL creates a default user named postgres
. Switch to this user:
Step 5: Access the PostgreSQL Command Line
Enter the PostgreSQL interactive terminal:
Step 6: Create a New Database and User
In the PostgreSQL prompt, you can create a new database and user:
Exit the prompt with:
Step 7: Allow Remote Connections (Optional)
If you want PostgreSQL to accept remote connections:
- Edit the PostgreSQL configuration file:
Find and update the
listen_addresses
line to: - Configure the client authentication:
Add the following line:
- Restart PostgreSQL:
Step 8: Test the Installation
Check the PostgreSQL version to confirm successful installation:
You’re all set to start using PostgreSQL on Ubuntu 22.04!
No episodes found.Posted in Database, Ubuntu