Install Postgresql 10 In Ubutnu 16.04 LTS

PostgreSQL数据库是一个高性能的全功能的开源关系型数据库,这里讲解一下如何在Ubuntu 16.04 LTS 下安装 PostgreSQL 10。

添加软件源

wget -q -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo sh -c ‘echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list‘

更新本地缓存

apt update

安装

[email protected] ~ $ apt install postgresql-10 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bbswitch-dkms lib32gcc1 libc6-i386 libjansson4 libvdpau1 libxnvctrl0 screen-resolution-extra xserver-xorg-legacy
Use ‘sudo apt autoremove‘ to remove them.
The following additional packages will be installed:
  libjs-underscore libpq5 libwxbase3.0-0v5 libwxgtk3.0-0v5 pgadmin3-data pgdg-keyring postgresql-client-10 postgresql-client-common postgresql-common
Suggested packages:
  javascript-common postgresql-contrib locales-all postgresql-doc-10 libjson-perl
Recommended packages:
  pgagent sysstat
The following NEW packages will be installed:
  libjs-underscore libwxbase3.0-0v5 libwxgtk3.0-0v5 pgadmin3 pgadmin3-data pgdg-keyring postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common
The following packages will be upgraded:
  libpq5
1 upgraded, 10 newly installed, 0 to remove and 1 not upgraded.
Need to get 17.3 MB of archives.
After this operation, 70.0 MB of additional disk space will be used.
Get:1 http://mirrors.ustc.edu.cn/ubuntu xenial/main amd64 libjs-underscore all 1.7.0~dfsg-1ubuntu1 [46.7 kB]
Get:2 http://mirrors.ustc.edu.cn/ubuntu xenial-updates/universe amd64 libwxbase3.0-0v5 amd64 3.0.2+dfsg-1.3ubuntu0.1 [971 kB]
Get:3 http://mirrors.ustc.edu.cn/ubuntu xenial-updates/universe amd64 libwxgtk3.0-0v5 amd64 3.0.2+dfsg-1.3ubuntu0.1 [4,344 kB]
Get:4 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 libpq5 amd64 10.1-1.pgdg16.04+1 [157 kB]
Get:5 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 pgadmin3-data all 1.22.2-2.pgdg16.04+1 [2,516 kB]
Get:6 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 pgadmin3 amd64 1.22.2-2.pgdg16.04+1 [3,067 kB]
Get:7 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 pgdg-keyring all 2017.3 [10.3 kB]
Get:8 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 postgresql-client-common all 188.pgdg16.04+1 [81.5 kB]
Get:9 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 postgresql-client-10 amd64 10.1-1.pgdg16.04+1 [1,277 kB]
Get:10 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 postgresql-common all 188.pgdg16.04+1 [220 kB]
Get:11 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 postgresql-10 amd64 10.1-1.pgdg16.04+1 [4,635 kB]
Fetched 17.3 MB in 6min 12s (46.5 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libjs-underscore.
(Reading database ... 210818 files and directories currently installed.)
Preparing to unpack .../libjs-underscore_1.7.0~dfsg-1ubuntu1_all.deb ...
Unpacking libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
Preparing to unpack .../libpq5_10.1-1.pgdg16.04+1_amd64.deb ...
Unpacking libpq5:amd64 (10.1-1.pgdg16.04+1) over (9.5.10-0ubuntu0.16.04) ...
Selecting previously unselected package libwxbase3.0-0v5:amd64.
Preparing to unpack .../libwxbase3.0-0v5_3.0.2+dfsg-1.3ubuntu0.1_amd64.deb ...
Unpacking libwxbase3.0-0v5:amd64 (3.0.2+dfsg-1.3ubuntu0.1) ...
Selecting previously unselected package libwxgtk3.0-0v5:amd64.
Preparing to unpack .../libwxgtk3.0-0v5_3.0.2+dfsg-1.3ubuntu0.1_amd64.deb ...
Unpacking libwxgtk3.0-0v5:amd64 (3.0.2+dfsg-1.3ubuntu0.1) ...
Selecting previously unselected package pgadmin3-data.
Preparing to unpack .../pgadmin3-data_1.22.2-2.pgdg16.04+1_all.deb ...
Unpacking pgadmin3-data (1.22.2-2.pgdg16.04+1) ...
Selecting previously unselected package pgadmin3.
Preparing to unpack .../pgadmin3_1.22.2-2.pgdg16.04+1_amd64.deb ...
Unpacking pgadmin3 (1.22.2-2.pgdg16.04+1) ...
Selecting previously unselected package pgdg-keyring.
Preparing to unpack .../pgdg-keyring_2017.3_all.deb ...
Unpacking pgdg-keyring (2017.3) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack .../postgresql-client-common_188.pgdg16.04+1_all.deb ...
Unpacking postgresql-client-common (188.pgdg16.04+1) ...
Selecting previously unselected package postgresql-client-10.
Preparing to unpack .../postgresql-client-10_10.1-1.pgdg16.04+1_amd64.deb ...
Unpacking postgresql-client-10 (10.1-1.pgdg16.04+1) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../postgresql-common_188.pgdg16.04+1_all.deb ...
Adding ‘diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common‘
Unpacking postgresql-common (188.pgdg16.04+1) ...
Selecting previously unselected package postgresql-10.
Preparing to unpack .../postgresql-10_10.1-1.pgdg16.04+1_amd64.deb ...
Unpacking postgresql-10 (10.1-1.pgdg16.04+1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22+linuxmint1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Setting up libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
Setting up libpq5:amd64 (10.1-1.pgdg16.04+1) ...
Setting up libwxbase3.0-0v5:amd64 (3.0.2+dfsg-1.3ubuntu0.1) ...
Setting up libwxgtk3.0-0v5:amd64 (3.0.2+dfsg-1.3ubuntu0.1) ...
Setting up pgadmin3-data (1.22.2-2.pgdg16.04+1) ...
Setting up pgadmin3 (1.22.2-2.pgdg16.04+1) ...
Setting up pgdg-keyring (2017.3) ...
Removing apt.postgresql.org key from trusted.gpg: OK
Setting up postgresql-client-common (188.pgdg16.04+1) ...
Setting up postgresql-client-10 (10.1-1.pgdg16.04+1) ...
update-alternatives: using /usr/share/postgresql/10/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-common (188.pgdg16.04+1) ...
Adding user postgres to group ssl-cert

Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
  en_us
Removing obsolete dictionary files:
Setting up postgresql-10 (10.1-1.pgdg16.04+1) ...
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?<!\\)\${ <-- HERE ([^}]+)}/ at /usr/sbin/pam_getenv line 78.
Creating new PostgreSQL cluster 10/main ...
/usr/lib/postgresql/10/bin/initdb -D /var/lib/postgresql/10/main --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  en_US.UTF-8
  CTYPE:    en_US.UTF-8
  MESSAGES: en_US.UTF-8
  MONETARY: zh_CN.UTF-8
  NUMERIC:  zh_CN.UTF-8
  TIME:     en_US.UTF-8
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/10/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start

Ver Cluster Port Status Owner    Data directory              Log file
10  main    5432 down   postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
update-alternatives: using /usr/share/postgresql/10/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...

参考资料
PostgreSQL packages for Debian and Ubuntu

原文地址:http://blog.51cto.com/qwfys200/2070001

时间: 2024-10-14 02:16:09

Install Postgresql 10 In Ubutnu 16.04 LTS的相关文章

Install Oracle jdk8 in Ubuntu 16.04 LTS

1.add repository apt add-repository ppa:webupd8team/java 2.update apt update 3.install apt install oracle-java8* 原文地址:http://blog.51cto.com/qwfys200/2071587

Install Android Studio in Ubuntu 16.04 LTS

add repository apt add-repository ppa:paolorotolo/android-studio update apt update install apt install android-studio 原文地址:http://blog.51cto.com/qwfys200/2074401

Install Mariadb in Ubuntu 16.04 LTS

MariaDB官网提供了repository https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna 在这里可以查询到各类系统的安装方法,这里仅对Ubuntu 16.04 LTS讲解. add key sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 add sources sudo sh -c

Ubuntu 16.04 LTS软件包管理基本操作使用APT简化命令行下面我们列出 Ubuntu 16.04 LTS 中使用 ATP 命令与老版本 Ubuntu 中软件包管理的用法对比: Ubuntu 16.04 LTS 老版本Ubuntu apt install 包名 替代 apt-get install 包名 apt remove 包名 替代 apt-get remove 包名 apt se

前文 Ubuntu 16.04 新特性中我们已经介绍过,随着 Ubuntu 16.04 LTS 的发布,Ubuntu 的软件包管理命令也发生了变化,新系统采用了 Debian 项目中所使用的 APT(Advanced Package Tool)来完成各种的不同的任务,ATP 命令全面取代了我们之前在 Linux 软件包管理基本操作入门中所介绍的 apt-get.apt-cache 等功能. ATP 在创建之初便是为了解决大量软件包管理所遇到的问题,希望结束类似 Linux 早期系统依赖的一大弊病

[Android 编译(一)] Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程

本文转载自:[Android 编译(一)] Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6.0的源码编译出来了,各种配置,各种error,各种爬坑,特写此博客记录爬坑经历.先上图,Ubuntu上编译完后成功运行模拟器,如图: 2 编译环境 UbuntuKylin 16.04 LTS Android 6.0_r1 Open JDK 7 3 准备工作 (1) 下载android 6.0源码.

EJBCA的安装(基于Ubuntu 16.04 LTS + wildfly8 + ejbca6.3.11 + jdk7)

前一段时间折腾了一下PKI,用EJBCA在研究院内网搭建了一个CA,目前是提供给手机端(安卓和IOS)来和服务器端(nginx + Java应用)做安全连接的(客户端和服务器端双向认证) 由于EJBCA官方的安装文档太不靠谱了,按照官方的文档来做的话会遇到各种坑, 所以记录一下我安装的过程.希望能给用到的人有一点帮助. 这里也贴一下官方的文档地址:https://www.ejbca.org/docs/installation.html 环境和所依赖的软件包: Ubuntu 16.04 LTS,

在 Ubuntu Server 16.04 LTS 上安装 LAMP

在 Ubuntu Server 16.04 LTS 上安装 LAMP LAMP 方案是一系列自由和开源软件的集合,包含了 Linux.Web 服务器 (Apache). 数据库服务器 (MySQL / MariaDB) 和 PHP (脚本语言). LAMP 是那些需要安装和构建动态网页应用的基础平台,比如WordPress.Joomla.OpenCart 和 Drupal,我将描述如何在 Ubuntu Server 16.04 LTS 上安装 LAMP,众所周知 Ubuntu 是一个基于 Lin

unbuntu 16.04 LTS下安装GNS3 1.4.6

先吐槽一下系统: 我用的linux版本是Ubuntu kylin 16.04 LTS ,确实比源生Ubuntu界面要好一些,符合中国人习惯,但是默认的中文输入法却不尽如人意,默认是繁体字..听说是可以用搜狗输入法.还没有试过.默认安装的谷歌浏览器显示效果不好,火狐还可以. 之前看过一个文章说,在linux下运行gns3比较好,资源占用少,且直接可以安装iou,就可以不用gns3-iou VM了,然后我就想试一下.而且我在官方文档上确实看到:官方确实推荐在linux下使用. On which op

Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程 (转)

1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6.0的源码编译出来了,各种配置,各种error,各种爬坑,特写此博客记录爬坑经历.先上图,Ubuntu上编译完后成功运行模拟器,如图: 2 编译环境 UbuntuKylin 16.04 LTS Android 6.0_r1 Open JDK 7 3 准备工作 (1) 下载Android 6.0源码. Androdi 6.0源码下载地址: http://pan.baidu.com/s/1o6N86a2 感谢下面这位博主上传