• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Arch

How To Install PostgreSQL 11.1 On Arch Linux

How VPS by How VPS
August 8, 2019
in Arch, Uncategorized
0
0
SHARES
66
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Prerequisites
  2. Install PostgreSQL 11.1 Database
  3. Consider a Firewall
  4. Prepare for Upgrades
    1. Handle Minor Version Upgrades
    2. Handle Major Version Upgrades
  5. Want to contribute?


Prerequisites

  • A Vultr server running up to date Arch Linux (see this article.)
  • Sudo access.
    • Commands required to be ran as root are prefixed by #, and ones that can be ran as a regular user by $. The recommended way to run commands as root is to, as a regular user, prefix each of them with sudo.

Install PostgreSQL 11.1 Database

Install PostgreSQL:

# pacman -S postgresql

If you run the Btrfs filesystem, you should consider disabling copy-on-write for the database directory:

# chattr +C /var/lib/postgres/data/

This package creates the user postgres on your system.

Initialize the database cluster. This must be done by the new postgres user, and this command will do this as long as your user account is setup with sudo privileges:

$ sudo -iu postgres initdb -D /var/lib/postgres/data

Start PostgreSQL, and make it start after every boot:

# systemctl enable --now postgresql

Connect to PostgreSQL, as database user postgres which acts as the database root user:

# psql -U postgres

Then set a password:

postgres-# /password postgres

Now quit:

postgres-# /q

Consider a Firewall

You may want to consider configuring a firewall. By default, PostgreSQL will listen on port 5432 not only from localhost, but also from anywhere on your public IP address. PostgreSQL will also only approve incoming connections from localhost, but external attempts will still reach PostgreSQL and get the following error: no pg_hba.conf entry for host.

Although PostgreSQL is considered quite secure, it’s more secure to have a firewall not even give external packets to the PostgreSQL server, unless absolutely necessary. Even if direct remote access is desired, using a firewall to block the traffic and using a VPN would be more secure.

Prepare for Upgrades

By default, pacman will upgrade PostgreSQL when new versions are released to the official Arch repositories, when you upgrade your entire Arch system by running the following command:

# pacman -Syu

It is strongly recommended to configure pacman to not automatically install upgrades to PostgreSQL. When an upgrade is released and you upgrade your entire Arch system, pacman will let you know a new version is available. Edit /etc/pacman.conf, and add the following:

IgnorePkg   = postgresql*

Handle Minor Version Upgrades

When pacman shows you there is a minor version upgrade, such as 11.0 to 11.1, PostgreSQL’s versioning policy is that you can safely perform the upgrade. That said, it is a good idea to backup your database first.

To perform a minor upgrade, stop PostgreSQL and confirm it is stopped:

# systemctl stop postgresql
# systemctl status postgresql

Then, force upgrading the packages:

# pacman -S postgresql postgresql-libs

Start PostgreSQL:

# systemctl start postgresql

Handle Major Version Upgrades

When pacman shows there is a major version upgrade, such as 11.x to 12.x, it’s recommended to check PostgreSQL’s website, as well as Arch’s website, to see if there are steps you must perform to properly upgrade. In the past, when PostgreSQL has given such steps, skipping them prevented databases from working. It’ is highly recommended that you backup your database first, as these upgrades are more risky.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Use HTTPS on Arch Linux Webserver

Next Post

How to Install PHP 7.3 on an Arch Linux Webserver

Next Post

How to Install PHP 7.3 on an Arch Linux Webserver

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet