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:
- A list of available packages
- Repository packages for different version combinations
- Status of RPM builds
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.
YUM Installation PostgreSQL的更多相关文章
- 与你相遇好幸运,CentOS 7 x86_64使用Yum安装PostgreSQL
访问http://yum.pgrpms.org/reporpms/repoview/letter_p.group.html,下载并安装和当前系统对应的rpm文件. wget https://downl ...
- CentOS下yum安装PostgreSQL
关键词:centos install PostgreSQL Configure YUM repository vim /etc/yum.repos.d/CentOS-Base.repo [base] ...
- Centos7 yum安装postgresql 9.5
添加RPM yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos ...
- yum安装PostgreSQL 在6和7
一.安装PostgreSQL 复制代码// 安装EPEL源# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.n ...
- CentOS7使用yum安装PostgreSQL和PostGIS
更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合Cent ...
- centos使用Yum安装postgresql 13
rpm源安装 yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat ...
- yum安装postgresql
https://wiki.postgresql.org/wiki/YUM_Installation
- postgresql数据库的yum安装方法
实验环境>>>>>>>>>>>>>>>>>>操作系统:CentOS release 6.3 ...
- postgresql安装部署
一.下载安装: 1.下载: 官网下载地址:https://www.postgresql.org/download/linux/redhat/ 也可以用这个:https://www.enterprise ...
随机推荐
- POJ 2763 (树链剖分+边修改+边查询)
题目链接:http://poj.org/problem?id=2763 题目大意:某人初始在s点.有q次移动,每次移动沿着树上一条链,每经过一条边有一定花费,这个花费可以任意修改.问每次移动的花费. ...
- 对于String对象,可以使用"="赋值,也可以使用"new"关键字赋值,两种方式有什么区别?
当你看见这个标题的时候,你可能会下意识的去想一下,这两种方式到底有什么样的区别呢? 且看下面的demo,自然便区分开了 /** * */ package com.b510.test; /** * Pr ...
- python 操作execl文件
http://www.jb51.net/article/60510.htm import xlrdimport xlwt # 打开文件 workbook = xlrd.open_workbook( ...
- Nhibernate Case SUM
SELECT ID END) as nbRowWithValueOf2, END) as nbRowWithValueOf3 FROM Foo GROUP BY ID queryover = quer ...
- 是否允许处理由Zend Encoder加密的PHP文件
Zend Optimizer是由PHP核心引擎"Zend"创建者Zend技术公司所开的免费PHP优化软件.据Zend公司透露使用这个软件某些情况下至少可以提高性能30%以上!Zen ...
- autoLayout 纯代码
SB中拖好空间,让后分别在,Pin,Align,Resolve Auto Layout Issues三个面板中设置好约束就好了. 用存代码的方式给控件添加约束,完成自动布局: 利用NSLayoutCo ...
- Mybatis分页和Spring的集成
写了一个Mybatis分页控件,在这记录一下使用方式. 在Maven中加入依赖: ? 1 2 3 4 5 6 7 8 9 <dependencies> ... <depe ...
- StringUtils cannot be resolved
I am using Java server pages and for using String Manipulations and i am Using StringUtils which i a ...
- HDU 5773 最长上升子序列
题意 给出一个序列 问它的最长严格上升子序列多长 这个序列中的0可以被替代为任何数 n的范围给出了1e5 所以平常的O(n*n)lis不能用了 在kuangbin的模板里有O(nlogn)的模板 套上 ...
- Ruby--CSV
1. 解析CSV: (1)读取文件:csv = CSV.read("#{Rails.root}/public/data/statecountycity.csv", :headers ...