Community Blog How to Install PostgreSQL on Ubuntu

How to Install PostgreSQL on Ubuntu

In this article, you will get some information on the installation of PostgreSQL on Ubuntu.

How to Install PostgreSQL for SonarQube on Ubuntu 16.04

In this tutorial, we will be installing and configuring SonarQube on an Alibaba Cloud Elastic Compute Service (ECS) instance with Ubuntu 16.04.

SonarQube supports PostgreSQL, MySQL, MSSQL and Oracle. In this tutorial, I will use PostgreSQL as MySQL is not recommended for large instances. For using MySQL, you can only use bundled mysql-connector-java. InnoDB engine is a must in MySQL. To avoid such restrictions, I strongly recommend using PostgreSQL. Follow the steps below to install PostgreSQL.

Step 1: Install PostgreSQL repo.

# sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
# wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Step 2: Now install the PostgreSQL server by executing the command below.

# sudo apt-get -y install postgresql postgresql-contrib

Step 3: Execute the following command to start and enable PostgreSQL server so that it can start automatically after reboot.

# sudo systemctl start postgresql
# sudo systemctl enable postgresql

Setting up a PostgreSQL Database on Ubuntu

In this guide, we will install and set up a PostgreSQL database on an Ubuntu instance using Alibaba Cloud Elastic Compute Service (ECS).

After you have an instance installed with Ubuntu OS, follow the steps below

1. SSH into your instance using your key pair for Linux user. For windows, you can use SSH client such as putty to connect to your instance.

2. We have to update & upgrade our Ubuntu to latest packages using the commands below

sudo apt-get update && sudo apt-get upgrade

3. Install PostgreSQL by running the command below

sudo apt-get install postgresql

4. To check the version of PostgreSQL installed run psql -V

5. We are going to edit the PostgreSQL configuration file to change the address.

How to Setup PostgreSQL Server for Metabase

In this tutorial, you will get some information on the installation of PostgreSQL Server for Metabase on an Alibaba Cloud ECS Ubuntu 16.

By default, Metabase is configured to use H2 database. H2 database is a flat file based database and it does not require any special software to run. However, using an H2 database in the multi-user production environment is not recommended as it deteriorates the performance of the application. In this tutorial, we will use the PostgreSQL server from ApsaraDB for RDS to host the Metabase database. Go to “https://rdsnew.console.aliyun.com” and create a new RDS instance for PostgreSQL. Choose your subscription type and select region. Creating the RDS instance in the same region where your ECS instance is located gives you many leverages such as ECS and RDS instances can communicate using a private intranet address. We do not require to apply for an internet address and intranet data transfers are free of charge. For this tutorial, I have created the RDS instance in Mumbai region where my ECS instance is also located.

Related Market Product

Postgres Pro Standard Database 11 (Ubuntu 16)

Postgres Pro Standard Database provides early access to new PostgreSQL features and optimizations.

This image contains Postgres Pro Standard Database 11. Zabbix/Mamonsu monitoring solution is installed and preconfigured. OS fixes for Meltdown and Spectre issues are applied. L1 Terminal Fault vulnerability is eliminated.

Related Documentation

Configure HybridDB for PostgreSQL Writer

This topic describes the data types and parameters supported by HybridDB for PostgreSQL Writer and how to configure it in both Wizard and Script modes.

HybridDB for PostgreSQL Writer writes data into a HybridDB for PostgreSQL database. At the underlying implementation level, HybridDB for PostgreSQL Writer connects to a remote HybridDB for PostgreSQL database through JDBC, and runs SELECT statements to extract data from the database. On the public cloud, RDS provides the HybridDB for PostgreSQL storage engine.

Migrate data from MySQL to AnalyticDB for PostgreSQL

The mysql2pgsql tool supports migrating tables in MySQL to AnalyticDB for PostgreSQL, Greenplum Database, PostgreSQL, or PPAS without storing the data separately. This tool connects to the source MySQL database and the target database at the same time, querries and retrieves the data to be exported in the MySQL database, and then imports the data to the target database by using the COPY command. It supports multithread import (every worker thread is in charge of importing a part of database tables).

Related Products

AnalyticDB for PostgreSQL

ApsaraDB HybridDB for PostgreSQL is an online MPP (Massively Parallel Processing) data warehousing service based on the open source Greenplum Database.

ApsaraDB HybridDB provides online expansion and performance monitoring service to free your team from complicated MPP cluster operations and management (O&M). This enables database administrators, developers and data analysts to focus on upgrading enterprise productivity through SQL development.


DataWorks is a Big Data platform product launched by Alibaba Cloud. It provides one-stop Big Data development, data permission management, offline job scheduling, and other features.

DataWorks works straight ‘out-the-box’ without the need to worry about complex underlying cluster establishment and Operations & Management.

Related Course

Introduction to HybridDB for PostgreSQL

This course starts from the comparison between OLTP and OLAP business types and then have a introduction to Greenplum database, which is quite widely used analytic type database in the world. Then there will be introduction about the features and operations of HybridDB for PostgreSQL, which is a database service based on Greenplum.

0 0 0
Share on

Alibaba Clouder

1,219 posts | 198 followers

You may also like