Sarin T CJan. 18, 2024
In this blog post, you will learn how to install Odoo 17 on Ubuntu 20.04
There are some must followed steps involved in the installation and there are also some files that are necessary to install as a prerequisites.
Prerequisites
Access to the command line/terminal with sudo permissions.
Access to a browser.
Git installed.
Pip for Python 3 installed.
After meet all the prerequisites, follow the steps below to install Odoo 17 on Ubuntu in a Python virtual environment.
Installing Odoo in a virtual environment creates an isolated system and allows testing of different versions on the same machine.
Here are the steps to follow one by one to install Odoo 17.
STEP 1:Open the terminal and update the apt repository.
Update your server and then also upgrade it using below commands.
sudo apt-get update
sudo apt-get upgrade
Odoo requires Python 3.10 or later to run.
Step 2 : Install python 3.10 0n Ubuntu 20.04
sudo apt update && sudo apt upgrade
Import Python PPA on Ubuntu
sudo add-apt-repository ppa:deadsnakes/ppa -y
Refresh APT Sources List for Python PPA on Ubuntu
sudo apt update
Install Python 3.10
sudo apt install python3.10
python3.10 --version
To install all the extra packages in Python 3.10 on Ubuntu
sudo apt install python3.10-full
STEP 3 : Create odoo user and odoo group.
sudo adduser -system -home=/opt/odoo17 -group odoo17
STEP 4 : Install and Configure PostgreSQL
Odoo needs a PostgreSQL database server to run properly. The default configuration for the Odoo package is to use the PostgreSQL server on the same host as your Odoo instance. Execute the following command in order to install the PostgreSQL server.
sudo apt-get install -y postgresql
After the installation, Use the below commands to start the postgresql database server
sudo service postgresql start
Then create a database user for odoo17
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo17
You have to give a role password for the newly created role and verify it by giving the same password again.
/q
exit
Then restart the postgresql server
sudo service postgresql restart
STEP 5 : Install python and depended python packages on the server.
sudo apt-get install -y python3-pip
Step 6 : Install various development packages.
sudo apt-get install libpq-dev -y
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev -y
sudo apt-get install libxml2-dev libxslt-dev -y
Install Python Dependencies for Odoo 17.
Switch into odoo user by
sudo su odoo17 -s /bin/bash
and then install the dependency packages.
pip3 install psycopg2-binary
pip3 install Babel decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen psycopg2 pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject Werkzeug XlsxWriter xlwt xlrd polib
STEP 7 : Install Odoo web dependencies
sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less
sudo python3 -m pip install libsass
STEP 8 : Install odoo 17 community version from GITHUB
Below command to install GIT on your system. If it is already there, then you can ignore this.
sudo apt-get install -y git
Then switch to odoo user
sudo su - odoo17 -s /bin/bash
Clone branch 17.0 of Odoo from Github:
git clone https://www.github.com/odoo/odoo --depth 1 --branch=17.0 --single-branch
change the current working directory to a directory named “odoo”.
cd odoo/
Install Python dependencies
pip3 install -r requirements.txt
And exit from the odoo user
STEP 9 : Create an odoo configuration file
sudo vim /etc/odoo17-server.conf
Copy the below content in configuration file.
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = False db_port = False db_user = odoo17 db_password = False logfile = /var/log/odoo17/odoo17-server.log addons_path = /opt/odoo17/odoo/addons,/opt/odoo17/odoo/odoo/addons
Change permission and also the user ownership of configuration file as below
sudo chown odoo17: /etc/odoo17-server.conf
sudo chmod 640 /etc/odoo17-server.conf
STEP 10 : Create odoo log file
sudo mkdir /var/log/odoo17
sudo chown odoo17:root /var/log/odoo17
STEP 11 : You can copy and paste the script to this file.
sudo vim /etc/init.d/odoo17-server
Then change ownership and permission
sudo chmod 755 /etc/init.d/odoo17-server
sudo chown root: /etc/init.d/odoo17-server
STEP 12 : Test the server running as service
To start the odoo server
sudo /etc/init.d/odoo17-server start
Stop the odoo server
sudo /etc/init.d/odoo17-server stop
View the odoo log files
tail -f /var/log/odoo17/odoo17-server.log
STEP 13 : Run Odoo locally
sudo su - odoo17 -s /bin/bash
python3 /opt/odoo17/odoo-bin
Then go to web browser to access odoo17
http://localhost:8069
or
http://0.0.0.0:8069 STEP 14 : Installing WKHTMLTOPDF
To print PDF reports need to install right version of wkhtmltopdf. (0.126-1)
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
In short, for more support about Odoo 17 installation in Ubuntu, contact our Odoo support team. If you enjoy our content here, you’ll love the stuff we share on LinkedIn.
1