注:本文内容参考官方文档,使用操作系统为 Ubuntu
基础准备
1 2 3 4 5 6 7 8 9 10 11 |
# 升级系统 sudo apt-get update sudo apt-get dist-upgrade # 安装 PostgreSQL sudo apt-get install postgresql -y # 进入数据库 sudo -u postgres psql # 为当前用户添加创建数据库权限 sudo su - postgres createuser --createdb --username postgres --pwprompt alan |
几种快速安装方式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 文档推荐版本wkhtmltopdf 0.12.1 # https://github.com/wkhtmltopdf/wkhtmltopdf/releases/tag/0.12.1 sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb # 安装缺失的包 sudo apt-get install -f sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb ### Odoo 仓库安装 ### # 使用 root 权限 sudo su - sudo wget -O - https://nightly.odoo.com/odoo.key | apt-key add - echo "deb http://nightly.odoo.com/11.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list apt-get update && apt-get install odoo # 启动服务 systemctl start odoo ### <a href="https://nightly.odoo.com/11.0/nightly/deb/" target="_blank" rel="noopener" data-mce-href="https://nightly.odoo.com/11.0/nightly/deb/">Odoo deb 包</a>安装 ### sudo wget https://nightly.odoo.com/11.0/nightly/deb/odoo_11.0.latest_all.deb # 方法一 sudo apt-get install gdebi-core sudo gdebi odoo_11.0.latest_all.deb # 方法二 dpkg -i odoo_11.0.latest_all.deb sudo apt-get install -f dpkg -i odoo_11.0.latest_all.deb # 启动服务 systemctl start odoo |
源码安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# 安装PostgreSQL sudo apt-get install postgresql -y # NodeJS sudo apt-get install -y nodejs npm sudo npm install -g less # Virtualenvwrapper配置虚拟环境 sudo apt install virtualenvwrapper source /usr/share/virtualenvwrapper/virtualenvwrapper.sh sudo apt install build-essential python3-dev libxslt-dev libzip-dev libldap2-dev libsasl2-dev mkvirtualenv -p /usr/bin/python3 odoo-venv # 退出环境 deactivate # 重新进入环境 workon odoo-venv ## 源码下载(官方仓库) ## # https://nightly.odoo.com/11.0/nightly/src/ wget https://nightly.odoo.com/11.0/nightly/src/odoo_11.0.latest.tar.gz tar -zxf odoo_11.0.latest.tar.g mv odoo-11.0.post20180714/ odoo11 cd odoo11 # 安装依赖 pip install -r requirements.txt # 初始化安装 python setup.py install ## Git 下载源代码 ## git clone https://www.github.com/odoo/odoo --depth 1 --branch 11.0 --single-branch odoo11 |
备注(Odoo 依赖整理)
1 2 3 4 5 6 7 8 |
sudo apt-get install python-cups python-dateutil python-decorator python-docutils python-feedparser \ python-gdata python-geoip python-gevent python-imaging python-jinja2 python-ldap \ python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib \ python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing \ python-pypdf python-reportlab python-requests python-simplejson python-tz python-unicodecsv \ python-unittest2 python-vatnumber python-vobject \ python-werkzeug python-xlwt python-yaml wkhtmltopdf \ python-pip python-dev libevent-dev gcc libxml2-dev libxslt-dev node-less geoip-database-contrib |
补充安装方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 更新 apt 源 apt-get update # 安装Python编译依赖 sudo apt-get install build-essential python-dev python-setuptools build-essential -y # 安装 pip sudo easy_install pip # 安装lxml、ldap、pillow 依赖 sudo apt-get install -y zlib1g-dev libxslt1-dev libxml2-dev libsasl2-dev libldap2-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev # 使用virtualenv创建虚拟环境 sudo pip install virtualenv mkdir odoo11 cd odoo11 virtualenv odoo-venv # 安装 PostgrSQL 数据库 sudo apt-get install postgresql -y # 创建用户 sudo -u postgres psql create user "odoo11" with password 'odoo11' createdb; # \q 退出 # 安装 NodeJS sudo apt-get install -y nodejs npm # 安装 Less sudo npm install -g less less-plugin-clean-css # 下载 Odoo11 git clone https://www.github.com/odoo/odoo --depth 1 --branch 11.0 --single-branch # 启动虚拟环境 source odoo-venv/bin/activate # 安装 Odoo Python 依赖,可使用豆瓣源加速 pip install -r requirements.txt -i https://pypi.douban.com/simple # odoo配置文件 cp debian/odoo.conf ./ vi odoo.conf [options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = 127.0.0.1 db_port = False db_user = odoo11 db_password = odoo11 ;addons_path = /usr/lib/python3/dist-packages/odoo/addons 启动服务 ./odoo-bin -c odoo.conf |
注:
在安装 psutil 的过程中由于系统存在多个 Python 版本会出现报错psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
此时应安装Python指定版本的 dev,如:
1 |
sudo apt-get install libpython3.5-dev |
sudo apt install -y nodejs-legacy
遇到服务后台启动占用端口可予以停用
sudo lsof -t -i tcp:8069 | xargs kill -9