Software & AppsOperating SystemLinux

How To Install PostgreSQL 9.5 in Ubuntu 18.04?

Ubuntu 5

In this article, we will be discussing how to install PostgreSQL 9.5 in Ubuntu 18.04. PostgreSQL is a powerful, open-source object-relational database system. However, the default repositories for Ubuntu 18.04 include PostgreSQL versions 9.6, 10, and 11. If you specifically require PostgreSQL 9.5 for compatibility reasons, you will need to manually install it.

Quick Answer

To install PostgreSQL 9.5 in Ubuntu 18.04, you will need to manually download the required packages from the official Ubuntu website and install them using the apt command. This process is specific to PostgreSQL 9.5 and Ubuntu 18.04.

Prerequisites

Before we begin, ensure that you have a non-root user with sudo privileges. You can follow this initial server setup guide for instructions on how to do this.

Step 1: Downloading the Required Packages

First, you need to manually download the following two .deb files from the official Ubuntu website:

Step 2: Changing the Directory

Once the files are downloaded, change the directory to the location where you downloaded the .deb files using the cd command. For example, if you downloaded the files to the Downloads directory, you would use the following command:

cd ~/Downloads

Step 3: Installing the Required Dependencies

Next, we need to install the required dependencies. Run the following command to do so:

sudo apt install libedit2 libpq5 libssl1.0.0 postgresql-client-common zlib1g libgssapi-krb5-2 libldap-2.4-2 libpam0g libxml2 postgresql-common locales ssl-cert tzdata sysstat

This command uses the sudo prefix to run the command as the superuser. The apt install command is used to install packages, and the packages listed after are the required dependencies for PostgreSQL 9.5.

Step 4: Installing PostgreSQL 9.5

Now, we can install PostgreSQL 9.5. Run the following command to do so:

sudo apt install ./postgresql-client-9.5_9.5.12-0ubuntu0.16.04_amd64.deb ./postgresql-9.5_9.5.12-0ubuntu0.16.04_amd64.deb

This command uses the sudo prefix to run the command as the superuser. The apt install command is used to install packages. The ./ before the package names tells the system to look for the packages in the current directory.

Conclusion

Congratulations! You have successfully installed PostgreSQL 9.5 on Ubuntu 18.04. Remember, this process is specific to PostgreSQL 9.5 and Ubuntu 18.04. If you are using a different version of PostgreSQL or Ubuntu, you will need to adjust the version numbers and file names accordingly.

If you encounter any issues during the installation process, the official PostgreSQL documentation is a great resource.

Can I install PostgreSQL 9.5 using the default repositories in Ubuntu 18.04?

No, the default repositories for Ubuntu 18.04 include PostgreSQL versions 9.6, 10, and 11. If you specifically require PostgreSQL 9.5, you will need to manually install it.

What are the prerequisites for installing PostgreSQL 9.5 in Ubuntu 18.04?

Before installing PostgreSQL 9.5, make sure you have a non-root user with sudo privileges. You can refer to the "initial server setup guide" mentioned in the article for instructions on how to set up a non-root user with sudo privileges.

Where can I download the required packages for installing PostgreSQL 9.5?

You can download the required .deb files for PostgreSQL 9.5 from the official Ubuntu website. The article provides direct download links for the two necessary packages.

How do I install the required dependencies for PostgreSQL 9.5?

To install the required dependencies, run the command mentioned in step 3 of the article. It will install the necessary packages using the apt package manager.

How do I install PostgreSQL 9.5 in Ubuntu 18.04?

After downloading the required packages and installing the dependencies, run the command mentioned in step 4 of the article. It will install PostgreSQL 9.5 using the apt package manager.

Can I use these instructions for installing other versions of PostgreSQL or different Ubuntu versions?

No, these instructions are specifically for installing PostgreSQL 9.5 on Ubuntu 18.04. If you are using a different version of PostgreSQL or a different version of Ubuntu, you will need to adjust the version numbers and file names accordingly.

Leave a Comment

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