ODOO 安裝 - postgressql create user

在postgresql9.6中創建用戶

 

運行psql, 用create role  帶login參數才能登錄。

先在 pg_hba.conf中的缺省設置下,即有下列設置項(local   all             postgres                                peer)下,通過root用戶,進入到postgres 用戶下,運行 psql進入postgresql命令行狀態,修改postgres的口令,通過以下命令:

alter roll  postgresq password "###############" ;

修改後,再註釋掉(local   all             postgres                                peer), 使用 (local  all       all            md5),就能夠在任何用戶下,運行psql -U username  -d  dbname  -W  進入postgresq 命令行下了,一定要有-d postgres 這個參數。

 

psql -U  username -d postgres -W

 

在用pip install -r requirements.txt --user  安裝odoo11時,遇到以下錯誤,加上 

--user 參數即可。

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/ldapurl.py'
Consider using the `--user` option or check the permissions.

安裝linux庫擴展:

aptitude  install -y python3.5-dev  python3-postgresql libxml2-dev   libxslt-dev    libevent-dev  libsasl2-dev   libldap2-dev  
 
 aptitude install -y npm
 npm install -g less

ubuntu 16.04    在安裝 odoo11.0 時,需做這個安裝 aptitude install -y  node-less

 

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

# TYPE DATABASE USER ADDRESS METHOD
local  all      all          peer

to

# TYPE DATABASE USER ADDRESS METHOD
local  all      all          md5
  • peer means it will trust the identity (authenticity) of UNIX user. So not asking for a password.

  • md5 means it will always ask for a password, and validate it after hashing with MD5.

  • trust means it will never ask for a password, and always trust any connection.

You can, of course, also create more specific rules for a specific database or user, with some users having peer and others requiring passwords.

After changing pg_hba.conf you'll need to restart PostgreSQL if it's running. E.g. sudo service postgresql restart

Steps to change/create default postgres user's password:

  1. trust connection by adding in pg_hba.conf file
  • local all postgres trust
  1. Restart postgresql service
  • sudo service postgresql restart
  1. psql -U postgres

  2. At the postgres=# prompt, change the user name postgres password:

  • ALTER USER postgres with password ‘new-password’;
  1. Revert the changes in pg_hba.conf file from trust to md5 and restart postgresql.

* The file pg_hba.conf will most likely be at /etc/postgresql/9.x/main/pg_hba.conf

Source

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章