[转帖]在麒麟linux上安装Postgresql12.5
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的更多相关文章
- linux上安装配置samba服务器
linux上安装配置samba服务器 在linux上安装配置samba服务器 在这给大家介绍一个不错的家伙,samba服务.如果您正在犯愁,如何在Windows和Linux之间实现资源共享,就请看看这 ...
- Linux上安装使用SSH(ubuntu&&redhat)
转自:http://blog.csdn.net/zxs9999/article/details/6930736 Ubuntu安装使用SSH ubuntu默认并没有安装ssh服务,如果通过ssh链接ub ...
- 在Windows和Linux上安装paramiko模块以及easy_install的安装方法
一.paramiko模块有什么用? paramiko是用python语言写的一个模块,遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接.由于使用的是python这样的能够跨平台运行的语言 ...
- 在Linux上安装Oracle RAC 12 c(12.1) 虚拟机,一步一步向导
Oracle RAC 12 c(12.1)在Linux上安装虚拟机,一步一步向导 今天我们将看到如何安装 12 c版本1 RAC(真正的应用程序集群)数据库2 Linux 64位的虚拟机 使用VMWa ...
- WINDOWS和Linux上安装php7 alpha 并安装 yaf
WINDOWS和Linux上安装php7 alpha 并安装 yaf PHP技术 widuu 2个月前 (06-15) 126浏览 0评论 windows 1.windows上安装 php7 ...
- 在Windows和Linux上安装paramiko模块
一.paramiko模块有什么用? paramiko是用python语言写的一个模块,遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接.由于使用的是python这样的能够跨平台运行的语言 ...
- Linux上安装使用boost入门指导
Data Mining Linux上安装使用boost入门指导 获得boost boost分布 只需要头文件的库 使用boost建立一个简单的程序 准备使用boost二进制文件库 把你的程序链接到bo ...
- 如何在Linux上安装Storm
Storm是开源的分布式实时计算系统,能够让数据流处理变得简单.可靠,也因此在大数据领域有广泛的实际 应用.下面介绍一下如何在Linux系统上安装Storm.根据Storm官网介绍,安装Storm软件 ...
- linux上安装Drupal
linux上安装Drupal 前言:国内用drupal的并不太多,网上资料也很少.要注意的是drupal尽量别使用apt来安装,特别是ubuntu平台的drupal做出了一定的更改,会妨碍后期的学习和 ...
- 在Linux上安装Hadoop
先决条件: Hadoop是用JAVA写的,所以首先要安装Java.在Ubuntu上安装JDK见:http://blog.csdn.net/microfhu/article/details/766739 ...
随机推荐
- CodeForces 1141F2 贪心 离散化
CodeForces 1141F2 贪心 离散化 题意 给定一个序列,要求我们找出最多数量的不相交区间,每个区间和都相等. 思路 一开始没有头绪,不过看到 \(n \le 1500\) 后想到可以把所 ...
- 限制左键拖拽图片阴影vue
<template> <div> <img ref="image" :src="imageUrl" :style="im ...
- Llama2-Chinese项目:2.2-大语言模型词表扩充
因为原生LLaMA对中文的支持很弱,一个中文汉子往往被切分成多个token,因此需要对其进行中文词表扩展.思路通常是在中文语料库上训练一个中文tokenizer模型,然后将中文tokenizer与 ...
- 重磅!Github宣布面向团队免费
GitHub CEO Nat Friedman 宣布已面向全体 GitHub 用户和团队提供不限制协作人数的私有仓库,并宣称 GitHub 的全部核心功能现已对所有人免费提供. 公告称: 到目前为止, ...
- Solon2 开发之IoC,五、Bean 扫描的三种方式
1.启动时扫描 package org.example.demo; public class DemoApp{ public static void main(String[] args){ // / ...
- Solon 运行出乱码怎么办?
1.启动时添加 -Dfile.encoding=utf-8,示例: java -Dfile.encoding=utf-8 -jar DemoApp.jar 再出现乱码?一般是文件本身编码问题.检查一下 ...
- Kubernetes(K8S) 集群安全机制
概述 访问K8S集群,需要经过三个步骤完成具体操作 认证 鉴权(授权) 准入控制 进行访问时,过程中需要经过 ApiServer,做统一协调,比如门卫,访问过程中需要证书.token.或者用户名+密码 ...
- SpringBoot Jar 包太大 瘦身 【初试】
SpringBoot Jar 包太大 瘦身,建议使用时,参考: SpringBoot Jar 包太大 瘦身 [终极版] 29M, 排除少量JAR包方式 打包,排除指定jar 包 <build&g ...
- python WordCloud matplotlib docx 简易生成docx报告
# encode=utf-8 import numpy as np import matplotlib.pyplot as plt from docx import Document from doc ...
- Nginx--引用多配置文件
在nginx.conf的http模块,include 指定某个目录下的*.conf user nginx; worker_processes auto; error_log /var/log/ngin ...