How to install Odoo server on Ubuntu 18.04
Odoo server is a suite of open-source enterprise management applications. In this document we are trying to install Odoo server on Ubuntu 18.04 VPS. There are following steps to install Odoo server. First login with root user.
1.
1. Update and upgrade the system
#apt-get -y update
#apt-get -y upgrade
2. Create a Odoo user which will control the application and run the application
#adduser --system --home=/opt/odoo --group odoo
3. We are going to use PostfreSQL so we need to install and configure PostgreSQL database.
#apt-get install -y postgresql
Once the installation is complete, we need to add PostgreSQL user for Odoo server
#service postgresql start
#su - postgres
#createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
Enter password for new user and verify again.
#exit
4. Install pip3 services
#apt-get install -y python3-pip
Install python dependencies and necessary applications
#pip3 install Babel decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject Werkzeug==0.11.15 XlsxWriter xlwt xlrd libsass passlib
#apt-get install -y npm
#ln -s /usr/bin/nodejs /usr/bin/node
#npm install -g less less-plugin-clean-css
#apt-get install -y node-less
#python3 -m pip install libsass
#apt-get install python3-psycopg2
5. Install Odoo version which is available on GitHub
#apt-get install -y git
Switch to Odoo user and proceed further
#su - odoo -s /bin/bash
#git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 --single-branch **(note 1)
#exit
6. Create Odoo log file
#mkdir /var/log/odoo
#chown odoo:root /var/log/odoo
7. To run the Odoo on local system, follow below steps
#su - odoo -s /bin/bash
#/opt/odoo/odoo/odoo-bin -s or #/opt/odoo/odoo/odoo-bin --save
The --save or -s option we have used will create hidden odoo configuration file in home directory of odoo user. The name of the file is .odoorc.
If this fails to start, it may show some python packages missing. Exit from odoo user and install the package displayed in the error with following command
#pip3 install <package name>
8. To run Odoo, open port 8069 on firewall/hardware appliance. We can check the same by searching http://Your_IP_Here:8069 in the browser.
Apache Configuration:- Website request lands by default on port 80 and Odoo server uses port 8069. Hence to establish a connection between Apache and Odoo, we use reverse proxy (some times referred as front-end proxy). To do so, we need to enable proxy modules of Apache. To enable modules, use below commands.
# a2enmod proxy
# a2enmod proxy_http
# a2enmod proxy_balancer
After enabling modules, restart/reload apache service. Also, use below virtual host configuration for Odoo website.
<VirtualHost *:80>
ServerName (your_website_name)
ServerAlias www.(your_website_name)
ProxyRequests Off
ProxyPass / http://(your_website_name):8069/
ProxyPassReverse / http://(your_website_name):8069/
</VirtualHost>
**Note 1 from step 5 – Here branch 12.0 is a odoo version 12. You can change it 13 or 14 as per requirement.