Installing and Deploying Odoo 16 on DigitalOcean

DigitalOcean is a cloud infrastructure provider that allows businesses to expand by deploying applications across numerous cloud servers, ensuring simultaneous operation without sacrificing performance.

Deploying an Odoo 16 server swiftly on DigitalOcean using the 100€ free credits and then terminating the droplet when finished is an excellent method to test it out.

Step 1: Sign up for a DigitalOcean account

Create a new account on Digital Ocean using Google, Github, or Email (https://cloud.digitalocean.com/registrations/new). Enter payment details.

Step 2: Deploy Droplets

Once registration is finalized, click on ‘Let's make something’. You will be redirected to create Droplets. To access the Droplet Creation page, go to the "Create" option in the upper right corner and choose "Droplets."

If you do not have any Droplets, clicking the prominent, blue "Get Started with a Droplet" button on the Resources tab will lead you to the Droplet Creation page.

In the Droplet creation page, you can configure your Droplet's operating system, RAM capacity, and select additional features such as monitoring and backups.

Step 3: Select Image

Users need to choose an operating system image to run their server when creating a Droplet. DigitalOcean offers five different Linux operating system distributions. Opt for Ubuntu 20.04 (LTS) x64, as this guide demonstrates how to configure an Ubuntu 20.04 system.


Step 4: Select a Plan

In the "Select a plan" section, you have the option to choose the RAM, storage capacity, and CPU core count for your Droplet.

Step 5: Select a Data Center Region

In the "Select a data center region" section, choose the data center location where you wish to deploy your Droplet.

Step 6: Configuring SSH Authentication

Choose the option to authenticate via SSH keys, which is a more secure method compared to using a password. Then, opt for "New SSH Key" from the menu.

A pop-up window will appear, prompting you to copy and paste your public SSH key.

Then, provide a name for your key for future reference. Once completed, click on "Add new SSH key." Afterwards, you'll return to the cloud panel, where you can verify that your new key has been selected.

Once you have selected your new key, you can proceed to the next step.

Step 7: Completing and deploying Droplets

Name your Droplet. You can either create your own name or use the one generated automatically.

For better organization of your Droplets, utilize tags. However, you may leave this option empty if you prefer.

Facilitate organization by assigning your Droplet to a project. A default folder will be created and selected. You can create additional folders later if desired.

Opt for backups. This option enables system-level backups of your Droplet to help prevent data loss.

After making all your selections, click on "Create Droplet." Subsequently, a page displaying the Droplet creation process will appear. The Droplet's IP address will be provided once it is ready.

Execute the following command in your terminal after copying the IP address to establish a secure SSH root user connection with your Droplet.

ssh root@your_IP_address

Ubuntu 20.4 Packages

1. Update and Upgrade Packages


apt update
apt upgrade -y

2. We'll install several commonly used Linux tools and dependencies to prepare for the upcoming Python installation.

apt install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git libpq-dev libsasl2-dev libldap2-dev ccze node-less bash-completion

3. Installing PostgreSQL version 13

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee  /etc/apt/sources.list.d/pgdg.list

apt update
apt install -y postgresql-13 postgresql-client-13

su - postgres
createuser --interactive -P odoo

Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

createdb -O odoo codingdodo_demo
exit

4.wkhtmltopdf

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.debapt install ./wkhtmltox_0.12.6-1.bionic_amd64.deb -y


5. Create an Odoo user

useradd -m -U -r -s /bin/bash odoo

6. Log in as an Odoo user

su - odoo

7. Creating a virtual environment

pyenv virtualenv 3.9.2 odoo-16-env

8. Install Odoo from the GitHub source.

mkdir /home/odoo/odoo-16-custom-addons
cd /home/odoo/odoo-16-custom-addons

git clone https://github.com/Coding-Dodo/web_widget_markdown.git
cd ~/
git clone -b 16.0 --single-branch --depth 1 https://github.com/odoo/odoo.git odoo-15

cd odoo-15

9. Install Python Dependencies

pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements.txt -e .

10. Create a directory for logs

exit
mkdir /var/log/odoo
touch /var/log/odoo/odoo-15.log
chown odoo: /var/log/odoo
chown -R odoo: /var/log/odoo/*

11. Create an Odoo 16 configuration file

$ sudo nano /etc/odoo16.conf

12. Create a systemd unit file

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

13. Run the Odoo 16 server

$ sudo systemctl daemon-reload
$ sudo systemctl start odoo16

14. Install Nginx web server

15. Install Nginx

$ sudo systemctl restart ngin

You're all set to access the Odoo 16 server on DigitalOcean. Once logged in, proceed to start and configure your Odoo instance.

Utilizing JS Class in Form Views within Odoo 17