In this guide, you will learn how to install PostgreSQL 11 and PgAdmin4 on Ubuntu 18.04 LTS.
在本指南中,您将学习如何在Ubuntu 18.04 LTS上安装PostgreSQL 11和PgAdmin4 。
PostgreSQL is a free and open source cross-platform Relational Database Management System (RDBMS). It is widely used by developers in the development environment and in production environments as well. PostgreSQL 11 was released in November 2018 and comes with a wealth of new and exciting features.
PostgreSQL是一个免费的开源跨平台关系数据库管理系统(RDBMS)。 开发人员在开发环境和生产环境中也广泛使用它。 PostgreSQL 11于2018年11月发布,具有许多令人兴奋的新功能。
PgAdmin 4 is a free and open source web-based administration and development platform that helps users to administer, manage and monitor Postgres databases in a graphical manner. Let’s now dive in and see how we can install the two.
PgAdmin 4是一个免费的开源基于Web的管理和开发平台,可帮助用户以图形方式管理,管理和监视Postgres数据库。 现在,让我们深入了解如何安装两者。
To get started, begin by importing the GPG key for the PostgreSQL packages. Use the command below to download the CA certificates.
首先,请导入PostgreSQL软件包的GPG密钥。 使用下面的命令下载CA证书。
$ sudo apt install wget ca-certificates
Sample Output
样本输出
Next, run the command below to import the GPG key to your system.
接下来,运行以下命令以将GPG密钥导入您的系统。
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Output
输出量
Once done with importing the GPG key, append the PostgreSQL apt repository on your system.
导入GPG密钥后,将PostgreSQL apt存储库追加到您的系统上。
$ sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Before installing PostgreSQL 11, first, update the system repositories as shown.
在安装PostgreSQL 11之前,首先,如图所示更新系统存储库。
$ sudo apt-get update
Next, run this command to install PostgreSQL 11.
接下来,运行此命令以安装PostgreSQL 11。
$ sudo apt-get install postgresql postgresql-contrib
Output
输出量
By default, PostgreSQL database server creates a user ‘postgres‘ having the role ‘postgres‘.
默认情况下,PostgreSQL数据库服务器创建一个用户Postgres的具有作用“Postgres的。
To connect to the PostgreSQL 11 server, log in to your system and run the command below to change to the postgres user.
要连接到PostgreSQL 11服务器,请登录到系统并运行以下命令以更改为postgres用户。
$ sudo su - postgres
NOTE: The ‘postgres’ user’s password is disabled by default.
注意:默认情况下,禁用“ postgres”用户的密码。
Finally , to connect to the PostgreSQL 11 database server use the psql
command as shown.
最后,使用psql
命令连接到PostgreSQL 11数据库服务器。
psql
Output
输出量
To check login information, run the command below.
要检查登录信息,请运行以下命令。
postgres-# \conninfo
Output
输出量
To begin the installation of PgAdmin4, run the command below.
要开始安装PgAdmin4,请运行以下命令。
$ sudo apt-get install pgadmin4 pgadmin4-apache2
Output
输出量
During the installation process, you will be prompted for an email address as shown below. This is the email address you will use to log in to the PgAdmin4 interface.
Provide an email address of your choice
在安装过程中,系统将提示您输入电子邮件地址,如下所示。 这是您用于登录PgAdmin4界面的电子邮件地址。
提供您选择的电子邮件地址
Next, you will be prompted for your password. Provide your preferred password. The system will then proceed to wrap up the installation of PgAdmin4.
接下来,将提示您输入密码。 提供您的首选密码。 然后,系统将继续包装PgAdmin4的安装。
太好了! 至此,您已经成功安装了PgAdmin4。
Now that we have successfully installed PgAdmin4, it’s time now to connect to it. Open your browser and browse your server’s IP address as shown
现在我们已经成功安装了PgAdmin4,现在该连接它了。 如图所示,打开浏览器并浏览服务器的IP地址。
https://IP-address/pgAdmin4
In our example, the URL is:
在我们的示例中,URL为:
https://38.76.11.34/pgAdmin4
You will see the following login page. Enter the email address and password that you provided during the setup of PgAdmin4 and hit ‘Login’.
您将看到以下登录页面。 输入您在设置PgAdmin4期间提供的电子邮件地址和密码,然后单击“登录”。
You will finally be presented with the PgAdmin4 dashboard as shown below.
最终,您将看到PgAdmin4仪表板,如下所示。
With the dashboard, you can now create database server instances as well as monitor the performance of your databases.
使用仪表板,您现在可以创建数据库服务器实例以及监视数据库的性能。
This wraps up the topic of how to install PostgreSQL 11 and PgAdmin4 on Ubuntu server. Feel free to reach out to us with your feedback and share the article on your social platforms.
总结了如何在Ubuntu服务器上安装PostgreSQL 11和PgAdmin4的主题。 请随时与我们联系,以提供您的反馈,并在您的社交平台上分享文章。
翻译自: https://www.journaldev.com/26285/install-postgresql-pgadmin4-ubuntu