Skip to content

Instantly share code, notes, and snippets.

@thephucit
Last active April 15, 2020 10:09
Show Gist options
  • Save thephucit/d47c3797691ef0b7ea044c29e9f6f01a to your computer and use it in GitHub Desktop.
Save thephucit/d47c3797691ef0b7ea044c29e9f6f01a to your computer and use it in GitHub Desktop.
Install odoo on ubuntu server
Lưu ý: Odoo chỉ kết nối với PostgreSQL, nên phải cài đặt PostgreSQL trước.
Bước 1: Cài các chương trình cần thiết theo dòng lệnh bên dưới
> sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less
# nếu python 2 thì chạy lệnh dưới
> sudo apt-get install python-dateutil python-docutils python-feedparser python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi poppler-utils python-pip python-pypdf python-passlib python-decorator gcc python-dev mc bzr python-setuptools python-markupsafe python-reportlab-accel python-zsi python-yaml python-argparse python-openssl python-egenix-mxdatetime python-usb python-serial lptools make python-pydot python-psutil python-paramiko poppler-utils python-pdftools antiword python-requests python-xlsxwriter python-suds python-psycogreen python-ofxparse python-gevent
Bước 2: Tạo user oddo theo lệnh
> sudo useradd -m -d /var/www/odoo11 -U -r -s /bin/bash odoo11
Bước 3: Tạo postgres user theo lệnh
> sudo su - postgres -c "createuser -s odoo11"
Bước 4: Cài Wkhtmltopdf
> wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb
> sudo apt install ./wkhtmltox_0.12.1.3-1~bionic_amd64.deb
Bước 5: Cài Odoo theo lệnh sau
> sudo su - odoo11
> git clone https://www.github.com/odoo/odoo --depth 1 --branch 11.0 /var/www/odoo11/odoo
> cd /var/www/odoo11/
> python3 -m venv odoo-venv
> source odoo-venv/bin/activate
> pip3 install wheel
> pip3 install -r odoo/requirements.txt
# nếu sử dụng python2 thì install theo lệnh
# >> python -m pip install -r odoo/requirements.txt --ignore-installed --disable-pip-version-check
> deactivate
> mkdir /var/www/odoo11/odoo-custom-addons
> exit
> sudo cp /var/www/odoo11/odoo/debian/odoo.conf /etc/odoo11.conf
> sudo nano /etc/odoo11.conf
# thêm nội dung bên dưới
[options]
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo12
db_password = False
addons_path = /var/www/odoo11/odoo/addons,/var/www/odoo11/odoo-custom-addons
> sudo nano /etc/systemd/system/odoo11.service
# thêm nội dung bên dưới
[Unit]
Description=Odoo11
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo11
PermissionsStartOnly=true
User=odoo11
Group=odoo11
ExecStart=/var/www/odoo11/odoo-venv/bin/python3 /var/www/odoo11/odoo/odoo-bin -c /etc/odoo11.conf
# nếu python 2 thì thay thế bằng dòng
# ExecStart=/usr/bin/python /var/www/odoo11/odoo/odoo-bin -c /etc/odoo11.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
> sudo systemctl daemon-reload
> sudo systemctl start odoo11
> sudo systemctl status odoo11
> sudo systemctl enable odoo11
Bước 6: Truy cập http://<your_domain_or_IP_address>:8069 để xem kết quả
Link tham khảo: https://linuxize.com/post/how-to-deploy-odoo-12-on-ubuntu-18-04/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment