Skip to main content

Install odoo 16 in the cloud server

Install odoo 16 in the cloud server



Installing Dependencies

The first step is to install Git , Pip , Node.js , and development [tools required to build](https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ Odoo dependencies:

sudo apt update

sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev

Creating a user account using useradd command on Ubuntu

sudo useradd -s /path/to/shell -d /home/{dirname} -m -G {secondary-group} {username}

sudo passwd {username}

sudo useradd -s /bin/bash -d /home/odoo16/ -m -G sudo odoo16

sudo passwd odoo16

Where,

-s /bin/bash – Set /bin/bash as login shell of the new account

-d /home/odoo16/ – Set /home/odoo16/ as home directory of the new Ubuntu account

-m – Create the user’s home directory

-G sudo – Make sure odoo16 user can sudo i.e. give admin access to the new account

Installing ssh keys while creating the new user account

You must have RSA key pair on your local desktop/laptop. Use the cat command to view your current RSA public key on the desktop:

cat ~/.ssh/id_rsa.pub

cat ~/.ssh/id_rsa.pub

Run the following commands on your Ubuntu server to install above ~/.ssh/id_rsa.pub key from your desktop:

sudo mkdir /home/odoo16/.ssh/

sudo chmod 0700 /home/odoo16/.ssh/

sudo -- sh -c "echo 'ssh-rsa --ver-long-string-- user@LocalMachine' > /home/odoo16/.ssh/authorized_keys"

sudo chown -R odoo16:odoo16 /home/odoo16/.ssh/

Now you can log in with ssh keys:

ssh odoo16@<_Cloud_IP_Address_>

Run the following passwd command to set password:

sudo passwd {username}

sudo passwd odoo16

To change your own account password, enter:

passwd

Install Postgres database:

sudo apt install postgresql postgresql-contrib

sudo -i -u postgres

createuser --interactive [odoo16] # which has the same new server user name

createdb [odoo16] # which is the private database for the new server user

Exit the postgres user account:

exit

Installing wkhtmltopdf:

wkhtmltopdf is a set of open-source command-line tools for rendering HTML pages into PDF and various image formats. To print PDF reports in Odoo, you’ll need to install the wkhtmltox package.

The version of wkhtmltopdf that is included in Ubuntu repositories does not support headers and footers. The recommended version for Odoo is version 0.12.5. We’ll download and install the package from Github:

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

Another version for Ubuntu 22.04 jammy_amd64:
https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb

Once the file is downloaded, install it by typing:

sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb

You can also install the package and it's dependency from my GitHub account:

https://github.com/kobros-tech/packages/


If node and npm are not installed or if they have old versions:
remove them:
sudo apt remove nodejs npm
sudo apt autoremove

Setup the repository for them:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -

Install them:
sudo apt install -y nodejs
node -v
npm -v


Installing and Configuring Odoo 16

We’ll install Odoo from the source inside an isolated Python virtual environment.

First, make sure to change to user “odoo16”:

sudo su - odoo16

Clone the Odoo 16 source code from GitHub:

git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 /home/odoo16/odoo

Create a new Python virtual environment for Odoo:

cd /home/odoo16

python3 -m venv odoo-venv

Activate the virtual environment:

source odoo-venv/bin/activate

Odoo dependencies are specified in the requirements.txt file. Install all required Python modules with pip3:

pip3 install wheel

pip3 install -r odoo/requirements.txt

Once done, deactivate the environment by typing:

deactivate

We’ll create a new directory a separate directory for the 3rd party addons:

mkdir /home/odoo16/custom

Switch back to your sudo user:

exit

Create a configuration file with the following content:

sudo nano /etc/odoo16.conf

[options]
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo16
db_password = False
addons_path = /home/odoo16/odoo/addons,/home/odoo16/custom

Do not forget to change the my_admin_passwd to something more secure.

Creating Systemd Unit File

A unit file is a configuration ini-style file that holds information about a service.

Open your text editor and create a file named odoo15.service with the following content:

sudo nano /etc/systemd/system/odoo16.service

[Unit]
Description=Odoo16
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo16
PermissionsStartOnly=true
User=odoo16
Group=odoo16
ExecStart=/home/odoo16/odoo-venv/bin/python3 /home/odoo16/odoo/odoo-bin -c /etc/odoo16.conf
StandardOutput=journal+console
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Notify systemd that a new unit file exists:

sudo systemctl daemon-reload

Start the Odoo service and enable it to start on boot by running:

sudo systemctl enable --now odoo16

Verify that the service is up and running:

sudo systemctl status odoo16

You can check the messages logged by the Odoo service using the command below:

sudo journalctl -u odoo16

Testing the Installation

Open your browser and type: http://<your_domain_or_IP_address>:8069


Comments

Popular posts from this blog

Highlights on my contributions to Odoo Community Association

 Highlights on my contributions to Odoo Community Association For me as a developer working on odoo community and providing services to the customers using the community version of Odoo. Sometimes the solution is available in a module published by OCA that could be an older version of Odoo. As a result, I decided to put my upgraded modules on their repositories as a contributor, and I asked to join them on the mailing list. For them, before I start to make a pull request, I need to sign their ICLA document. ICLA means Odoo Community Association Individual Contributor License Agreement. To upgrade a module to version 17.0 I had to follow the instructions stated on: https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-17.0 Firstly this section: https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-17.0#before-migrating Which needs you to: (1)      Subscribe to OCA mailing list (2)     Sign ICLA as stated above (3)     Install precommit  as instructed here: https:

Use CS50 library in my local machine offline to run codes in C language

M ake your PC ready to run codes in C language How to use CS50 library in your local machine offline Here are three videos presented by someone, they will guide you to make your PC ready to run C files. How to Download and Install Visual Studio Code ( VS Code ) on Windows 10 How to Download and Install C Cpp Toolset ( gcc g++ gdb ) in Windows 10 using mingw-w64 and msys2 How to Set up Visual Studio Code for C and C++ Programming After watching the above videos and following the steps in them, you can apply the following steps in order to use CS50 library for implementing codes written in C language in your local machine offline. Download the zip file from Github Release,  https://github.com/cs50/libcs50/releases Unzip it, locate to libcs50/src/, you can get cs50.h and cs50.c Copy cs50.h and cs50.c in the Workspace Create and save a C file which uses cs50 libraries in the Workspace. We can call it hello.c, hello.c should be with cs50.h and cs50.c in the same folder in

Latest odoo module for logo printing business

 Latest odoo module for logo printing business  Elements: Product Attribute Model I can delete not critical attributes Can not delete critical attributes I can restore deleted [important] attributes Critical attributes have some critical values I can not delete critical values for critical attributes