Setup Odoo 11 As A Service On Ubuntu 16.04
December 20, 2018
Find the easiest installation guide of odoo 11 on your Ubuntu 16.04 and explore amazing new features of odoo 11.
Step 1: Update apt source list
sudo apt-get update
Fire following commands if you are getting error like:
“Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?”
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
Do not run first command again
Step 2: Install Python Dependencies for Odoo 11
sudo apt install python3-pip postgresql postgresql-server-dev-9.5 python-all-dev python-dev python-setuptools libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl8.6-dev tk8.6-dev python-tk libyaml-dev fontconfig
Step 3: Install PostgreSQL 9.5+ Follow below steps with postgres user
sudo su - postgres
createuser odoo -U postgres -dRSP
Press CTRL+D to exit the postgres user session.
Step 4: Configure odoo 11Configure odoo 11 (by odoo user)
sudo mkdir /opt/odoo
sudo adduser --system --home=/opt/odoo --group odoo
sudo chown -R odoo: /opt/odoo/
Download odoo 11 zip file from nightly build repository from URL : https://nightly.odoo.com/11.0/nightly/src/
Extract file and transfer it to /opt/odoo directory:
Go to directory where odoo 11 is downloaded.
sudo unzip <file-name>
sudo cp -r <directory-name> /opt/odoo/
The file odoo-bin is NOT in the directory.
You can download it from https://nightly.odoo.com/10.0/nightly/src/ and put it on /opt/odoo/<odoo-11-directory>
sudo pip3 install -r /opt/odoo/<odoo-directory-name>/requirements.txt
Step 5: Install Odoo Web Dependencies (by sudo user)
sudo apt-get install -y npm
If you get warning like “E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution)”. Run the following command
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install npm (ignore this command if already exist)
sudo npm install -g less less-plugin-clean-css
sudo apt-get install node-less
Step 6: Install Stable Wkhtmltopdf Version (by sudo user)
cd /tmp
sudo wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
Step 7: Create Odoo Server Configuration and Log File (by odoo user)
sudo mkdir /var/log/odoo
cd /etc
sudo nano odoo-server.conf
Copy and paste below content in the config file, write correct addons paths, DB user and DB password. Now save the file.
[options] admin_passwd = <strong password>
db_host = localhost
db_port = 5432
db_user = odoo
db_password = ***********
addons_path = /opt/odoo/odoo-11-directory/odoo/addons,/opt/odoo/custom-addons
logfile = /var/log/odoo/odoo-server.log
xmlrpc_port = 8069
dbfilter = *
xmlrpc_interface = 127.0.0.1
proxy_mode = True
Step 8: Create an Odoo Service (by sudo user)
cd /lib/systemd/system
sudo nano odoo-server.service
Copy and paste below content in the file and save it.
[Unit] Description=Odoo Open Source ERP and CRM Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple PermissionsStartOnly=true SyslogIdentifier=odoo-server User=odoo Group=odoo ExecStart=/opt/odoo/odoo-11.0.post20180710/odoo-bin --config=/etc/odoo-server.conf --addons-path=/opt/odoo/odoo-11.0.post20180710/odoo/addons WorkingDirectory=/opt/odoo/ StandardOutput=journal+console [Install] WantedBy=multi-user.target
Step 9: Change File Ownership and Permissions (by sudo user):
sudo chmod 755 /lib/systemd/system/odoo-server.service
sudo chown root: /lib/systemd/system/odoo-server.service
sudo chown odoo:root /var/log/odoo
sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
Step 10: Now Start Odoo Server and Enable the Service (by sudo user)
sudo systemctl enable odoo-server
sudo systemctl start odoo-server
Using ‘status’, you can find information about all running odoo servers.
sudo systemctl status odoo-server
Step 11: Steps to configure Apache2 with odoo (by sudo user)
sudo apt-get install apache2
sudo ufw app list
sudo ufw allow 'Apache Full'
sudo ufw status
sudo systemctl status apache2
cd /etc/apache2/sites-available
sudo nano test-odoo.conf
<VirtualHost *:80>
ServerName odoo.test.com
ServerAlias odoo.test.com
LogLevel warn
ErrorLog /var/log/apache2/odoo.test.com.error.log
CustomLog /var/log/apache2/odoo.test.com.access.log combined
ProxyPass / http://localhost:8069/
ProxyPassReverse / http://localhost:8069/ </VirtualHost>
sudo a2ensite test-odoo.conf
sudo a2enmod proxy
sudo a2enmod proxy_balancer
sudo a2enmod proxy_http
sudo service apache2 reload
Do host file entry /etc/hosts. Now your odoo 11 is ready for use.