我这里安装的是Ubuntu Server 20.04 ※ 在安装时,因国内访问ubuntu网站效率低下,要调整源服务器为镜像服务器以加快源下载速度 http://mirrors.aliyun.com/ubuntu/
经测,aliyun的源在安装PostgreSQL数据库时发生错误,随机更换了清华的数据源,执行未发生错误,故建议使用清华数据源 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
我这里使用的是虚拟机,网络使用桥接模式 路由器中配置MAC绑定分配固定ip给到Ubuntu服务器
Ubuntu安装完成后,确认SSH服务是否已经开启
在本地PC端安装XShell & XFtp XShell Plus破解版(含XFtp) 提取码:l8ky
使用XShell连接服务器确认python是否已经安装
>python3
安装python pip
>sudo apt-get install python3-pip
安装虚拟环境包
>sudo apt-get install python3-virtualenv
建立虚拟环境
>virtualenv venv
>source ./venv/bin/activate
如果是Debian/Unbuntu系统,则需要安装如下依赖包
>sudo apt install python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev \
libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev \
liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev libpq-dev
参考odoo文档Installing Odoo
安装依赖包出现错误
使用初始源 http://cn.archive.ubuntu.com/ubuntu/ 再次尝试后,顺利解决
使用国内python镜像安装odoo里requirments.txt的内容
清华源 https://pypi.tuna.tsinghua.edu.cn/simple
cd /CommunityPath
pip3 install setuptools wheel
pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
清华源安装以上包时一直read timeout rollback 使用ailyun的似乎可以,https://mirrors.aliyun.com/pypi/simple/
在虚拟环境中下载并安装PostgreSQL Database https://www.postgresql.org 根据提示执行下载操作,ubuntu系统使用如下方式下载安装
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql postgresql-client
修改postgresql配置文件另Odoo可以使用用户名密码访问数据库
vim /etc/postgresql/14/main/pg_hba.conf
变更peer为trust以及加密方式
重启服务
>sudo systemctl restart postgresql.service
进入postgres用户
>sudo su postgres
进入psql
>psql
\l:查询数据库 \du:查询用户
创建用户odoo15并赋予超级用户权限(根据实际情况调整权限)
create user odoo15 with password 'odoo15';
alter role odoo15 with superuser;
创建odoo15数据库
create database odoo15 owner odoo15;
下载Odoo 源码请到官网下载:https://www.odoo.com/zh_CN/page/download
解压Odoo源码包
>tar -zxvf /home/gyapollo/odoo_15.0.latest.tar.gz
复制启动文件(作为备份)
>cp ./setup/odoo odoo-bin
增加可执行权限
>chmod +x odoo-bin
增加配置文件
>touch odoo.conf
编辑vim odoo.conf
尝试启动Odoo服务
>./odoo-bin -c odoo.conf -i odoo15
-c 是指定odoo的参数文件,-i 初始化数据库odoo15
本文章使用limfx的vscode插件快速发布