linux下postgresql安装
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安装的更多相关文章
- 【转帖】Windows下PostgreSQL安装图解
Windows下PostgreSQL安装图解 这篇文章主要为大家介绍了如果在Windows下安装PostgreSQL数据库的方法,需要的朋友可以参考下 现在谈起免费数据库,大多数人首先 ...
- Linux下yum安装MySQL
写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...
- LINUX下编译安装PHP各种报错大集合
本文为大家整理汇总了一些linux下编译安装php各种报错大集合 ,感兴趣的同学参考下. nginx1.6.2-mysql5.5.32二进制,php安装报错解决: 123456 [root@clien ...
- 【夯实PHP基础系列】linux下yum安装PHP APC
Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-de ...
- Linux学习心得之 Linux下ant安装与使用
作者:枫雪庭 出处:http://www.cnblogs.com/FengXueTing-px/ 欢迎转载 Linux学习心得之 Linux下ant安装与使用 1. 前言2. ant安装3. 简单的a ...
- Linux下php安装Redis扩展
说明: 操作系统:CentOS php安装目录:/usr/local/php php.ini配置文件路径:/usr/local/php7/etc/php.ini Nginx安装目录:/usr/loca ...
- linux下编译安装vim7.4并安装clang_complete插件
linux下编译安装vim7.4并安装clang_complete插件 因为debian里软件仓库中下载安装的vim是不支持python写的插件的(可以打开vim,在命令模式先输入:py测试一下),导 ...
- linux下编译安装curl
linux下编译安装curl 1.下载curl git clone https://github.com/curl/curl.git 2.在curl目录下生成configure文件 ./buldcon ...
- linux下编译安装boost库
linux下编译安装boost库 linux下编译安装boost库 1.下载并解压boost 1.58 源代码 下载 解压 2.运行bootstrap.sh 3.使用b2进行构建 构建成功的提示 4. ...
随机推荐
- 启动时出现错误:*** Warning - bad CRC or NAND
前面转自:https://www.cnblogs.com/java20130726/archive/2012/06/15/3218570.html 在对NAND Flash烧写了bootstrap和U ...
- 下载器Folx扩展程序支持哪些浏览器
Folx使用多线程的下载方式大大提升了下载的速度,可以完全替代浏览器自带的下载工具,使下载文件的管理更加简单高效.但是,必须给浏览器安装Folx扩展程序,才能使用Folx下载页面链接. Folx在偏好 ...
- 【PYTEST】第一章常用命令
pytest入门 安装pytest 运行pytest pytest常用命令 1. 安装pytest pip install pytest 2. 运行pytest 2.1 pytest默认搜索当前目录下 ...
- leetcode133. 克隆图
给定无向连通图中一个节点的引用,返回该图的深拷贝(克隆).图中的每个节点都包含它的值 val(Int) 和其邻居的列表(list[Node]).示例: 输入:{"$id":&quo ...
- yii2.0使用bootstrap中日期插件
Yii2框架引用bootstrap中日期插件yii2-date-picker的方法. 使用composer安装 日期插件 php composer.phar require "2amigos ...
- 深入浅出之mysql索引--上
当着小萌新之际,最近工作中遇到了mysql优化的相关问题,然后既然提到了优化,很多像我这样的小萌新不容置喙,肯定张口就是 建立索引 之类的. 那么说到底,索引到底是什么,它是怎么工作的?接下来就让我和 ...
- kubelet CPU 使用率过高问题排查
kubelet CPU 使用率过高问题排查 问题背景 客户的k8s集群环境,发现所有的worker节点的kubelet进程的CPU使用率长时间占用过高,通过pidstat可以看到CPU使用率高达100 ...
- LaTeX中的插图
插图代码及注释: 显示效果: 更多命令可以看相关文档,通过在命令行终端输入 texdoc graphicx 命令打开文档.
- Leetcode第 217 场周赛(思维量比较大)
Leetcode第 217 场周赛 比赛链接:点这里 做完前两题我就知道今天的竞赛我已经结束了 这场比赛思维量还是比较大的. 1673. 找出最具竞争力的子序列 题目 给你一个整数数组 nums 和一 ...
- spring boot 访问外部http请求
以前 访问外部请求都要经过 要用 httpClient 需要专门写一个方法 来发送http请求 这个这里就不说了 网上一搜全都是现成的方法 springboot 实现外部http请求 是通过F ...