Postgresql ��� linux mint

Как установить PostgreSQL на Linux Mint 20

Как установить PostgreSQL на Linux Mint 20

В этом руководстве мы покажем вам, как установить PostgreSQL на Linux Mint 20. Для тех из вас, кто не знал, PostgreSQL — это система управления реляционными базами данных, которая обеспечивает реализацию языка запросов SQL. Он соответствует стандартам и имеет множество расширенных функций, таких как надежные транзакции и параллелизм без блокировок чтения.

В этой статье предполагается, что у вас есть хотя бы базовые знания Linux, вы знаете, как использовать оболочку, и, что наиболее важно, вы размещаете свой сайт на собственном VPS. Установка довольно проста и предполагает, что вы работаете с учетной записью root, в противном случае вам может потребоваться добавить ‘ sudo ‘ к командам для получения привилегий root. Я покажу вам пошаговую установку PostgreSQL на Linux Mint 20 (Ульяна).

Установите PostgreSQL на Linux Mint 20 Ulyana

Шаг 1. Во-первых, убедитесь, что все ваши системные пакеты обновлены, выполнив следующие apt команды в терминале.

Шаг 2. Установка PostgreSQL на Linux Mint.

Давайте установим сервер Postgresql, используя следующую команду:

Дождитесь завершения процесса установки. По умолчанию служба PostgreSQL запускается автоматически после установки. Вы можете подтвердить, что он запущен, с помощью команды:

Шаг 3. Роли и базы данных PostgreSQL.

И пользователь, и группа представлены в PostgreSQL как термины-роли для обработки прав доступа к базе данных. Ident , Trust , Password И Peer различные методы аутентификации в PostgreSQL. Ident метод в основном используется для соединения TCP / IP, в то время Trust как метод используется для подключения без пароля с использованием заданных критериев в файле. pg_hba . conf

Шаг 4. Доступ к командной строке PostgreSQL.

После установки сервера базы данных PostgreSQL по умолчанию он создает пользователя postgres с ролью postgres . Он также создает системную учетную запись с тем же именем ‘ postgres ‘. Итак, чтобы подключиться к серверу Postgres, войдите в свою систему как пользователь Postgres и подключите базу данных:

Теперь вы вошли на сервер базы данных PostgreSQL. Чтобы проверить информацию для входа в систему, используйте следующую команду из командной строки базы данных:

Чтобы отключиться от командной строки базы данных PostgreSQL, просто введите приведенную ниже команду и нажмите клавишу ВВОД. Он вернет вас обратно в командную строку Ubuntu:

Создайте нового пользователя и базу данных:

Поздравляю! Вы успешно установили PostgreSQL . Благодарим за использование этого руководства для установки последней версии PostgreSQL в системе Linux Mint. Для получения дополнительной помощи или полезной информации мы рекомендуем вам посетить официальный сайт PostgreSQL .

Читайте также:  Курсор мыши для windows 10 неон

Источник

How to Install PostgreSQL with pgAdmin4 on Linux Mint 20

pgAdmin is an open-source feature-rich, frontend management tool that allows you to easily administer and manage your PostgreSQL relational database from a web browser.

It provides an easy-to-use user interface that simplifies the creation and monitoring of databases and database objects. PgAdmin 4 is an improvement of the earlier pgAdmin tool and is available for Linux, Windows, macOS systems, and even a Docker container.

In this tutorial, you will learn how to install PostgreSQL with pgAdmin4 on Linux Mint 20.

Step 1: Install PostgreSQL Database on Linux Mint

1. To start off, launch your terminal and update your packages using the apt package manager as shown.

Once the update is complete, proceed to the next step.

Since pgAdmin4 provides a frontend interface for the management of PostgreSQL database objects, it’s essential to have PostgreSQL installed first.

2. To do this, we are going to install the postgresql package and postgresql-contrib which offers extended features that extend the functionality of PostgreSQL.

Install PostgreSQL on Linux Mint

3. Usually, PostgreSQL starts automatically on boot up. You can confirm this using the command given below:

Check PostgreSQL Status

4. To log in to your PostgreSQL instance, first switch to the postgres user. The Postgres user comes included by default with the installation of PostgreSQL. Then run the psql command as shown.

Connect to PostgreSQL Shell

5. Additionally, you can check if the database server is accepting incoming connections as shown.

Check PostgreSQL Accepting Incoming Connections

Step 2: Install pgAdmin4 on Linux Mint

pgAdmin4 is available for Ubuntu 16.04 and later versions and can easily be installed using the APT package manager. The same cannot support Linux Mint 20 and Pgadmi4 developers are yet to include support that allows users to easily install the frontend management tool using the APT package manager.

6. The only viable option is to install pgAdmin4 from a virtual environment. So first, we will install the prerequisite packages as shown.

Install Prerequisite Packages

7. Next, install the Python virtual environment and associated dependencies.

Install Python Virtual Environment

8. Next, create a directory where you will create a virtual environment.

9. Then create the virtual environment as shown. Here, pgadmin4env is the name of the virtual environment.

Create Virtual Environment for pgAdmim4

10. Once the virtual environment is in place, activate it as shown.

11. Then use the pip tool to install pgadmin4 as shown.

Install PgAdmin4 in Linux Mint

12. Next, create a configuration file config_local.py.

and add the lines below.

Create PgAdmin4 Configuration

13. To start the pgAdmin4 management tool, invoke the command:

Start PgAdmin4 Service

14. Finally, head over to your browser and browse the address shown.

You will be prompted to set the master password, so proceed and set a strong password and click the ‘Ok’ button.

Set PgAdmin4 Password

15. To make things easier, you can create an alias in the

/.bashrc file as shown.

16. Next, update the bashrc file.

17. Finally, you can start the pgAdmin4 management tool by simply invoking the startpg command.

Start PgAdmin4 Tool

Once again head over to your browser and log in to the PgAdmin4 interface. And this concludes the installation of pgAdmin4 on Linux Mint.

Читайте также:  Windows internals part 1 7th edition

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

How to Install PostgreSQL 13 on Linux Mint 20 Ulyana

PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

PostgreSQL is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.

The PostgreSQL Global Development Group had announced the release of PostgreSQL 13.1 a while ago. This guide will show you how to quickly get PostgreSQL 13.1 up and running on an Linux Mint 20 (Ulyana) system. It will cover from installing PostgreSQL to explore the basics of PostgreSQL database administration, including setting up a new user and database.

Install PostgreSQL 13 on Linux Mint 20 Ulyana

Linux Mint 20 «Ulyana» is built on top of the latest Ubuntu 20.04 LTS «Focal Fossa», so therefore this guide should also be applicable to Ubuntu 20.04 «Focal Fossa» too.

Ubuntu includes PostgreSQL by default, which should be sufficient for common usage. As the time of this writing, the latest version available on Ubuntu’s repository is 12.5-0ubuntu0.20.04.1.

As this guide suggest, we’ll install newest version available from PostgreSQL Apt Repository. In that page we’ll able to configure what specific version we want to be installed on our system.

Postgresql Apt Repository currently support:

  • Debian 9 (stretch), 10 (buster), 11 (bullseye), and unstable (sid)
  • Ubuntu 16.04 (xenial), 18.04 (bionic), 20.04 (focal), 20.10 (groovy, amd64 only)
  • Architectures: amd64 (64-bit x86), i386 (32-bit x86, being phased out), arm64 (64-bit ARM), ppc64el (little-endian 64-bit POWER)
  • PostgreSQL 9.5, 9.6, 10, 11, 12, 13, 14 devel
  • Server extensions such as Slony-I, various PL languages, and datatypes
  • Applications like pgadmin4, omnidb, pgbouncer, and pgpool-II

Add the PostgreSQL Package Source

We need to create a sources file reflecting the proper PostgreSQL source for our Linux Mint 20 «Ulyana» distribution. As noted above, we’ll use the «focal» release of Ubuntu. We can accomplish this from the terminal to add the file (make sure to use sudo in all of the following steps):

Add the PGDG APT source file

Create a file at /etc/apt/sources.list.d/postgresql.list with the following command:

Add the PostgreSQL Package Repository Key

Next, add the package repository key:

Update, Upgrade, and Install PostgreSQL

Update system package source. Once this task is done, we proceed with upgrade packages to the latest versions.

Please note that this can be a long process, depends on your internet connection and how frequent you’re upgrading your packages. Also please note that you may be prompted at several points to make some choices about configuration items. Specifically, you may informed that this that or the other configuration file has been changed, and asked if you want to keep your original version, or replace with the package maintainer’s version. Select «Y» to accept the package maintainer’s version in these cases.

Next step is installing PostgreSQL 13:

Читайте также:  Обновление windows 10 99 процентов долго

After pressing «Enter» you will be asked whether to continue with installation or not.After this operation, 58,5 MB of additional disk space will be used.

Press «Y» and then «Enter». It will then download all necessary files and continue with installation.

Verify PostgreSQL Installation

Let’s verify that we’ve installed PostgreSQL correctly. First we’ll check if the service is running. Then we can check what version of PostgreSQL server is running.

We can use the psql tool to connect with the PostgreSQL database server and printing its version:

The output will be something like this: psql (PostgreSQL) 13.1 (Ubuntu 13.1-1.pgdg20.04+1) . That’s it. You’ve successfully installed PostgreSQL 13.1 to your system and you can start using it.

Configuring Postgres for Use

The postgres user

While PostgreSQL become installed, a system user account named postgres was also created with an identical user account in postgres. By default, the postgres user account isn’t configured with a password, so it isn’t viable to log into the server the use of the postgres user account without first creating a password for it. This postgres account has an all-access pass on your PostgreSQL database server, permission-wise. The postgres user account has similarities to the sa account in SQL server.

The postgres database

PostgreSQL is installed with a default database postgres . For the most part, we use the postgres database for administration functions, and create new databases on the PostgreSQL server to suit our needs.

The psql Command Line Utility

PostgreSQL consists of psql , a command line application for managing your databases and server. While a GUI-based software such as pgadmin3 is often less complicated to use in the daily task, the command line utilty psql is always handy. psql gives total control of your postgres system from the terminal, together with the ability to execute SQL queries.

We will use psql to perform our preliminary configuration and to create an initial database super user.

Create super user account

In this step we will super-user account to deals with our database in the daily task.

To do this, we will get access to the postgres account through your machine root user. Then we’ll use that postgres account to create a brand new super-user account for your PostgreSQL installation which can be regulated more efficiently. As an example we will use jason as our new PostgreSQL super-user account.

Notice in the above we can enter multiple lines of command in SQL shell. The SQL is not executed until semi-colon followed enter is found. Which means, the semi-colon will make the shell execute entered commands. After pressing «Enter» it will respond with something like this:

Which means we’ve successfully created this new superuser account.

Login using our newly created account

Let’s verify that everything is working correctly. Try to log in with psql using our new super-user account and create a quick test database:

Note in the above terminal session, we specified the postgres default database when we logged in, since there aren’t yet any other databases to connect to.

Create test database

Next test is to create test database test_database using our new super-user account:

Final Words

I hope that you now know how to install PostgreSQL 13.1 on Linux Mint 20 Ulyana. If you run into any issues or have any feedback feel free to drop a comment below.

Источник

Оцените статью