Linux软件安装命令介绍(三)

以pg 15.2为例进行源码包安装

准备工作:

1、获取源码包,PostgreSQL: File Browser

2、把源码包上传到Linux服务器上,一般建议保存到/usr/local/ 目录下

安装过程:

1、解压安装包

 tar -zxvf postgresql-15.2.tar.gz

2、进入安装包目录(后续命令需要在目录下执行)

cd postgresql-15.2/

3、软件配置与检查(指定了安装位置)

./configure --prefix=/usr/local/postgresql15

此命令用于定义需要的软件配置和检查系统安装环境,执行后会出现makefile

4、报错configure: error: zlib library not found解决

yum install zlib

安装过程又报错,原因是之前尝试直接yum安装pg,引入了源文件,需要把/etc/yum.repos.d/路径下的源手动失效,才能继续安装。

4、执行编译

make

如果编译报错执行make clean清楚编译过程产生的文件

5、安装

其实也可以参考INSTALL文件,里面写了如何执行编译和安装过程

    ./configure
    make
    su
    make install
    adduser postgres
    mkdir -p /usr/local/pgsql/data
    chown postgres /usr/local/pgsql/data
    su - postgres
    /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
    /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
    /usr/local/pgsql/bin/createdb test
    /usr/local/pgsql/bin/psql test

猜你喜欢

转载自blog.csdn.net/hezhou876887962/article/details/129776273