1、下载地址
https://www.enterprisedb.com/download-postgresql-binaries

  

2、创建用户并修改密码
[root@node01 ~]# useradd postgres
[root@node01 ~]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.
[root@node01 ~]# id postgres
uid=1000(postgres) gid=1000(postgres) groups=1000(postgres) 3、创建目录并授权
[root@node01 ~]# mkdir /software/pgsql_data ---------数据目录
[root@node01 ~]# mkdir -p /stage ---------软件安装目录
[root@node01 ~]# chown -R postgres.postgres /software*
[root@node01 ~]# chown -R postgres.postgres /stage* 4、切换postgres用户,并解压安装包
[root@node01 stage]# su - postgres
[postgres@node01 ~]$ cd /stage/
[postgres@node01 stage]$ ll
total 156744
-rw-r--r-- 1 postgres postgres 160504039 Aug 17 23:11 postgresql-10.14-1-linux-x64-binaries.tar.gz
[postgres@node01 stage]$ tar -xvf postgresql-10.14-1-linux-x64-binaries.tar.gz 5、初始化
[postgres@node01 stage]$ /stage/pgsql/bin/initdb -D /software/pgsql_data
The files belonging to this database system will be owned by user "postgres".
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 /software/pgsql_data ... 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: /stage/pgsql/bin/pg_ctl -D /software/pgsql_data -l logfile start 6、启动数据库
[postgres@node01 stage]$ /stage/pgsql/bin/pg_ctl -D /software/pgsql_data -l logfile start
waiting for server to start.... done
server started 7、登陆数据库
[postgres@node01 stage]$ psql -Upostgres -dpostgres
psql.bin (10.14)
Type "help" for help. postgres=# 8、关闭数据库
[postgres@node01 stage]$ /stage/pgsql/bin/pg_ctl -D /software/pgsql_data -l logfile stop
waiting for server to shut down.... done
server stopped 9、扩展
postgres=# \l ---------列出所有的database
postgres=# \c test ----------选择database
test=# \d ----------列出所用database的表
test=# \d tablename ----------查看表结构
test=# \q ---------退出登陆

  

linux下postgresql安装的更多相关文章

  1. 【转帖】Windows下PostgreSQL安装图解

    Windows下PostgreSQL安装图解     这篇文章主要为大家介绍了如果在Windows下安装PostgreSQL数据库的方法,需要的朋友可以参考下     现在谈起免费数据库,大多数人首先 ...

  2. Linux下yum安装MySQL

    写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...

  3. LINUX下编译安装PHP各种报错大集合

    本文为大家整理汇总了一些linux下编译安装php各种报错大集合 ,感兴趣的同学参考下. nginx1.6.2-mysql5.5.32二进制,php安装报错解决: 123456 [root@clien ...

  4. 【夯实PHP基础系列】linux下yum安装PHP APC

    Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-de ...

  5. Linux学习心得之 Linux下ant安装与使用

    作者:枫雪庭 出处:http://www.cnblogs.com/FengXueTing-px/ 欢迎转载 Linux学习心得之 Linux下ant安装与使用 1. 前言2. ant安装3. 简单的a ...

  6. Linux下php安装Redis扩展

    说明: 操作系统:CentOS php安装目录:/usr/local/php php.ini配置文件路径:/usr/local/php7/etc/php.ini Nginx安装目录:/usr/loca ...

  7. linux下编译安装vim7.4并安装clang_complete插件

    linux下编译安装vim7.4并安装clang_complete插件 因为debian里软件仓库中下载安装的vim是不支持python写的插件的(可以打开vim,在命令模式先输入:py测试一下),导 ...

  8. linux下编译安装curl

    linux下编译安装curl 1.下载curl git clone https://github.com/curl/curl.git 2.在curl目录下生成configure文件 ./buldcon ...

  9. linux下编译安装boost库

    linux下编译安装boost库 linux下编译安装boost库 1.下载并解压boost 1.58 源代码 下载 解压 2.运行bootstrap.sh 3.使用b2进行构建 构建成功的提示 4. ...

随机推荐

  1. Perfview 分析进程性能

    PerfView 概述: PerfView是一个可以帮助你分析CPU和内存问题的工具软件.它非常轻量级也不会入侵诊断的程序,在诊断过程中对诊断的程序影响甚微. Visual Studio自带的性能分析 ...

  2. 如何用ABBYY解决文档图像存在缺陷,OCR 准确性低的问题

    扭曲的文本行.歪斜.噪声及扫描图像和数码照片中常见的其他缺陷可能会降低识别质量.ABBYY FineReader,提供各种 自动和手动工具去除这些缺陷. 如何手动编辑图像 如果您禁用了自动预处理功能或 ...

  3. PowerPoint无法正常加载MathType的解决方法

    MathType是一款十分便捷的数学公式编辑器,可以和很多办公软件和网站兼容使用,我们日常用的比较多的也就是Office和WPS,更具体的说是Word\Excel\PPT等等一系列办公常用软件. 不过 ...

  4. 一看就懂的:MySQL数据页以及页分裂机制

    文章公号 首发!连载中~ 欢迎各位大佬关注, 回复:"抽奖" 还可参加抽活动 文末有二维码 一.知识回顾 回顾一下之前和大家分享的知识点 看了前面的文章,想必你肯定了解了什么是Bu ...

  5. 2020.6.16 night 解题报告

    2020.6.16 night 解题报告 link 标签(空格分隔): 题解 概率与期望 T1 : Crossing Rivers UVA - 12230 SB题. 很唬人的一个连续期望. 很明显,在 ...

  6. MacOS Big Sur11.0升级后Eclipse启动报错

    本次升级MacOS Big Sur11.0.1之后,开启Eclipse时报空指针,打开页面空白,之后卸掉, 再次安装时提示加载不到libserver.dylib 或 Could not create ...

  7. LaTeX中的数学公式之矩阵

    矩阵的代码及注释: 显示效果:

  8. CentOS 6.5 iso系统定制

    前言 更改CentOS6.5背景图片.CentOS标题为DntOS,总之就是用ISO安装或者安装后的系统启动时不能有CentOS标志. ISO光盘目录介绍: (1)isolinux 目录存放光盘启动时 ...

  9. 痞子衡嵌入式:一个奇怪的Keil MDK下变量链接强制对齐报错问题(--legacyalign)

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家分享的是一个奇怪的Keil MDK下变量链接强制对齐报错问题. 痞子衡最近一直在参与恩智浦SBL项目(就是一个适用LPC和i.MXRT的完整OT ...

  10. Django 2版本

    django2.0里面的path第一个参数不支持正则,你写什么就匹配,100%精准匹配 django2.0里面的re_path对应着django1.0里面的url 虽然django2.0里面的path ...