广告
返回顶部
首页 > 资讯 > 数据库 >源码编译怎么安装PostgresSQL
  • 259
分享到

源码编译怎么安装PostgresSQL

2024-04-02 19:04:59 259人浏览 薄情痞子
摘要

这篇文章主要讲解了“源码编译怎么安装Postgressql”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“源码编译怎么安装PostgresSQL”吧!一、环境

这篇文章主要讲解了“源码编译怎么安装Postgressql”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“源码编译怎么安装PostgresSQL”吧!

一、环境准备

1、安装依赖包

yum -y install GCc*
yum -y install python Python-devel
yum -y install perl-ExtUtils-Embed
yum -y install zlib-devel
yum -y install readline*

2、创建用户组、目录

groupadd -g 1001 postgres #新增用户组
useradd -g 1001 -u 1001 postgres #新增用户
[root@pg11 ~]# id postgres
uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)
passwd postgres #为用户设置密码

3、创建目录

mkdir -p /usr/local/pgsql11.5
chown -R postgres:postgres /usr/local/pgsql11.5/

mkdir -p /home/osdata/pgdata
chown -R postgres:postgres /home/osdata/
chmod 0700 /home/osdata/pgdata

4、修改环境变量(postgres用户)

export PATH=/usr/local/pgsql11.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pgsql11.5/lib
export PGDATA=/home/osdata/pgdata

5、上传软件包,并且解压缩(root)

[root@pg11 pgsql11.5]# ll
total 19312
-rw-r–r--. 1 root root 19773087 Oct 30 20:05 postgresql-11.5.tar.bz2
[root@pg11 pgsql11.5]#chown -R postgres:postgres /usr/local/pgsql11.5/
[root@pg11 pgsql11.5]# ll
total 19312
-rw-r–r--. 1 postgres postgres 19773087 Oct 30 20:05 postgresql-11.5.tar.bz2

tar -xvf postgresql-11.5.tar.bz2

6、生成链接

ln -sf /usr/local/pgsql11.5 /usr/local/pgsql

二、安装postgresql

1、编译

cd postgresql-11.5/
./configure --prefix=/usr/local/pgsql11.5 --with-perl --with-python

2、安装

一次性把文档及附加模块全部进行编译和安装
gmake world
出现“PostgreSQL, contrib, and documentation successfully made. Ready to install.”说明编译成功

gmake install-world
出现“PostgreSQL, contrib, and documentation installation complete.”说明安装成功

查看版本
[postgres@pg11 postgresql-11.5]$ postgres --version
postgres (PostgreSQL) 11.5

3、初始化数据库

initdb -D /home/osdata/pgdata/ -W

4、启动数据库

pg_ctl -D $PGDATA -l logfile start

5、查看实例进程

[postgres@pg ~]$ ps -ef|grep postgres
postgres 56625 1 0 Mar04 ? 00:00:03 /usr/local/pgsql11.5/bin/postgres -D /home/osdata/pgdata
postgres 56627 56625 0 Mar04 ? 00:00:00 postgres: checkpointer
postgres 56628 56625 0 Mar04 ? 00:00:01 postgres: background writer
postgres 56629 56625 0 Mar04 ? 00:00:01 postgres: walwriter
postgres 56630 56625 0 Mar04 ? 00:00:05 postgres: autovacuum launcher
postgres 56631 56625 0 Mar04 ? 00:00:10 postgres: stats collector
postgres 56632 56625 0 Mar04 ? 00:00:00 postgres: logical replication launcher
root 76758 76699 0 11:01 pts/0 00:00:00 su - postgres
postgres 76759 76758 0 11:01 pts/0 00:00:00 -bash
postgres 76797 76759 0 11:01 pts/0 00:00:00 psql
postgres 76801 56625 0 11:01 ? 00:00:00 postgres: postgres test [local] idle
root 77192 77145 0 11:21 pts/1 00:00:00 su - postgres
postgres 77193 77192 0 11:21 pts/1 00:00:00 -bash
postgres 79582 77193 0 13:45 pts/1 00:00:00 ps -ef
postgres 79583 77193 0 13:45 pts/1 00:00:00 grep --color=auto postgres

查看数据库状态
[postgres@pg11 ~]$ pg_ctl -D /home/osdata/pgdata/ status
pg_ctl: server is running (PID: 23588)
/usr/local/pgsql11.5/bin/postgres “-D” “/home/osdata/pgdata”

6、设置开机自启动

1、配置脚本服务
在源码包的contrib目录中有linux、freebsd、Macos适用的服务脚本
[root@pg11 ~]# cd /usr/local/pgsql/postgresql-11.5/contrib/start-scripts
[root@pg11 start-scripts]# ll
total 8
-rw-r–r--. 1 postgres postgres 1467 Aug 6 2019 freebsd
-rw-r–r--. 1 postgres postgres 3552 Aug 6 2019 linux
drwxrwxr-x. 2 postgres postgres 84 Aug 6 2019 macos
把名为linux的脚本拷贝到/etc/init.d目录,并且重命名为postgresql11
[root@pg11 ~]# cp /usr/local/pgsql/postgresql-11.5/contrib/start-scripts/linux /etc/init.d/postgresql11
[root@pg11 init.d]# chmod +x postgresql-11
[root@pg11 init.d]# chkconfig postgresql-11 on
[root@pg11 init.d]# chkconfig --list |grep postgresql-11
postgresql-11 0:off 1:off 2:on 3:on 4:on 5:on 6:off

7、登录数据库

[postgres@pg ~]$ psql
psql (11.5)
Type “help” for help.

postgres=#

感谢各位的阅读,以上就是“源码编译怎么安装PostgresSQL”的内容了,经过本文的学习后,相信大家对源码编译怎么安装PostgresSQL这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是编程网,小编将为大家推送更多相关知识点的文章,欢迎关注!

您可能感兴趣的文档:

--结束END--

本文标题: 源码编译怎么安装PostgresSQL

本文链接: https://www.lsjlt.com/news/62968.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • 源码编译怎么安装PostgresSQL
    这篇文章主要讲解了“源码编译怎么安装PostgresSQL”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“源码编译怎么安装PostgresSQL”吧!一、环境...
    99+
    2022-10-18
  • 源码编译怎么安装pg11.5
    这篇文章主要介绍“源码编译怎么安装pg11.5”,在日常操作中,相信很多人在源码编译怎么安装pg11.5问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”源码编译怎么安装pg11...
    99+
    2022-10-18
  • PHP源码编译安装
    目录 编译环境编译过程运行配置运行环境1. 创建php.ini文件2. 创建 php-fpm.conf文件3. 创建 www.conf文件4. 配置连接socket为文件(可选)5. 配置ng...
    99+
    2023-09-21
    php sqlite ubuntu
  • 源码编译安装mysql5.7.18
    #yum install -y gcc-c++ cmake vim ncurses-devel wget#useradd mysql -s /home/nologin#mkdir /soft/my...
    99+
    2022-10-18
  • MySQL源码编译安装
    1、安装cmake-2.8.10.2.tar.gz以root用户进入shell#tar -zxvf  cmake-2.8.10.2.tar.gz#cd cmake-2.8.10.2#./confi...
    99+
    2022-10-18
  • 源码编译安装MySQL8.0.20
    2 源码编译安装的相关知识 2.1 make与configure make是一个编译的命令,会在当前的目录下寻找Makefile这个文件,Makefile文件记录了源代码如何编译的详细信息。而configure是由软件开发商编写的一个检测程...
    99+
    2017-08-02
    源码编译安装MySQL8.0.20
  • MySQL5.7.26 源码编译安装
    1.安装依赖组件yum -y install gcc gcc-c++ pcre pcre-devel openssl openssl-devel yum -y install zlib zlib-devel...
    99+
    2022-10-18
  • 源码编译安装mysql-5.7.14
    1.下载并上传 mysql-5.7.14.tar.gz view plain copytar -zxf msql-5.7.14.tar.gz  2...
    99+
    2022-10-18
  • mysql 5.6.24怎么进行源码编译安装
    这篇文章给大家介绍mysql 5.6.24怎么进行源码编译安装,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。 环境:     系统平台&nb...
    99+
    2022-10-18
  • 源码编译安装LAMP环境
    1、请描述一次完整的http请求处理过程;2、httpd所支持的处理模型有哪些,他们的分别使用于哪些环境。3、源码编译安装LAMP环境(基于wordpress程序),并写出详细的安装、配置、测试过程。4、建...
    99+
    2022-10-18
  • 源码如何编译安装MySQL5.6.12
    这篇文章主要为大家展示了“源码如何编译安装MySQL5.6.12”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“源码如何编译安装MySQL5.6.12”这篇文章吧...
    99+
    2022-10-18
  • LAMP纯源码编译安装日志
    一.LAMP构架的安装与经验技巧(源码安装好处。是便于管理,可以选定参数,可以使用新版本)相关软件列表:# ls /soft/ | grep -E "*.gz|*.zip|*.xz|*.bz2" ...
    99+
    2022-10-18
  • MySQL5.7.16源码编译安装的过程
    这篇文章主要讲解了“MySQL5.7.16源码编译安装的过程”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“MySQL5.7.16源码编译安装的过程”吧!安装...
    99+
    2022-10-18
  • 如何用源码编译安装MySQL8.0.20
    这篇文章主要讲解了如何用源码编译安装MySQL8.0.20,内容清晰明了,对此有兴趣的小伙伴可以学习一下,相信大家阅读完之后会有帮助。1 概述本文章主要讲述了如何从源码编译安装MySQL社区版8.0.20,...
    99+
    2022-10-18
  • MySQL5.6源码编译安装的流程
    本篇内容主要讲解“MySQL5.6源码编译安装的流程”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“MySQL5.6源码编译安装的流程”吧! ...
    99+
    2022-10-18
  • VS2022编译安装Qt6.5源码教程
    目录一、准备环境二、下载Qt 6.5源码三、解压四、编译、安装一、准备环境 包括安装VS2022,Windows SDK,Python3,这里就不再一一介绍了,需要说明的一点是还需要...
    99+
    2023-05-20
    VS2022编译安装Qt6.5源码 VS2022安装Qt6.5源码
  • 怎么通过源码编译的方式安装apache2.4
    这篇文章给大家分享的是有关怎么通过源码编译的方式安装apache2.4的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的...
    99+
    2023-06-28
  • CentOS 6.10源码编译及使用ansible编译安装httpd2.4.39
    一、编译安装 编译环境准备 主机 系统 A centos6.10 编译所需的httpd、apr、ap...
    99+
    2022-06-04
    ansible安装httpd ansible源码
  • 怎么用源代码编译安装PHP-PDO-MYSQL扩展
    本篇内容主要讲解“怎么用源代码编译安装PHP-PDO-MYSQL扩展”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么用源代码编译安装PHP-PDO-MYSQL扩展”吧!步骤1:下载源代码首先,...
    99+
    2023-07-05
  • 源码编译安装MySQL 5.7.9的过程
    这篇文章主要介绍“源码编译安装MySQL 5.7.9的过程”,在日常操作中,相信很多人在源码编译安装MySQL 5.7.9的过程问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”源码编译安装MySQL 5.7.9...
    99+
    2023-06-01
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作