centos 安装odoo14
centos 7
安装python3 (需要哪个版本自行更改版本号即可)
sudo yum update -y
sudo yum install gcc gcc-c++ openssl-devel bzip2-devel libffi-devel libxml2-devel libxslt-devel libjpeg-turbo-devel openldap-devel -y
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar xzf Python-3.6.5.tgz
cd Python-3.6.5
./configure --enable-optimizations
sudo make altinstall
python3 -V
配置虚拟环境
mkdir ~/odoo-dev
cd ~/odoo-dev
python3.8 -m venv env
source env/bin/activate
安装数据库Postgre
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum -y install epel-release yum-utils
sudo yum-config-manager --enable pgdg12
sudo yum -y install postgresql12-server postgresql12 postgresql-devel
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo passwd postgres # 为超级用户设置密码
配置远程链接(vim修改文件)
vim /var/lib/pgsql/12/data/postgresql.conf
listen_addresses = ‘192.168.10.10’ # 设置为*表示所有
# sudo vi /var/lib/pgsql/12/data/pg_hba.conf
# Accept from anywhere
host all all 0.0.0.0/0 md5
# Accept from trusted subnet
host all all 192.168.18.0/24 md5
# 设置完成后重启服务
systemctl restart postgresql-12.service
安装odoo
cd ~/odoo-dev/
wget http://nightly.odoo.com/master/nightly/src/odoo_14.1alpha1.latest.tar.gz(如果有文件就上传到这个文件夹下)
tar xzf odoo_14.1alpha1.latest.tar.gz
mv odoo-14.1a1.* odoo14
pip install -r odoo14/requirements.txt
sudo -u postgres createuser --createdb $(whoami)
cd odoo14
cp setup/odoo odoo-bin
chmod +x odoo-bin
./odoo-bin -d odoo-test -i base
centos8
sudo dnf update -y # 升级系统安装包
# 安装所需依赖
sudo dnf install python3 python3-devel git gcc redhat-rpm-config libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel curl unzip -y
# 安装wkhtmltopdf
sudo dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
# 验证安装版本
wkhtmltopdf --version
# 安装 PostgreSQL
sudo dnf install postgresql postgresql-server postgresql-contrib -y
# 初始化数据库
sudo postgresql-setup initdb
# 启动服务
sudo systemctl start postgresql
sudo systemctl enable postgresql
# 创建数据库用户(需与下面的系统用户名称保持一致)
sudo su - postgres -c “createuser -s odoo14”
# 创建系统用户
sudo useradd -m -U -r -d /opt/odoo14 -s /bin/bash odoo14
# 创建目录
sudo mkdir /opt/odoo
sudo chown odoo14: /opt/odoo
# 切换用户、克隆代码(有代码的话直接上传到目录,跳过此处)
sudo su - odoo14
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo/odoo14
# 创建自定义 addon 文件夹
mkdir /opt/odoo/odoo14-custom-addons
# 创建虚拟环境
cd /opt/odoo14 && python3 -m venv odoo14-venv
# 激活虚拟环境
source odoo14-venv/bin/activate
# 在虚拟环境中安装 Python依赖包
pip install wheel
pip install -r /opt/odoo/odoo14/requirements.txt
# 退出当前用户
deactivate && exit
# 创建日志文件并授权
sudo mkdir /var/log/odoo14 && sudo touch /var/log/odoo14/odoo14.log
sudo chown -R odoo14: /var/log/odoo14/
# 编辑配置文件(请修改master_password,vim命令操作)
# sudo vi /etc/odoo14.conf
[options]
; This is the password that allows database operations:
admin_passwd = master_password
db_host = False
db_port = False
db_user = odoo14
db_password = False
xmlrpc_port = 8069
; longpolling_port = 8072
logfile = /var/log/odoo14/odoo14.log
logrotate = True
addons_path = /opt/odoo/odoo14/addons,/opt/odoo/odoo14-custom-addons
proxy_mode = True # 配合 Nginx 使用
# 创建systemd启动文件 (vim操作)
# sudo vi /etc/systemd/system/odoo14.service
[Unit]
Description=Odoo14
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo14
PermissionsStartOnly=true
User=odoo14
Group=odoo14
ExecStart=/opt/odoo14/odoo14-venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo14.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
# 载入配置文件并启动服务
sudo systemctl daemon-reload
sudo systemctl start odoo14
sudo systemctl enable odoo14
# 查看启动状态
sudo systemctl status odoo14
配置nginx(暂时不用)