install postgresl on linux 1

---恢复内容开始---

1. install linux

2. 切换mirror

   a. 备份原来的repo  文件, [root@localhost ~]# mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.backup

   b. 查询本机的yum 版本: 

[root@localhost ~]# rpm -qa|grep yum
yum-rhn-plugin-2.0.1-6.el7.noarch
yum-langpacks-0.4.2-7.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-150.el7.noarch
PackageKit-yum-1.0.7-6.el7.x86_64
yum-utils-1.1.31-40.el7.noarch

  c. 卸载这些自带的

rpm -qa|grep yum|xargs rpm -e --nodeps

  d. 下载

  wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm

  wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm

 wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/PackageKit-yum-1.1.5-1.el7.centos.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-32.el7.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-32.el7.x86_64.rp  --此刻  我已经崩溃啦。。

7. 安装  

   一堆依赖,根据提示,去下载rpm包,

  rpm -Uvh rpm-libs-4.11.3-32.el7.x86_64.rpm rpm-build-libs-4.11.3-32.el7.x86_64.rpm rpm-python-4.11.3-32.el7.x86_64.rpm rpm-4.11.3-32.el7.x86_64.rpm

 rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

 rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

rpm -ivh yum-*

8.下载 repo 文件,修改参数

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

  vim /etc/yum.repos.d/CentOS-Base.repo ,将文件里面的 所有 $releasever 换成7, 我手工一个一个改的, 因为我的版本是 el7, 所以 写成7

9. yum clean all  -- 清除缓存

10. yum makecache  --新建缓存, 要是第八步里面 $releasever 没有换成7, 就会报错,

11.Install the repository RPM  -

yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm  

12. 修改pgdg-10-redhat.repo,该文件位于 /etc/yum.repos.d 将文件里面的  $releasever 换成7
13.创建client
yum install postgresql10
14. install server --创建server
yum install postgresql10-server
15. 配置服务自动启动
/usr/pgsql-10/bin/postgresql-10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10

16.

 

---恢复内容结束---

猜你喜欢

转载自www.cnblogs.com/xiangjiaoai/p/9047287.html
今日推荐