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
Update Ubuntu Linux Before Installing Python 3.10
sudo apt update && sudo apt upgrade
Import Python PPA on Ubuntu
sudo add-apt-repository ppa:deadsnakes/ppa -y
Update the APT repository sources list for the Python PPA on Ubuntu.
sudo apt update
Please install Python version 3.10.
sudo apt install python3.10
- sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
Confirming the installation of Python 3.10 on Ubuntu.
python3.10 --version
To install additional packages for Python 3.10 on Ubuntu.
sudo apt install python3.10-full
Step 3: Establish an 'odoo' user and group.
sudo adduser -system -home=/opt/odoo17 -group odoo17
Step 4: Set up and configure PostgreSQL.
To ensure proper functionality, Odoo requires a PostgreSQL database server. By default, the Odoo package is configured to utilize the PostgreSQL server located on the same host as your Odoo instance. Execute the provided command to install the PostgreSQL server.
sudo apt-get install -y postgresql
Following the installation, utilize the commands below to initiate the PostgreSQL database server.
sudo service postgresql start
Next, create a user for the Odoo 17 database.
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo17
You need to assign a password to the newly created role and confirm it by re-entering the same password.
/q
exit
Afterward, proceed to restart the PostgreSQL server.
sudo service postgresql restart
Step 5: Install Python and its required packages on the server.
sudo apt-get install -y python3-pip
Step 6: Install a variety of 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 the Python dependencies required for Odoo 17.
Switch to the 'odoo' user by
sudo su odoo17 -s /bin/bash
Then proceed to install the necessary 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 dependencies for Odoo web.
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 the community version of Odoo 17 from GitHub.
The following command installs Git on your system. If Git is already installed, you can disregard this step.
sudo apt-get install -y git
Next, change to the 'odoo' user.
sudo su - odoo17 -s /bin/bash
Clone the 17.0 branch of Odoo from GitHub.
git clone https://www.github.com/odoo/odoo --depth 1 --branch=17.0 --single-branch
Navigate to a directory named "odoo".
cd odoo/
Install the required Python dependencies.
pip3 install -r requirements.txt
Exit from the 'odoo' user session.
Step 9: Generate an Odoo configuration file.
sudo vim /etc/odoo17-server.conf
Paste the following content into the 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: Establish an Odoo log file.
sudo mkdir /var/log/odoo17
sudo chown odoo17:root /var/log/odoo17
Step 11: You may copy and paste the provided script into this file.
sudo vim /etc/init.d/odoo17-server
Subsequently, modify ownership and permissions.
sudo chmod 755 /etc/init.d/odoo17-server
sudo chown root: /etc/init.d/odoo17-server
Step 12: Verify the server by running it as a service.
To initiate the Odoo server.
sudo /etc/init.d/odoo17-server start
Halt the Odoo server.
sudo /etc/init.d/odoo17-server stop
Check the Odoo log files.
tail -f /var/log/odoo17/odoo17-server.log
Step 13: Launch Odoo locally.
sudo su - odoo17 -s /bin/bash
python3 /opt/odoo17/odoo-bin
Next, open a web browser to access Odoo 17.
http://localhost:8069
or
http://0.0.0.0:8069 Step 14: Installation of WKHTMLTOPDF
To generate PDF reports, you need to install the correct 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/wkhtmltopdf /usr/bin/
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin