ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

服务器V10 SP1 安装postgresql

2021-11-08 10:33:48  阅读:210  来源: 互联网

标签:... 00 postgresql SP1 V10 15635 pgsql Data


服务器postgresql安装

一、软件介绍

PostgreSQL是以加州大学伯克利分校计算机系开发的 POSTGRES,现在已经更名为PostgreSQL,版本 4.2为基础的对象关系型数据库管理系统(ORDBMS)。PostgreSQL支持大部分 SQL标准并且提供了许多其他现代特性:复杂查询、外键、触发器、视图、事务完整性、MVCC。同样,PostgreSQL 可以用许多方法扩展,比如,通过增加新的数据类型、函数、操作符、聚集函数、索引。

 

服务器详细规格如下:

名称

说明

CPU

64cores   Phytium,FT-2000+/64 64bit

内核

Linux-4.19.90-17.ky10.aarch64-aarch64-with-kylin-10-Tercel

内存

64GB

硬盘

480GB

 

1. 配置编译环境

(1) 安装依赖包

yum install -y readline readline-devel openssl openssl-devel zlib zlib-devel

(2) 安装:

1)通过yum直接安装

yum install postgresql-server.aarch64

2)通过源码安装

a. 获取源码

wget https://ftp.postgresql.org/pub/source/v10.11/postgresql-10.11.tar.gz

b. 解压源码。

tar -zxvf postgresql-10.11.tar.gz

c. 进入源码目录。

cd postgresql-10.11

d. 配置并编译安装。

./configure && make && make install

----结束

2.运行和验证

(1) yum安装方式运行:

1) 初始化数据库。

/usr/bin/postgresql-setup initdb

2) 设置开启启动。

systemctl start postgresql

systemctl enable postgresql.service

(2) 源码安装方式运行:

1) 创建数据目录。

mkdir /Data

mkdir /Data/postgresql

2) 创建pgsql用户。

useradd pgsql

3) 变更目录权限。

chown -R pgsql:pgsql /usr/local/pgsql

chown -R pgsql:pgsql /Data/postgresql

4) 切换pgsql用户。

su - pgsql

5) 初始化数据。

/usr/local/pgsql/bin/initdb -D /Data/postgresql/

The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.
 
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
 
Data page checksums are disabled.
 
fixing permissions on existing directory /Data/postgresql ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... PRC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
 
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:
 
    /usr/local/pgsql/bin/pg_ctl -D /Data/postgresql/ -l logfile start

6) 创建日志目录及日志。

cd /Data/postgresql

mkdir log

touch log/server.log

7) 启动进程。

/usr/local/pgsql/bin/pg_ctl -D /Data/postgresql/ -l /Data/postgresql/log/server.log start

结束进程:/usr/local/pgsql/bin/pg_ctl -D /Data/postgresql/ -l /Data/postgresql/log/server.log stop

8) 检查进程。

ps -ef  | grep pgsql

pgsql    15635     1  0 10:07 pts/0    00:00:00 /usr/local/pgsql/bin/postgres -D /Data/postgresql
pgsql    15637 15635  0 10:07 ?        00:00:00 postgres: checkpointer process
pgsql    15638 15635  0 10:07 ?        00:00:00 postgres: writer process
pgsql    15639 15635  0 10:07 ?        00:00:00 postgres: wal writer process
pgsql    15640 15635  0 10:07 ?        00:00:00 postgres: autovacuum launcher process
pgsql    15641 15635  0 10:07 ?        00:00:00 postgres: stats collector process
pgsql    15642 15635  0 10:07 ?        00:00:00 postgres: bgworker: logical replication launcher

9) 检查监听端口。

netstat -tlnp

tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      15635/postgres

标签:...,00,postgresql,SP1,V10,15635,pgsql,Data
来源: https://www.cnblogs.com/zengboy/p/15523061.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有