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. ...
随机推荐
- TypeScript 引入第三方包,报无法找到模块错误
以 react-router-dom 模块为例 1. npm加上 @types/ 根据报错提示尝试安装该库的TypeScript版本 (该库的 ts 声明文件),也就是在该库的名称前加上 @types ...
- Dubbo 服务引入-Version2.7.5
1.服务引用原理 Dubbo 服务引用的时机有两个,第一个是在 Spring 容器调用 ReferenceBean 的 afterPropertiesSet 方法时引用服务,第二个是在 Referen ...
- 解决docker镜像无vim
docker拉取的镜像一般都是ubantu系统 安装vim apt-get update apt-get vim
- PHP的命令执行漏洞学习
首先我们来了解基础 基础知识来源于:<web安全攻防>徐焱 命令执行漏洞 应用程序有时需要调用一些执行系统命令的函数,如在PHP中,使用system.exec.shell_exec.pas ...
- ctf-web-sql
姿势文章总结 freebuf http://www.freebuf.com/news/139288.html http://www.freebuf.com/articles/web/137094.ht ...
- 如何查看CDR文件是出自哪个版本?
如何才能知道某个cdr文件用哪个版本的CorelDRAW软件打开?网上CorelDRAW软件有很多版本,都不知该下哪个了?这是我听到大家问道最多的问题,这是因为CDR低版本软件打不开高版本文件. 方法 ...
- 从维基百科等网站复制公式到MathType中
在写论文的时候你会想要一些比书本上更好的实例,所以你会在网上寻找资源.当你发现一个你想要的公式时,发现网页公式复制粘贴后太模糊而不适合打印或者投影.这种问题在MathType中如何解决呢? 你可以将网 ...
- 如何清理MacBook电脑缓存?
使用Mac电脑的用户都知道,Mac其空间硬盘大多数都是只有128G以及256G的规格,而用惯了win系统基本都是超过512G的硬盘的用户,转手来使用Mac电脑,就不得不接受这一硬伤问题. 用户往往再怎 ...
- mysql常用语句列表
增 增加一张表 CREATE TABLE `table_name`( ... )ENGINE=InnoDB DEFAULT CHARSET=utf8; 增加记录 INSERT INTO `your_t ...
- 最全总结 | 聊聊 Python 办公自动化之 Word(下)
1. 前言 关于 Word 文档的读写,前面两篇文章分别进行了一次全面的总结 最全总结 | 聊聊 Python 办公自动化之 Word(上) 最全总结 | 聊聊 Python 办公自动化之 Word( ...