Fedora24下安装postgresql
2016-07-17 18:22
316 查看
安装:
dnf install postgresql postgresql-server postgresql-contrib pgadmin3
数据库初始化:
postgresql-setup initdb
数据库启动
systemctl start postgresql.service
开机自动启动
systemctl enable postgresql.service
查看状态
netstat -tulnp | grep 5432
开启远程访问:
vim /var/lib/pgsql/data/postgresql.conf
vim /var/lib/pgsql/data/pg_hba.conf
重新启动postgresql服务:
systemctl restart postgresql.service
修改用户密码:
su postgres
psql
ALTER USER postgres WITH PASSWORD 'postgres' #修改密码为 postgres
\q
防火墙设置:
systemctl stop firewalld.service #停止firewall
systemctl
disable firewalld.service #禁止firewall开机启动
dnf
install iptables-services #安装iptables
vim
/etc/sysconfig/iptables #编辑防火墙配置文件
systemctl restart iptables.service #重新启动iptables.service
关闭SELINUX:
vi /etc/selinux/config
setenforce 0 #使配置立即生效
dnf install postgresql postgresql-server postgresql-contrib pgadmin3
数据库初始化:
postgresql-setup initdb
数据库启动
systemctl start postgresql.service
开机自动启动
systemctl enable postgresql.service
查看状态
netstat -tulnp | grep 5432
<span style="font-size:14px;">tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 6265/postgres tcp6 0 0 :::5432 :::* LISTEN 6265/postgres</span>
开启远程访问:
vim /var/lib/pgsql/data/postgresql.conf
listen_addresses ='*' #注意去掉前面的注释。
vim /var/lib/pgsql/data/pg_hba.conf
# IPv4 local connections: host all all 127.0.0.1/32 trust host all all 192.168.1.1/24 trust # IPv6 local connections: host all all ::1/128 trust
重新启动postgresql服务:
systemctl restart postgresql.service
修改用户密码:
su postgres
psql
ALTER USER postgres WITH PASSWORD 'postgres' #修改密码为 postgres
\q
防火墙设置:
systemctl stop firewalld.service #停止firewall
systemctl
disable firewalld.service #禁止firewall开机启动
dnf
install iptables-services #安装iptables
vim
/etc/sysconfig/iptables #编辑防火墙配置文件
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT #添加端口
systemctl restart iptables.service #重新启动iptables.service
关闭SELINUX:
vi /etc/selinux/config
#SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 :wq! #保存退出
setenforce 0 #使配置立即生效
相关文章推荐
- js对象取值的两种方式
- 正则表达式
- HTML有2种路径的写法:绝对路径和相对路径
- [置顶] 使用Redux管理你的React应用
- localStorage
- html5地理位置定位功能小析
- HTML的dl、dt、dd标记制作表格对决Table制作表
- JSP学习笔记之二
- HTML小结
- angularJS系列之监听路由变化$location和$route实例
- js笔记5浏览器对象和history和screen
- JS获取节点的兄弟,父级,子级元素
- html5拖拽
- javascript函数基础
- css3
- javaScript事件类型四(键盘与文本事件)
- JavaScript arguments对象
- jQuery学习<二> — — Dom对象和jQuery对象
- CSS 三列平分
- modernizr css3、h5兼容方案