---
title: "CentOS环境下安装postgresql9.3"
author: "liming495"
date: "2014-07-24T10:13:05Z"
tags: []
categories: ["非技术"]
slug: "centos-postgresql9-3"
draft: false
lastmod: "2014-07-24T10:13:05Z"
id: 2095813
url: "https://liming495.iteye.com/blog/2095813"
---

1

```
exclude=postgresql*
```

 2

```
yum localinstall http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
```

 3

```
yum list postgres*
```

 4

```
yum install postgresql93-server
```

 5

```
cd /var/lib/pgsql/9.3/data/
```

 6

```
service postgresql-9.3 initdb
```

 7

```
chkconfig postgresql-9.3 on
```

 8

```
service postgresql-9.3 start
```

 9

```
vim postgresql.conf
listen_addresses = '*'
```

 10

```
vim pg_hba.conf
host    all             all             192.168.0.0/24          password
```

 11

```
passwd postgres
```

 12

```
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8888 -j ACCEPT
service iptables restart
```

 13

```
service postgresql-9.3 restart
```

 14

```
su postgres
psql -U postgres
postgres=# ALTER USER postgres WITH PASSWORD 'postgres'
postgres=# \q
```