宏芯powerpc64le架構實現centos7安裝postgresql

語言: CN / TW / HK

宏芯powerpc64le架構實現centos7安裝postgresql

環境:

[root@localhost ~]# hostnamectl 
   Static hostname: admin-instance-test-8.novalocal
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 1e4174276d824fa4a851e767b1b1b8a1
           Boot ID: b3ee78ed84c74b1fafdc98daf7839622
    Virtualization: kvm
  Operating System: CentOS Linux 7 (AltArch)
       CPE OS Name: cpe:/o:centos:centos:7:server
            Kernel: Linux 3.10.0-1062.el7.ppc64le
      Architecture: ppc64-le
[root@localhost ~]# 
[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (AltArch)
[root@localhost ~]#

yum源:

(默認yum源先備份一份)

mkdir /etc/yum.repos.d/default-repo.bak

mv /etc/yum.repos.d/CentOS* /etc/yum.repos.d/default-repo.bak

需要注意:這裏配置阿里雲yum源

vi /etc/yum.repos.d/CentOS-Base-Ali.repo

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

然後,更新yum源

yum clean all && yum makecache fast

然後查看yum源


一、方案一:yum方式安裝

1、yum安裝(確保yum源正常)

yum -y install postgresql-server

2、初始化postgresql數據庫

/usr/bin/postgresql-setup initdb

3、查看postgresql服務狀態

systemctl status postgresql

4、啟動postgresql服務,並查看服務狀態

systemctl start postgresql

5、設置postgresql服務開機自啟動

systemctl enable postgresql

到此,安裝完畢

附:卸載postgresql數據庫

  • 停掉postgresql服務

    systemctl stop postgresql

  • yum卸載

    yum -y remove postgresql

  • 查找postgresql殘留文件

    find / -name postgresql

然後一一刪掉即可(可腳本刪除)

方案一到此結束!


二、方案二:藉助docker安裝postgres容器

需要依賴docker環境,

參考1:CentOS7.7.1908-ppc64le成功安裝docker

參考2:docker快速搭建postgresql(CentOS7)

1、拉取postgresql的docker鏡像

docker pull postgres

2、查看docker鏡像

docker images

3、創建並運行postgresql容器

docker run -d --name postgres -e POSTGRES_PASSWORD=123456 -p 1234:5432 postgres:latest

4、查看docker容器狀態

docker ps -a

5、關掉postgresql容器

docker stop postgres

6、刪除postgresql容器

docker rm postgres

方案二到此結束!


更多關於 power pc 64le 精彩內容,請看下方鏈接
Power PC 64 LE 雲服務器安裝合集


都看到最後了啦,如果覺得寫得好的話吶
記得 一鍵三連 哦!點贊也行吶!