linux上如何安装postgresql

安装对应的postgresql的yum源

rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm

yum update

yum update  

执行安装命令

yum install postgresql94-server postgresql94-contrib 

检查是否安装成功

rpm -qa| grep postgres  

初始化数据库

/usr/pgsql-9.4/bin/postgresql94-setup initdb

启动服务并设置为开机启动

systemctl enable postgresql-9.4  
systemctl start postgresql-9.4

访问postgresql

su - postgres 

设置postgres用户密码

会自动有一个postgres用户,设置密码
\password postgres

猜你喜欢

转载自www.cnblogs.com/traditional/p/11284077.html