PostgreSQL
Зміст
Встановлення старої версії
# yum install postgresql postgresql-server
Встановлення нової версії
добавляємо репозиторій c5-testing.repo:
[c5-testing] name=CentOS-5 Testing. baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/ enabled=0 gpgcheck=1 gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
yum --disablerepo=\* --enablerepo=c5-testing install postgresql-server postgresql
перед першим запуском
# service postgresql initdb
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
Налаштування
- cp /usr/share/pgsql/pg_hba.conf.sample /var/lib/pgsql/data/pg_hba.conf
Запуск
# chkconfig postgresql on # service postgresql start
Вхід у консоль
# su - postgres $ psql template1
or
$ psql -d template1 -U postgres
Створення користувача
# adduser andrew # passwd andrew # su - postgres $ psql template1 template1=# CREATE USER andrew WITH PASSWORD 'myPassword'; template1=# CREATE DATABASE mydb; template1=# GRANT ALL PRIVILEGES ON DATABASE mydb to andrew; template1=# \q
тестуваня
$ su - andrew $ psql -d mydb -U andrew
Віддалений доступ
додати в /var/lib/pgsql/data/pg_hba.conf add:
host name_base name_user 0.0.0.0/0 md5