PostgreSQL Сравнение версий

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
wiki:руководство_по_ubuntu_server:базы_данных:postgresql [2012/07/16 21:19]
[Установка]
wiki:руководство_по_ubuntu_server:базы_данных:postgresql [2015/06/25 19:40] (текущий)
[Ссылки]
Строка 18: Строка 18:
 ====Настройка==== ====Настройка====
  
-By default, connection via TCP/​IP ​is disabled. PostgreSQL ​supports multiple client authentication methods. IDENT authentication method is used for postgres ​and local users, unless otherwise configuredPlease refer the PostgreSQL Administrator'​s Guide if you would like to configure alternatives like Kerberos.+По умолчанию соединения через ​TCP/​IP ​заблокированы. PostgreSQL ​поддерживает множество методов аутентификацииМетод аутентификации **IDENT** используется для **postgres** и локальных пользователей пока не настроено что-то ещеОбратитесь к [[http://​www.postgresql.org/​docs/​8.4/​static/​admin.html|PostgreSQL Administrator'​s Guide]], если вы собираетесь использовать какую-либо альтернативу типа ​Kerberos.
  
-The following discussion assumes that you wish to enable ​TCP/​IP ​connections and use the MD5 method for client authentication. PostgreSQL ​configuration files are stored in the /​etc/​postgresql/<​version>/​main ​directoryFor exampleif you install ​PostgreSQL 8.4, the configuration files are stored in the /​etc/​postgresql/​8.4/​main ​directory+Дальнейшее обсуждение предполагает,​ что вы собираетесь разрешить соединения по TCP/​IP ​и используете аутентификацию клиентов на основе метода ​MD5. Файлы настроек ​PostgreSQL ​хранятся в каталоге **%%/​etc/​postgresql/%%//<​version>​//%%/main%%**Напримересли вы установили ​PostgreSQL 8.4, файлы настроек сохранятся в каталоге ​/​etc/​postgresql/​8.4/​main. 
- +<note tip>​Для настройки аутентификации **ident** добавьте записи в файл ​/​etc/​postgresql/​8.4/​main/​pg_ident.conf. ​В файле содержатся подробные комментарии чтобы направлять вас.</​note>​ 
-To configure ​ident authentication,​ add entries to the /​etc/​postgresql/​8.4/​main/​pg_ident.conf ​fileThere are detailed comments in the file to guide you+Чтобы разрешить соединения по TCP/​IP, ​отредактируйте файл ​/​etc/​postgresql/​8.4/​main/​postgresql.conf. 
- +Найдите строку 
-To enable ​TCP/​IP ​connectionsedit the file /​etc/​postgresql/​8.4/​main/​postgresql.conf +<​code>​#​listen_addresses = '​localhost'​</​code>​ 
- +и замените ее на
-Locate the line #​listen_addresses = '​localhost' ​and change it to+<​code>​listen_addresses = '​localhost'​</​code>​ 
- +<​note>​Чтобы разрешить другим компьютерам соединяться с вашим ​PostgreSQL ​сервером,​ замените %%'​localhost'​%% на IP адрес вашего сервера или в качестве альтернативы на 0.0.0.0, ​чтобы подключить все интерфейсы.</note> 
-listen_addresses = '​localhost'​ +Вы можете также редактировать любые другие параметрыесли знаете что вы делаете! Для подробностей смотрите комментарии файла настроек или документацию по PostgreSQL.
- +
-To allow other computers to connect to your PostgreSQL ​server replace ​'​localhost' ​with the IP Address of your server, or alternatively to '0.0.0.0' to bind to all interfaces. +
- +
-You may also edit all other parametersif you know what you are doing! For details, refer to the configuration file or to the PostgreSQL documentation. +
- +
-Now that we can connect to our PostgreSQL server, the next step is to set a password for the postgres user. Run the following command at a terminal prompt to connect to the default PostgreSQL template database: +
- +
-sudo -u postgres psql template1 +
- +
-The above command connects to PostgreSQL database template1 as user postgres. Once you connect to the PostgreSQL server, you will be at a SQL prompt. You can run the following SQL command at the psql prompt to configure the password for the user postgres. +
- +
-ALTER USER postgres with encrypted password '​your_password';​ +
- +
-After configuring the password, edit the file /etc/​postgresql/​8.4/​main/​pg_hba.conf to use MD5 authentication with the postgres user: +
- +
-local   ​all ​        ​postgres ​                         md5 +
- +
-Finallyyou should restart the PostgreSQL ​service to initialize the new configuration. From a terminal prompt enter the following to restart PostgreSQL:​ +
- +
-sudo /​etc/​init.d/​postgresql-8.4 restart +
- +
-The above configuration is not complete by any means. Please refer the PostgreSQL Administrator'​s Guide to configure more parameters.+
  
 +Теперь,​ поскольку мы можем подключиться к нашему серверу PostgreSQL, следующим шагом будет установка пароля для пользователя **postgres**. Выполните следующую команду в терминале для соединения со стандартной базой шаблонов PostgreSQL:
 +<​code>​sudo -u postgres psql template1</​code>​
 +Эта команда подключится к PostgreSQL базе данных template1 как пользователь postgres. После подключения к серверу PostgreSQL вы окажетесь в SQL консоли. Вы можете выполнить следующую SQL команду в консоли **psql** для настройки пароля пользователя postgres:
 +<​code>​ALTER USER postgres with encrypted password '​your_password';</​code>​
 +После настройки пароля,​ измените файл /​etc/​postgresql/​8.4/​main/​pg_hba.conf на использование MD5 аутентификации для пользователя postgres:
 +<​code>​local ​  ​all ​        ​postgres ​                         md5</​code>​
 +Под конец вам потребуется перезапустить сервис PostgreSQL для применения новых настроек. Из терминала выполните следующее для перезапуска PostgreSQL:
 +<​code>​sudo /​etc/​init.d/​postgresql-8.4 restart</​code>​
 +<note important>​Настройка выше в любом случае неполная. Пожалуйста обратитесь к руководству [[http://​www.postgresql.org/​docs/​8.4/​static/​admin.html|PostgreSQL Administrator'​s Guide]] для настройки других параметров.</​note>​
  
 ====Ссылки==== ====Ссылки====
  
-    As mentioned above the Administrator'​s Guide is an excellent resourceThe guide is also available in the postgresql-doc-8.4 ​packageExecute the following in a terminal to install ​the package:+ 1. Как упоминалось выше, [[http://​www.postgresql.org/​docs/​8.4/​static/​admin.html|Administrator'​s Guide]] - великолепный ресурсРуководство также доступно из пакета **postgresql-doc-8.4**Выполните следующую команду в терминале для установки пакета:​ 
 +<​code>​sudo apt-get ​install ​postgresql-doc-8.4</​code>​ 
 +Чтобы увидеть руководство,​ введите **%%file:///​usr/​share/​doc/​postgresql-doc-8.4/​html/​index.html%%** в адресную строку вашего браузера.
  
-    sudo apt-get install postgresql-doc-8.4+ 2. Для общей информации по SQL смотрите [[http://​www.informit.com/​store/​product.aspx?​isbn=0768664128|Using SQL Special Edition]] от Rafe Colburn.
  
-    To view the guide enter file:///​usr/​share/​doc/​postgresql-doc-8.4/html/index.html into the address bar of your browser. + 3. Также смотрите страницу [[https://help.ubuntu.com/community/PostgreSQL|PostgreSQL Ubuntu Wiki]] для дополнительной информации.
- +
-    For general SQL information see Using SQL Special Edition by Rafe Colburn. +
- +
-    Also, see the PostgreSQL Ubuntu Wiki page for more information.+
  
 + 4. [[https://​www.howtoforge.com/​tutorial/​postgresql-on-ubuntu-15-04/​|How to Install Postgresql and phpPgAdmin on Ubuntu 15.04]]
  
 ---- ----
Строка 71: Строка 57:
 [[wiki:​руководство_по_ubuntu_server:​базы_данных:​mysql|<​-назад]] |  [[wiki:​руководство_по_ubuntu_server:​базы_данных:​mysql|<​-назад]] | 
 [[wiki:​руководство_по_ubuntu_server:​приложения_lamp|далее->​]]</​style>​ [[wiki:​руководство_по_ubuntu_server:​приложения_lamp|далее->​]]</​style>​
-