postgresql
- 根据系统生成命令 https://www.postgresql.org/download/linux/redhat/
- sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
- 禁用内置psql
sudo dnf -qy module disable postgresql
- 安装psql
sudo yum install -y postgresql10-server
- 安装contrib
sudo yum install postgresql10-contrib -y
- 初始化
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
- 开机启动
sudo systemctl enable postgresql-10
sudo systemctl start postgresql-10
- 切换用户
su - postgres
psql
- 修改默认密码
alter user postgres with password 'postgres'
- 创建用户
create user xianwei with password 'password';
- 创建odoo数据库
create database odoo owner xianwei;
- 授权数据库
grant all privileges on database odoo to xianwei;
- ALTER USER xianwei WITH CREATEDB;
- 重启 systemctl restart postgresql-10
python2.x
- yum install python2
odoo10
- git clone https://gitee.com/mirrors/odoo.git --depth 1 --branch 10.0 --single-branch odoo10
- sudo yum install libxml2-devel libxslt-devel python2-devel openldap-devel libffi-devel gcc
- cd odoo10
- pip2 install -r requirements.txt
- curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
- 修改 /etc/yum.repos.d/nodesource-*.repo 文件,将其中的所有 rpm.nodesource.com 替换为 mirrors.ustc.edu.cn/nodesource/rpm
- sudo yum install -y nodejs
- npm config set registry https://registry.npm.taobao.org
- sudo npm install -g less@3.0.4 less-plugin-clean-css
- vim odoo.config
- vim /etc/systemd/system/odoo.service
#修改pip镜像 ~.pip/pip.config
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
#odoo.config
[options]
db_host = localhost
db_port = 5432
addons_path = addons
db_user = xianwei
db_password = password
dbfilter = odoo
db_name = odoo
addons_path = /usr/local/app/odoo/addons
#/etc/systemd/system/odoo.service
[Unit]
Description=Odoo
After=postgresql-10.service
[Service]
Type=simple
User=xianwei
Group=xianwei
ExecStart=/usr/bin/python2 /usr/local/app/odoo/odoo-bin -c /usr/local/app/odoo/odoo.conf
[Install]
WantedBy=multi-user.target
问题
- OptionBinding with id "failovermethod" does not exist
sudo sed -iBAK '/^failovermethod=/d' /etc/yum.repos.d/*.repo
- centos添加用户
- adduser xianwei
- chmod -v u+w /etc/sudoers
- vim /etc/sudoers
- xianwei ALL=(ALL) ALL
- chmod -v u-w /etc/sudoers
- 忘记psql密码
- 修改/var/lib/pgsql/10/data/pg_hba.conf的local为trust
- 远程访问
- 修改/var/lib/pgsql/10/data/postgresql.conf文件中的listen_addresses为*
- /var/lib/pgsql/10/data/pg_hba.conf添加
host all xianwei 0.0.0.0/0 md5