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
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
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:
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
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
Post a Comment