PostgreSQL15.2数据库安装

来源:这里教程网 时间:2026-03-14 20:52:10 作者:

获取源代码

[root@master pg]# tar -zxvf postgresql-15.2.tar.gz [root@master pg]#  cd postgresql-15.2/ 

·         编译,安装[root@master postgresql-15.2]# ./configurechecking build system type... x86_64-pc-linux-gn  configure: error: readline library not foundIf you have readline already installed, see config.log for details on thefailure.  It is possible the compiler isn't looking in the proper directory.Use --without-readline to disable readline support.[root@master postgresql-15.2]# makeYou need to run the 'configure' program first. See the file'INSTALL' for installation instructions, or visit:<https://www.postgresql.org/docs/devel/installation.html>make: *** [all] Error 1  解决办法[root@master postgresql-15.2]# rpm -qa | grep readlinereadline-6.2-10.el7.x86_64[root@master postgresql-15.2]# yum search readlineLoaded plugins: fastestmirror, langpacksRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fastDetermining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.bfsu.edu.cn * updates: mirrors.aliyun.com=================================================================== N/S matched: readline ===================================================================lua-readline.x86_64 : Lua interface to the readline and history librariesperl-Term-ReadLine-Gnu.x86_64 : Perl extension for the GNU Readline/History Libraryrakudo-Readline.x86_64 : Simple Perl 6 binding to GNU libreadlinereadline-devel.i686 : Files needed to develop programs which use the readline libraryreadline-devel.x86_64 : Files needed to develop programs which use the readline libraryreadline-static.i686 : Static libraries for the readline libraryreadline-static.x86_64 : Static libraries for the readline librarytcl-tclreadline.x86_64 : GNU Readline extension for Tcl/Tktcl-tclreadline-devel.x86_64 : Development files for the tclreadline libraryeditline.x86_64 : A small compatible replacement for readlinelinenoise.x86_64 : Minimal replacement for readlineperl-Term-UI.noarch : Term::ReadLine user interface made easyreadline.x86_64 : A library for editing typed command linesreadline.i686 : A library for editing typed command linesrlwrap.x86_64 : Wrapper for GNU readline   Name and summary matches only, use "search all" for everything.[root@master postgresql-15.2]#  yum -y install -y readline-devel  configure: error: zlib library not foundIf you have zlib already installed, see config.log for details on thefailure.  It is possible the compiler isn't looking in the proper directory.Use --without-zlib to disable zlib support.[root@master postgresql-15.2]# makeYou need to run the 'configure' program first. See the file'INSTALL' for installation instructions, or visit:<https://www.postgresql.org/docs/devel/installation.html>make: *** [all] Error 1[root@master postgresql-15.2]# yum install zlib-devel makemake[1]: Leaving directory `/data/pg/postgresql-15.2/config'[root@master postgresql-15.2]# make all 创建用户

postgres 创建用户 [root@master postgresql-15.2]# useradd postgres[root@master postgresql-15.2]# passwd postgresChanging password for user postgres.New password:[root@master config]#[root@master config]# chown -R postgres:postgres /data/   [root@master config]#[root@master config]#[root@master config]#[root@master config]# su - postgresLast login: Thu Mar 16 08:59:57 CST 2023 on pts/0[postgres@master ~]$ mkdir -p /data/pgdata/[postgres@master ~]$ 初始化数据库su - postgresinitdb -D /data/pgdata/  修改配置文件 cd /data/pgdata/vi postgresql.conf# 将该条配置反注释,将localhost 改成*listen_addresses = '*' 修改访问控制文件 vi pg_hba.conf# IPv4 local connections:host    all             all             0.0.0.0/0            md5 启动数据库[postgres@pgDatabase ~]$ pg_ctl -D /data/pgdata/ -l logfile startserver starting 进入数据库修改postgres 密码 psqlpostgres=# ALTER USER postgres WITH PASSWORD 'postgres';ALTER ROLE 这样就算全部完成了,远程也可以连接数据库了。

相关推荐