Thursday , November 21 2024

How To Install PostgreSQL 9.6 on Debian 8.x (Jessie)

 

As you know, at the end of September 2016, PostgreSQL version 9.6 was released.

In this article you will find the installation steps of PostgreSQL 9.6 on a minimal Debian 8.x (Jessie).

In addition, we will create a database with Turkish support. You can configure it to support your own language.

Since PostgreSQL supports UTF-8, you can store characters in any language in the database.

However, some special situations may occur according to languages.

For example, The upper case of the ”i“ in Turkish is ”İ” and the upper case of the “i” in English is “I”.

This means that the output of the various functions will be different according to the language. In PostgreSQL, these settings are made when creating a database. (different language support can be used in the same database, but I won’t go into this detail)

 

Precondition

This article begins by assuming that a minimal Jessie installation with ssh support is performed and you have root privileges.

In addition, a shell editor such as vim / nano should be available. I’ll use vim in the article.

 

Installation

Debian Language settings

First, let’s check whether the default locale of our operating system and Turkish locale are installed or not.

If you do not have Turkish locale, let’s install it. To check the default locale;

 

Our default language is en_US.UTF-8 We note this and continue with the following command.

 

Let’s make sure that “[*] tr_TR.UTF-8 UTF-8” is selected (you can select it with space) and press <OK> (you can switch to Tab).

 

We’ve already looked at what was the default locale. We continue our way of choosing it. The purpose of this is to keep the language settings of the services that are already running. In our case this was en_US.UTF-8

 

When you press <OK>, the result should be as follows. Thus, we are sure that there is Turkish language support in our operating system.

 

PostgreSQL Installion:

We already have PostgreSQL packages in Debian, but because we want to install a higher version of PostgreSQL, we use PostgreSQL’s own repository.

In our case, Jessie comes with version 9.4 of PostgreSQL but we want to install version 9.6.

Let’s add our repository;

 

Then we write the following line into the document. This way, Jessie also checks the URL we provide when searching for available packages.

 

Save and exit;

 

We add the key of Repository to reliable keys.

 

 

We are updating the package list;

 

Let’s install PostgreSQL; Let’s continue by saying ‘Y’ to the question;

 

The following information gives us information about where our data files are located.

 

Our configuration files are in “/etc/postgresql/9.6/main” and our data files are in “/var/lib/postgresql/9.6/main”.

These are the default settings and can be changed as desired. We’re not going into that detail for now.

 

Let’s check that our PostgreSQL service is running;

 

How To Create a Database With Turkish Language?(or your own language)

We have installed PostgreSQL. Now we can create the database into it.

Because our operating system’s default locale is en_US.UTF-8, PostgreSQL has created a cluster in the default language.

If we create a new database without providing a parameter, the database will be created according to the default locale (en_US.UTF-8 locale).

If our default language in our operating system was tr_TR.UTF-8, then it wasn’t necessary.

Because most operating systems are in English, we need to check them.

Let’s log into PostgreSQL;

There are several ways. One of them is to log in with the postgres user created during the installation. First we switch to the postgres user. then connect to the database using psql.

 

Lets create the database;

 

You can connect to the newly created database by using the command “\ c testdb”.

 

Let’s test the Turkish characters and their order;

 

Our Turkish database is ready.  You can create a database that supports your own language by making minor changes.

We have not yet made the necessary settings to access the postgreSQL server from another computer. We only access it from the computer where it is installed. In another article, we will go into details about access.

Loading

About Şahap Aşçı

Leave a Reply

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