https://jimolonely.github.io/tech/linux/install-postgresql-kylin/

本文主要实践在麒麟V10版本上通过源码编译安装PostgreSQL12.5,因为是源码编译,所以对于其他版本也具有参考性。

麒麟版本

V10

$ uname -a
Linux kylin-v10-02 4.19.90-24.4.v2101.ky10.aarch64 #1 SMP Mon May 24 14:45:37 CST 2021 aarch64 aarch64 aarch64 GNU/Linux

下载PostgreSQL12.5源码

下载地址为官网:https://www.postgresql.org/ftp/source/v12.5/

上传解压到服务器。

编译源码过程

官方文档.

运行

./configure

得到如下报错:

error: readline library not found

需要安装readline

yum install readline-devel -y

然后再运行 ./configure

没有报错后,再运行

make

编译完成后得到成功提示

然后开始安装, 运行

make install

安装成功后可以看到

默认安装路径为 /usr/local/pgsql,我们需要将权限改为postgres

[root@kylin-v10-02 local]# useradd postgres
[root@kylin-v10-02 local]# chown -R postgres:postgres /usr/local/pgsql/

配置环境变量

安装完成后,还要做一些配置操作.

vim /etc/profile加入下面的环境变量配置

export PATH=/usr/local/pgsql/bin:$PATH

LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH

然后刷新配置:

source /etc/profile

启动服务

在启动PG之前,需要准备一个数据目录,注意修改权限:

mkdir -p /export/pgdata
chown -R postgres:postgres /export/pgdata

初始化数据库,注意,要切换到postgres用户

# sudo su - postgres
initdb -D /export/pgdata/

完整输出如下:

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process. The database cluster will be initialized with locale "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple". Data page checksums are disabled. fixing permissions on existing directory /export/pgdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb. Success. You can now start the database server using: pg_ctl -D /export/pgdata/ -l logfile start 启动PG

那我们就启动服务:

[postgres@kylin-v10-02 ~]$ pg_ctl -D /export/pgdata/ -l logfile start
waiting for server to start.... done
server started

测试

[postgres@kylin-v10-02 ~]$ psql
psql (12.5)
Type "help" for help. postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)

测试ok,不过要提供给其他机器用,还需要一些监听和安全配置。

修改密码

postgres=# alter user postgres password 'postgres';
ALTER ROLE

修改监听地址

默认情况是在localhost上监听 vim /export/pgdata/postgresql.conf ,修改监听地址

listen_addresses = '*'

还要允许密码访问,vim /export/pgdata/pg_hba.conf,在最后加入:

host  all  all 0.0.0.0/0 md5

然后重启服务

pg_ctl -D /export/pgdata/ -l logfile restart

下一篇,我们还会接着安装 PostGIS在麒麟Linux安装Postgis .

[转帖]在麒麟linux上安装Postgresql12.5的更多相关文章

  1. linux上安装配置samba服务器

    linux上安装配置samba服务器 在linux上安装配置samba服务器 在这给大家介绍一个不错的家伙,samba服务.如果您正在犯愁,如何在Windows和Linux之间实现资源共享,就请看看这 ...

  2. Linux上安装使用SSH(ubuntu&&redhat)

    转自:http://blog.csdn.net/zxs9999/article/details/6930736 Ubuntu安装使用SSH ubuntu默认并没有安装ssh服务,如果通过ssh链接ub ...

  3. 在Windows和Linux上安装paramiko模块以及easy_install的安装方法

    一.paramiko模块有什么用? paramiko是用python语言写的一个模块,遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接.由于使用的是python这样的能够跨平台运行的语言 ...

  4. 在Linux上安装Oracle RAC 12 c(12.1) 虚拟机,一步一步向导

    Oracle RAC 12 c(12.1)在Linux上安装虚拟机,一步一步向导 今天我们将看到如何安装 12 c版本1 RAC(真正的应用程序集群)数据库2 Linux 64位的虚拟机 使用VMWa ...

  5. WINDOWS和Linux上安装php7 alpha 并安装 yaf

    WINDOWS和Linux上安装php7 alpha 并安装 yaf PHP技术  widuu  2个月前 (06-15)  126浏览  0评论 windows 1.windows上安装 php7 ...

  6. 在Windows和Linux上安装paramiko模块

    一.paramiko模块有什么用? paramiko是用python语言写的一个模块,遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接.由于使用的是python这样的能够跨平台运行的语言 ...

  7. Linux上安装使用boost入门指导

    Data Mining Linux上安装使用boost入门指导 获得boost boost分布 只需要头文件的库 使用boost建立一个简单的程序 准备使用boost二进制文件库 把你的程序链接到bo ...

  8. 如何在Linux上安装Storm

    Storm是开源的分布式实时计算系统,能够让数据流处理变得简单.可靠,也因此在大数据领域有广泛的实际 应用.下面介绍一下如何在Linux系统上安装Storm.根据Storm官网介绍,安装Storm软件 ...

  9. linux上安装Drupal

    linux上安装Drupal 前言:国内用drupal的并不太多,网上资料也很少.要注意的是drupal尽量别使用apt来安装,特别是ubuntu平台的drupal做出了一定的更改,会妨碍后期的学习和 ...

  10. 在Linux上安装Hadoop

    先决条件: Hadoop是用JAVA写的,所以首先要安装Java.在Ubuntu上安装JDK见:http://blog.csdn.net/microfhu/article/details/766739 ...

随机推荐

  1. Langchain-Chatchat项目:2.1-通过GPT2模型来检索NebulaGraph

      在官方例子中给出了通过chain = NebulaGraphQAChain.from_llm(ChatOpenAI(temperature=0), graph=graph, verbose=Tru ...

  2. LeetCode283移动零、11盛最多的水

    283. 移动零 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序. 示例: 输入: [0,1,0,3,12] 输出: [1,3,12,0,0] 说明: 必 ...

  3. 新晋“网红”Cat1 是什么

    摘要:此Cat非彼Cat,它是今年物联网通信圈新晋网红"靓仔". 引言 今年5月,工信部发布了<关于深入推进移动物联网全面发展的通知>,明确提出推动存量2G.3G物联网 ...

  4. 华为云应用服务网格最佳实践之从Spring Cloud 到 Istio

    摘要:在全球首届社区峰会IstioCon 2021中,华为云应用服务网格首席架构师张超盟发表了<Best practice:from Spring Cloud to Istio>主题演讲, ...

  5. 基于DMS的数仓智能运维服务,知多少?

    摘要:GaussDB(DWS)使用DMS来承载数据库的智能运维体系,提供了数据库运维过程中的监控,分析,处理三大核心处理过程. 本文分享自华为云社区<GaussDB(DWS) 数据库智能监控运维 ...

  6. 一文带你 GNN 从入门到起飞,做一个饭盆最稳 GNN 饭人!

    摘要:本文介绍了图神经网络在学界和业界的发展情况,并给出了图神经网络的基本概念与表示形式,总结了图神经网络的变体,最后介绍了华为云图神经网络框架. 本文分享自华为云社区<干饭人,干饭魂,搞懂图神 ...

  7. 8种桌面IDE CodeArts智能代码补全类型

    摘要:代码补全可以有效的提升开发效率.减少拼写错误和输入代码量.CodeArts 依赖于 codearts.smartassist-java-ls 插件实现代码补全功能. 本文分享自华为云社区< ...

  8. 云图说|初识数据库和应用迁移UGO

    阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要:数据库和应用迁移 ...

  9. hadoop fs,hadoop dfs以及hdfs dfs区别

    1.hadoop dfs 专门针对hdfs系统 2.hdfs dfs 和hadoop dfs,当使用hadoop dfs时会被转为hdfs dfs命令 3.hadoop fs 范围更广

  10. 火山引擎DataLeap的Catalog系统搜索实践 (二):整体架构

    整体架构 火山引擎DataLeap的Catalog搜索系统使用了开源的搜索引擎Elasticsearch进行基础的文档检索(Recall阶段),因此各种资产元数据会被存放到Elasticsearch中 ...