CentOS7 下安装 PostgreSQL10
2017-10-22 10:36
716 查看
1、下载源代码并解压
1. wget https://ftp.postgresql.org/pub/source/v9.4.15/postgresql-9.4.15.tar.gz 2. tar -xvzf postgresql-10.0.tar.gz #解压pg包 3. ./configure 4. sudo make 5. sudo make install
2、创建用户组和用户
1. groupadd postgres #新增用户组 2. useradd -g postgres postgres #新增用户 3. passwd postgres #为用户设置密码
3、创建数据目录
1. mkdir /usr/local/pgsql/data 2. chown postgres /usr/local/pgsql/data #设置data文件加属性 3. chmod 700 /usr/local/pgsql/data #设置data文件夹权限
4、数据库操作
1. /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data #初始化数据库 2. ./pg_ctl start\stop\restart -D /usr/local/pgsql/data/ #启动\停止\重启数据库 3. /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 & #设置日志输出位置 4. /usr/local/pgsql/bin/createdb test #创建测试数据库 5. /usr/local/pgsql/bin/psql test #启动测试数据库
5、修改postgresql.conf
1. listen_addresses = '*' 2. port = 5432
6、修改pg_hba.conf
# "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 0.0.0.0/0 trust
7、远程连接
1. 查看防火墙是否关闭:firewall-cmd --state 2. 启动服务:systemctl start firewalld.service 3. 关闭服务:systemctl stop firewalld.service 4. 重启服务:systemctl restart firewalld.service 5. 显示服务的状态:systemctl status firewalld.service 6. 在开机时启用服务:systemctl enable firewalld.service 7. 在开机时禁用服务:systemctl disable firewalld.service 8. 查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $? 9. 查看已启动的服务列表:systemctl list-unit-files|grep enabled 10. 添加开发端口:firewall-cmd --zone=public --add-port=5432/tcp --permanent 11. 重新加载防火墙:firewall-cmd --reload
相关文章推荐
- Centos7安装PostgreSQL10
- centos7安装postgresql10的简单步骤
- postgresql 10免安装版pgAdmin 4无法启动的问题:PostgreSQL pgadmin4 the application server could not be contacted
- Vmvare 10 中安装centos7 出现 没有可用的网络设备
- redhat 6.8安装postgresql 10
- VMware10下CentOS7的详细安装图解
- centos 7 安装postgresql9.6/10和Postgis
- CentOS7安装并配置PostgreSQL
- CentOS 7 安装、配置、使用 PostgreSQL 10 安装及基础配置
- Centos7下安装postgresql-9.5
- CentOS7用yum安装、配置MariaDB 10
- VMware10下CentOS7的详细安装图解
- linux (CentOS 7) 下安装 postgresql 10
- centos7安装并配置mysql和postgresql
- CentOS7用yum安装、配置MariaDB 10
- postgresql9.5 安装配置和使用(on centos7)
- VMware10下CentOS7的详细安装图解+centos7最小化系统安装设置IP(ifconfig找不到)
- Ubuntu 10 系统下postgreSQL9.0的安装及使用笔记
- centos7 安装 mariadb-10
- Ubuntu Linux 安装Postgresql 10