YUM Installation PostgreSQL

PostgreSQL can be installed using RPMs (binary) or SRPMs (source) managed by YUM. This is available for the following Linux distributions (both 32- and 64-bit platforms; for the current release and prior release or two):

  • Fedora
  • Red Hat Enterprise Linux
  • CentOS
  • Scientific Linux
  • Oracle Enterprise Linux

See links from the main repository, http://yum.postgresql.org:

Contents

[hide]

Instructions

Configure your YUM repository

Locate and edit your distributions .repo file, located:

  • On Fedora: /etc/yum.repos.d/fedora.repo and /etc/yum.repos.d/fedora-updates.repo, [fedora] sections
  • On CentOS: /etc/yum.repos.d/CentOS-Base.repo, [base] and [updates] sections
  • On Red Hat: /etc/yum/pluginconf.d/rhnplugin.conf [main] section

To the section(s) identified above, you need to append a line (otherwise dependencies might resolve to the postgresql supplied by the base repository):

exclude=postgresql*

Install PGDG RPM file

A PGDG file is available for each distribution/architecture/database version combination. Browse http://yum.postgresql.org and find your correct RPM. For example, to install PostgreSQL 9.4 on CentOS 6 64-bit:

yum localinstall http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

Install PostgreSQL

To list available packages:

yum list postgres*

For example, to install a basic PostgreSQL 9.4 server:

yum install postgresql94-server

Other packages can be installed according to your needs.

Post-installation commands

After installing the packages, a database needs to be initialized and configured.

In the commands below, the value of <name> will vary depending on the version of PostgreSQL used.

For PostgreSQL version 9.0 and above, the <name> includes the major.minor version of PostgreSQL, e.g., postgresql-9.4

For versions 8.x, the <name> is always postgresql (without the version signifier).

Data Directory

The PostgreSQL data directory contains all of the data files for the database. The variable PGDATA is used to reference this directory.

For PostgreSQL version 9.0 and above, the default data directory is:

/var/lib/pgsql/<name>/data

For example:

/var/lib/pgsql/9.4/data

For versions 7.x and 8.x, default data directory is:

/var/lib/pgsql/data/

Initialize

The first command (only needed once) is to initialize the database in PGDATA.

service <name> initdb

E.g. for version 9.4:

service postgresql-9.4 initdb

If the previous command did not work, try directly calling the setup binary, located in a similar naming scheme:

/usr/pgsql-y.x/bin/postgresqlyx-setup initdb

E.g. for version 9.4:

/usr/pgsql-9.4/bin/postgresql94-setup initdb

Startup

If you want PostgreSQL to start automatically when the OS starts:

chkconfig <name> on

E.g. for version 9.4:

chkconfig postgresql-9.4 on

In RHEL 7+, try:

systemctl enable postgresql

Control service

To control the database service, use:

service <name> <command>

where <command> can be:

  • start : start the database
  • stop : stop the database
  • restart : stop/start the database; used to read changes to core configuration files
  • reload : reload pg_hba.conf file while keeping database running

E.g. to start version 9.4:

service postgresql-9.4 start

With RHEL 7.1+ and CentOS 7.1+, Systemd is introduced. Use this instead:

systemctl enable postgresql-9.4.service
 systemctl start postgresql-9.4.service

Removing

To remove everything:

yum erase postgresql94*

Or remove individual packages as desired.

时间: 2024-10-05 22:41:53

YUM Installation PostgreSQL的相关文章

yum安装PostgreSQL 在6和7

一.安装PostgreSQL 复制代码// 安装EPEL源# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && rpm -ivh epel-release-6-8.noarch.rpm// 安装PGSQL# yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/p

CentOS7使用yum安装PostgreSQL和PostGIS

更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合CentOS7的RPM源,复制其url地址,使用yum安装. 同时安装epel(Extra Packages for Enterprise Linux 7),为了稳定性,CentOS7的默认yum源缺少很多组件,这些组件可以在epel上找到. 命令: yum install -y https://downl

CentOS yum源的配置与使用

一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的开发者Terra Soft 研发,用python 写成,那时还叫做yup(yellow dog updater),后经杜克大学的[email protected] 开发团队进行改进,遂有此名.yum 的宗旨是自动化地升级,安装/移除rpm 包,收集rpm 包的相关信息,检查依赖性并自动提示用户解决.

CentOS yum 源的配置与使用

一.yum 简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的开发者Terra Soft 研发,用python 写成,那时还叫做yup(yellow dog updater),后经杜克大学的[email protected] 开发团队进行改进,遂有此名.yum 的宗旨是自动化地升级,安装/移除rpm 包,收集rpm 包的相关信息,检查依赖性并自动提示用户解决.

CentOS 7.x里yum安装Odoo 8.0&9.0(OpenERP)

(总结)CentOS 7.x里yum安装Odoo 8.0&9.0(OpenERP) 最近想了解下合适中小企业使用的ERP系统,研究了几款主流的开源ERP系统以及了解下SAP.Oracle EBS等大型ERP系统,开源ERP里Odoo(以前叫OpenERP)是最有名的,听说在欧洲广泛使用.功能确实非常强大,默认有中文语言包,使用Python开发,数据库用了PostgreSQL,缺点是不支持MySQL.官方有yum源,在CentOS 7.x里使用yum安装部署比较快速,但如果稍不注意细节,可能就会安

CentOS 7 安装 PostgreSQL

参考:http://blog.csdn.net/lk10207160511/article/details/50359549##1 1.检查本机是否安装 PostgreSQL $ sudo rpm -aq | grep postgresql 2.从仓库中安装 PostgresSQL 搜索包名: $ yum search postgresql 列出包名,例如可能有: postgresql.i686 : PostgreSQL client programspostgresql.x86_64 : Po

PosttgreSQL快速入门:PostgreSQL的安装和配置

一.在CentOS上安装PostgreSQL数据库 下面我们就以CentOS系统为例,给大家讲解一下PostgreSQL的安装过程. 1.使用yum安装postgresql [[email protected] ~]$ sudo yum install postgresql-server.x86_64 Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Install Process Loading mir

PostgreSQL 10 build-in table partition(Range)

1.下载 rpm知识库包 操作系统版本:CentOS Linux release 7.2.1511 (Core) X64 [[email protected] home]# yum install https://download.postgresql.org/pub/repos/yum/testing/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm Preparing...                          #####

CentOS学习日记:PostgreSQL篇

本文记录PostgreSQL在CentOS 6.7上安装.配置.使用等方面的资料以及操作过程. 一.准备工作 1.CentOS 6.7 2.网络ok 二.安装 使用yum安装postgresql. yum install postgresql 三.初始化 当成功安装好postgresql后,根据官网说明,还需要运行以下命令: service postgresql initdb chkconfig postgresql on 这两条命令用来初始化postgresql数据库以及将postgresql