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. 基于RBAC实现权限管理

    基于RBAC实现权限管理 技术栈:SpringBoot.SpringMVC RBAC RBAC数据库表 主体 编号 账号 密码 001 admin 123456 资源 编号 资源名称 访问路径 001 ...

  2. 用JavaScript做精灵图

    用JavaScript做精灵图 精灵图可以不用在给每一个小块一 一的修改位置.主要原理是找到整张的背景图与li的下标的数学关系. 这是一大张背景图,这个背景图的位置其实是有规律的,每两张之间间隔一个固 ...

  3. 搭建zookeeper集群(伪集群)

    jdk环境 上传zk压缩包 解压缩 复制三份 mkdir /usr/local/zk_cluster cp -r zookeeper-3.4.6 /usr/local/zk_cluster/zooke ...

  4. python-网络安全编程第八天(实战高精度密码字典生成器)

    前言 emmmm 高精度密码字典源码 1.py import exrex import sys #url过滤处理 def host_para(host): if '://' in host: host ...

  5. [C#.NET 拾遗补漏]13:动态构建LINQ查询表达式

    最近工作中遇到一个这样的需求:在某个列表查询功能中,可以选择某个数字列(如商品单价.当天销售额.当月销售额等),再选择 小于或等于 和 大于或等于 ,再填写一个待比较的数值,对数据进行查询过滤. 如果 ...

  6. C++基础知识篇:C++ 常量

    常量是固定值,在程序执行期间不会改变.这些固定的值,又叫做字面量. 常量可以是任何的基本数据类型,可分为整型数字.浮点数字.字符.字符串和布尔值. 常量就像是常规的变量,只不过常量的值在定义后不能进行 ...

  7. mysql undo+redo+binlog

    rt 数据库事务开始之前,会将要修改的记录存放到UNdo日志里,当事务回滚时或数据库崩溃时,可以利用undo日志撤销未提交事务对数据库产生的影响. 逻辑日志,记录一个过程,提交后不会删除.delete ...

  8. 【mq读书笔记】消息过滤机制

    mq支持表达式过滤和类过滤两种模式,其中表达式又分为TAG和SQL92.类过滤模式允许提交一个过滤类到FilterServer,消息消费者从FilterServer拉取消息,消息经过FilterSer ...

  9. 腾讯云 CHDFS — 云端大数据存算分离的基石

    随着网络性能提升,云端计算架构逐步向存算分离转变,AWS Aurora 率先在数据库领域实现了这个转变,大数据计算领域也迅速朝此方向演化. 存算分离在云端有明显优势,不但可以充分发挥弹性计算的灵活,同 ...

  10. Java lambda 分组后多列求和

    主要思路是reducing,可以像sql一样分组后多列求和处理成新对象等: select code,max(name)as name,sum(chengJi)as chengJi,sum(age)as ...