centos6.9安装postgresql
来源:互联网 发布:如何把分开的数据整合 编辑:程序博客网 时间:2024/06/15 12:41
因工作需要验证sqoop1将postgresql的数据库导入到hbase,需要安装postgresql。
一 查看linux系统版本
1 $ cat /proc/version
Linux version 2.6.32-696.13.2.el6.x86_64 (mockbuild@c1bl.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Thu Oct 5 21:22:16 UTC 2017
2 得知是centos,接着查看centos版本
$ cat /etc/redhat-release
CentOS release 6.9 (Final)
二 安装postgresql
访问https://www.postgresql.org/download/linux/redhat/#yum,选择好系统版本后,根据官方提供的yum安装指令安装即可。
- Install the repository RPM:
yum install https://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-2.noarch.rpm
- Install the client packages:
yum install postgresql93
- Optionally install the server packages:
yum install postgresql93-server
- Optionally initialize the database and enable automatic start:
service postgresql-9.3 initdb
chkconfig postgresql-9.3 on
service postgresql-9.3 start
三 配置postgresql
postgresql安装完成后默认为linux系统创建了postgresql用户。
1 创建数据用户和创建数据库
#sudo su - postgres 切换账号,进入bash
psql 进入数据库管理
\password postgres 设置postgres账号密码为postgres
CREATE USER pguser WITH PASSWORD 'yanfa123'; 创建数据库用户
CREATE DATABASE test OWNER pguser; 创建数据库
GRANT ALL PRIVILEGES ON DATABASE test to pguser; 授权给pguser
此时 登录 出错:
$ psql -U pguser - d test
psql: FATAL: Peer authentication failed for user "pguser"
2 设置本地用户登录
/var/lib/pgsql/9.3/data/pg_hba.conf
将
# "local" is for Unix domain socket connections only
local all all peer
改为
# "local" is for Unix domain socket connections only
local all all md5
然后重启postgresql
sudo service postgresql-9.3 restart
则可以在本地登录
$ psql -U pguser -d test
类似的其他改为:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
然后重启postgresql
sudo service postgresql-9.3 restart
则可以使用ip登录
psql -U pguser -d test -h 127.0.0.1
3 设置远程连接
sudo vi /var/lib/pgsql/9.3/data/postgresql.conf
定位到#listen_addresses=’localhost’。PostgreSQL安装完成后,默认是只接受来在本机localhost的连接请 求。
将行开头都#去掉,将行内容修改为listen_addresses=’*'来允许数据库服务器监听来自任何主机的连接请求
/var/lib/pgsql/9.4/data/pg_hba.conf 添加一行
host all all 0.0.0.0/0 md5
sudo service postgresql-9.3 restart
- centos6.9安装postgresql
- centos6.5 下安装Postgresql
- CentOS6.5下安装PostgreSQL
- 在centos6.*下安装PostgreSQL
- centos6源码安装postgresql 9.1.4
- centos6.3安装启动使用PostgreSQL 9.2
- centos6.3下安装Postgresql安装与配置
- 【CDH5】-001CentOS6.5 下yum安装PostgreSQL
- centos6.5安装postgresql数据库和pgadmin客户端
- CentOS6.5下tar包安装postgresql-9.6.1数据库
- FSGUI的安装ISO(fsgui,freeswitch,postgresql,redis,centos6)
- 安装CentOS6.9
- Centos6.9安装教程
- centos6.9安装mysqlclinet
- centos6.9安装ssdb
- CentOS6.9 安装 zeroMQ
- centos6.9安装redis
- linux 安装postgreSQL 9版本
- UVa10917 Walk Through the Forest
- codevs 2491 玉蟾宫(悬线法)
- 高效字节流bufferedinputstream和bufferedoutputstream
- JAVA基础——————————第一篇:Java语言基础篇
- 1022. D进制的A+B (20)
- centos6.9安装postgresql
- 网络协议,端口定义等相关内容
- Java编程思想——对象导论
- SpringBoot开发详解(三)--SpringBoot配置文件YML注意事项
- Spring Data JPA的懒加载问题
- PullToRefreshScrollView 整体刷新的使用
- [LeetCode]34. Search for a Range
- linux命令集
- Tensorflow卷积神经网络