银河麒麟高级服务器v10 sp2编译安装postgresql 14.1
银河麒麟服务器操作系统编译安装postgresql
一.安装说明
环境:CPU为海光x86 ;内存8G; 硬盘256G
1.1 麒麟官网申请下载kylin v10 sp2 镜像
银河麒麟操作系统 麒麟操作系统 中标麒麟 麒麟软件官方网站 (kylinos.cn)
银河麒麟操作系统 麒麟操作系统 国产操作系统 中标麒麟 开放麒麟 openKylin 麒麟软件官方网站
pg源码下载:PostgreSQL: File Browser
操作系统内核 : 4.19.90-24.4.v2101.ky10.x86_64
1.2 刻录镜像安装kylin server v10 sp2,本次全自动分区安装形式,安装过程省略
二.操作系统准备
2.1 本地yum源配置
mount /dev/cdrom /mnt
新增编辑/etc/yum.repos.d/kylin_local.repo文件,添加以下内容
[kylin_local]
name = kylin local
baseurl = file:///mnt
gpgcheck = 0
enabled = 1
2.2 安装readline和zlib包
因为是源码安装方式,依赖readline和zlib的devel包也要安装
yum install readline-devel -y
yum install zlib-devel -y
三. 开始安装
3.1 解压安装包
下载后得到postgresql-14.1.tar.bz2的文件。上传服务器后,解压缩它:
tar xf postgresql-14.1.tar.bz2
3.2 编译安装
此处默认配置编译,详细的参数可以参考http://www.postgres.cn/docs/12/install-procedure.html。
./configure
Make -j4
make install
经过一段时间后,安装将完成。安装完成后,默认路径在/usr/local/pgsql/
注意此时的属主属于root:root
新增用户,并将软件属主进行修改
useradd pg
chown -R pg:pg /usr/local/pgsql
3.3 设置环境变量
配置pg的环境变量,pg用户下的~/.bash_profile 添加如下内容
export PATH=/usr/local/pgsql/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql/lib
四. 配置文件系统
mkdir -p /pgdata
chown pg:pg /pgdata/
五. 初始化数据库
初始化数据库,并构建初始数据库。
/usr/local/pgsql/bin/initdb -D /pgdata/data
/usr/local/pgsql/bin/pg_ctl -D /pgdata/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
详细过程:
[root@server pgsql]# su - pg
[pg@server ~]$ /usr/local/pgsql/bin/initdb -D /pgdata/data
The files belonging to this database system will be owned by user "pg".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /pgdata/data ... 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:
/usr/local/pgsql/bin/pg_ctl -D /pgdata/data -l logfile start
[pg@server ~]$ /usr/local/pgsql/bin/pg_ctl -D /pgdata/data -l logfile start
waiting for server to start.... done
server started
[pg@server ~]$ /usr/local/pgsql/bin/createdb test
[pg@server ~]$ /usr/local/pgsql/bin/psql test
psql (14.1)
Type "help" for help.
test=# select current_database();
current_database
------------------
test
(1 row)
test=#
更多推荐
所有评论(0)