欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

centos6.8+yum+pgsql9.6

程序员文章站 2022-04-22 08:38:01
安装centos 6.8 配置yum cdrom源 cd /etc/yum.repos.d mv ./CentOS-Base.repo ./CentOS-Base.repo....

安装centos 6.8

配置yum cdrom源

cd /etc/yum.repos.d

mv ./CentOS-Base.repo ./CentOS-Base.repo.bak

mv ./CentOS-Debuginfo.repo ./CentOS-Debuginfo.repo.bak

mv ./CentOS-fasttrack.repo ./CentOS-fasttrack.repo.bak

mv ./CentOS-Media.repo ./CentOS-Media.repo.bak

mv ./CentOS-Vault.repo ./CentOS-Vault.repo.bak

vi ./CentOS-Cdrom.repo

[c6-cdrom]

name=CentOS-$releasever - Media

baseurl=file:///mnt/cdrom/

gpgcheck=0

enabled=1

gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-6

如果要安装cdrom没有的包,就需要配置外源,比如aliyun 源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

yum makecache

安装pgsql9.6

安装 repository rpm:

yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm

pgdg-centos96-9.6-3.noarch.rpm 安装后,会生成一个 repo 文件

cat /etc/yum.repos.d/pgdg-96-centos.repo

[pgdg96]

name=PostgreSQL 9.6 releasever?basearch

baseurl=https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-releasever?basearch

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-96

[pgdg96-source]

name=PostgreSQL 9.6 releasever?basearch - Source

failovermethod=priority

baseurl=https://download.postgresql.org/pub/repos/yum/srpms/9.6/redhat/rhel-releasever?basearch

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-96

[pgdg96-updates-testing]

name=PostgreSQL 9.6 releasever?basearch

baseurl=https://download.postgresql.org/pub/repos/yum/testing/9.6/redhat/rhel-releasever?basearch

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-96

[pgdg96-source-updates-testing]

name=PostgreSQL 9.6 releasever?basearch - Source

failovermethod=priority

baseurl=https://download.postgresql.org/pub/repos/yum/srpms/testing/9.6/redhat/rhel-releasever?basearch

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-96

安装postgresql rpm:

yum install postgresql96

yum install postgresql96-server

或者直接 yum install postgresql96*

这样就会安装很多包

postgresql-client libraries and client binaries

postgresql-server core database server

postgresql-contrib additional supplied modules

postgresql-devel libraries and headers for C language development

pgadmin3 - pgAdmin III graphical administration utility

初始化数据库

service postgresql-9.6 initdb

chkconfig postgresql-9.6 off

service postgresql-9.6 start

ps -ef|grep -i postgres

netstat -anop|grep -i 5432

修改些参数

alter system set listen_addresses=’*’;

atler system set port=5432;

alter system set logging_collector=on;

alter system set log_destination=’csvlog’;

一些path

/etc/alternatives/

/usr/pgsql-9.6/

/var/lib/pgsql/9.6/

/usr/share/doc/postgresql96-docs-9.6.4/

/usr/src/debug/postgresql-9.6.4/

/usr/lib/debug/usr/pgsql-9.6/

/var/lib/alternatives/