Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]

数据库 (69) 2023-07-04 12:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂],希望能够帮助你!!!。

1 准备工作
① 安装Centos8虚拟机;
② 下载Odoo最新版安装包(下载地址:https://www.odoo.com/zh_CN/page/download);

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第1张

填写部分信息,选择需要下载的资源

③ 当前最新安装包名称为:odoo_15.0.latest.tar.gz,直接下载即可

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第2张

点击下载资源文件

2 更新安装环境
① 使用“yum update”命令更新;首次更新时间较长,需耐心等待;
② 查看python环境,使用命令“python3”;Odoo只能运行在3.7以上环境,必须确保python版本在3.7以上;
③ 如果当前环境中没有python,需要使用命令“yum -y install python”,会有提示选择版本,建议选择当前最新版python3;同理,请将python2一起安装。例如:“yum -y install python3.9”;如图

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第3张

安装对应的python版本

④ 验证python3环境,使用命令:“python3”;安装成功;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第4张

查看python环境

3 上传资源文件
① 将Odoo资源文件传到虚拟机的“/home/”文件夹中,直接解压即可,使用命令“tar -zxvf odoo_15.0.latest.tar.gz”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第5张

解压资源文件

② 等待文件解压后,修改文件夹名称,使用命令“mv odoo-15.0.post20211216 odoo15”;

4 查看资源文件内容

① 使用命令“cd odoo15/”;查看文件夹所有文件;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第6张

进入资源文件中

② 使用命令“cd odoo”;查看odoo文件夹中的文件;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第7张

查看文件

③ 使用命令“cd conf/;打开conf文件夹”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第8张

查看文件

④ 在conf文件夹下新建openserver.conf配置文件,使用命令“touch openserver.conf”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第9张

新建配置文件

⑤ 重新进入odoo15文件夹,使用命令“cd odoo15/”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第10张

进入文件夹

⑥ 将setup下的odoo启动文件,新建odoo-bin文件并将setup/odoo数据拷贝到改文件中,使用命令“cp setup/odoo odoo-bin”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第11张

⑦ 给odoo-bin文件夹赋权限;使用命令“chmod +x odoo-bin”

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第12张

给文件赋权限

5 安装虚拟环境

① 返回到最外层目录“/home/”;

② 使用命令“pip3 install virtualenv”,安装虚拟环境;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第13张

安装虚拟环境文件

③ 给环境取别名venv,使用命令“virtualenv venv”;当“/home/”目录下存在venv表示成功

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第14张

安装虚拟环境成功

6 在虚拟环境中运行

① 使用命令“source ./venv/bin/activate”;进入虚拟运行环境;可以使用“deactivate”命令关闭;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第15张

进入虚拟环境

② 查看配置文件,使用命令“vim requirements.txt”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第16张

查看配置文件

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第17张

配置文件具体内容

③ 自动安装配置文件中的环境,使用命令“pip3 install -r requirements.txt”;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第18张

安装使用环境

④ 由于网络问题,会经常提示失败;

a) 解决方案: “pip3 install –upgrade pip”,使用该命令先对pip进行升级;

b) 待显示升级成功后(一直到显示成功),再执行“pip3 install -r requirements.txt”;

c) 国内环境镜像地址:(地址前加上-i)
清华:https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:http://pypi.hustunique.com/

山东理工大学:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

⑤ 解决的问题:

a) 解决python-ldap安装失败显示error: command '/usr/bin/gcc' failed with exit code 1和In file included from Modules/LDAPObject.c:3:Modules/common.h:9:10: 致命错误:Python.h:没有那个文件或目录,两个报错;
解决方法:执行“pip install python-ldap”命令,如果执行命令出现报错,执行“yum install openldap-devel”;或执行“yum install openldap(python环境版本,例如3.9就写39)-devel”

7 修改配置文件openserver.conf;用来连接postgressql数据库;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第19张

准备修改配置文件

8 修改后的配置文件;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第20张

修改后的配置文件,保存退出

9 将配置文件连接到上两级目录下;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第21张

串联配置文件

10 使用命令“./odoo-bin -c openserver.conf -i base”启动;

① 出现数据库需要初始化的提示“2021-12-25 13:24:08,212 3484 INFO ? odoo.service.server: HTTP service (werkzeug) running on 192.168.43.150 :8069

2021-12-25 13:24:08,260 3484 ERROR ? odoo.modules.loading: Database odoo15_test not initialized, you can f orce it with `-i base`”;

解决方案:启动时,在odoo15目录下执行命令“/odoo-bin -c openserver.conf -i base”;

② 出现“2021-12-25 13:34:18,796 3484 WARNING odoo15_test odoo.addons.base.models.ir_cron: Tried to poll an undefined table on database odoo15_test.

2021-12-25 13:35:08,694 3484 ERROR odoo15_test odoo.sql_db: bad query:

SELECT latest_version

FROM ir_module_module

WHERE name='base'

ERROR: 错误: 关系 "ir_module_module" 不存在

第3行 FROM ir_module_module”;

解决方案:启动时,在odoo15目录下执行命令“/odoo-bin -c openserver.conf -i base”;

强烈建议环境配置操作使用外部网络,内网环境或公司管控环境下,资源有限,不易成功,很浪费时间!!!

11 启动后的登录操作

① 启动成功的日志

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第22张

启动日志

② 登录页面

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第23张

登录页面

Email:admin;Password:admin;

Centos8安装Odoo15及连接Postgressql数据库并启动程序[通俗易懂]_https://bianchenghao6.com/blog_数据库_第24张

登录成功

发表回复