logo
How to Install Odoo 17 on Amazon EC2

How to Install Odoo 17 on Amazon EC2

Odoo is an open-source, self-hosted ERP business suite with modules for accounting, CRM, sales, purchasing, Point of Sale, E-Commerce, project management, inventory, and more. This guide explains how to install Odoo on Ubuntu 22.04. Now How to Install Odoo 16 on Amazon EC2

Published Feb 10, 2024
1. Create a new Key Pair
  1. In this lab, you will need to create an EC2 instance using an SSH keypair. The following steps outline creating a unique SSH keypair for you to use in this lab.
  2. Sign into the AWS Management Console and open the Amazon EC2 console. In the upper-right corner of the AWS Management Console, confirm you are in the desired AWS region.
  3. Click on Key Pairs in the Network & Security section near the bottom of the leftmost menu. This will display a page to manage your SSH key pairs.
  4. Type Name Key Pair into the Key Pair Name: text box and click Create key pair button. For Windows users, please select ppk for file format.
  5. The page will download the file Name Key Pair.ppk to the local drive. Follow the browser instructions to save the file to the default download location. Remember the full path to the key pair file you just downloaded.
2. Launch a Web Server Instance
We will launch an Amazon Linux 2 instance, will display information about our instance. Before that select Region what you want.
  1. Click on EC2 Dashboard near the top of the leftmost menu. And Click on Launch instances.
  2. In Name, put the value Odoo. And check the default setting for Amazon Machine Image below.
  3. Select Application and OS Imane in Instance Type. Select Ubuntu 22.04
  4. Select t3.micro in Instance Type & Select the key pair that you created in the beginning of this lab from the drop-down.
  5. Click the Edit button in Network settings to set the space where EC2 will be located. Check default VPC and subnet. Auto-assign public IP is set to Enable. Right below it, create Security groups to act as a network firewall. Security groups will specify the protocols and addresses you want to allow in your firewall policy. For the security group you are currently creating, this is the rule that applies to the EC2 that will be created. After entering laucnh-wizard in Security group name and Description, select Add Security group rule and set HTTP to Type. Also allow TCP/80, allow TCP/443, Custom TCP/8069 for Web Service by specifying it.
  6. All other values accept the default values, expand by clicking on the Advanced Details tab at the bottom of the screen.
  7. Click the View Instances button in the lower right hand portion of the screen to view the list of EC2 instances. Once your instance has launched, you will see your Web Server as well as the Availability Zone the instance is in, and the publicly routable DNS name. Click the checkbox next to your web server to view details about this EC2 instance.
  8. Connect Instance with ec2 instance connect
  9. Update the system packages
1
$ sudo apt update
  1. Install Git
1
$ sudo apt install git -y
  1. Install Pip.
1
sudo apt install python3-pip -y
  1. Install other required dependencies.
1
sudo apt install -y 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
  1. Create a new odoo user.
1
$ sudo adduser odoo
  1. Download and add PostgreSQL Repositories.
1
2
3
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

$ wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
  1. Install PostgreSQL.
1
$ sudo apt install postgresql postgresql-contrib -y
  1. Start the database server.
1
$ sudo systemctl start postgresql
  1. Enable the database server to start automatically on system boot.
1
$ sudo systemctl enable postgresql
  1. Change the default PostgreSQL password.
1
$ sudo passwd postgres
  1. Switch to the postgres user.
1
$ su - postgres
  1. Create a database user named odoo.
1
$ createuser odoo
  1. Go to the PostgreSQL interactive shell.
1
$ psql
  1. Give the database user odoo permission to create databases.
1
ALTER USER odoo WITH CREATEDB;
  1. Exit the interactive shell.
1
\q
  1. Return to the non-root example_user account.
1
$ exit
  1. Wkhtmltopdf is a group of open-source command-line tools for rendering HTML pages into PDF and other image formats. It enables Odoo to print PDF reports. Download Wkhtmltopdf from GitHub.
1
$ sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
  1. Install Wkhtmltopdf.
1
$ sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb
  1. At the time of this writing, Odoo 17 is the latest version. Create a directory for Odoo and set the owner to the Odoo user.
1
2
3
$ sudo mkdir -p /opt/odoo/odoo
$ sudo chown -R odoo /opt/odoo
$ sudo chgrp -R odoo /opt/odoo
  1. Switch to the odoo user account.
1
$ sudo su - odoo
  1. Clone the Odoo 14 source code from GitHub to /opt/odoo/odoo directory.
1
$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 /opt/odoo/odoo
  1. Create a new Python virtual environment for Odoo.
1
2
$ cd /opt/odoo
$ python3 -m venv odoo-venv
  1. Activate the virtual environment.
1
$ source odoo-venv/bin/activate
  1. Install all required Python modules with pip3.
1
2
$ pip3 install wheel
$ pip3 install -r odoo/requirements.txt
  1. Deactivate the environment.
1
$ deactivate
  1. Create a new directory for 3rd party add-ons.
1
$ mkdir /opt/odoo/odoo-custom-addons
  1. Switch back to your non-root example_user account.
1
$ exit
  1. Create a configuration file.
1
$ sudo nano /etc/odoo.conf
  1. Add the following code to the file. Change StrongMasterPassword to a unique password.
1
2
3
4
5
6
7
8
[options]
; This is the password that allows database operations:
admin_passwd = StrongMasterPassword
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo-custom-addons
  1. Close and save the file.
  2. Create a service unit file called odoo.service.
1
2
3
4
5
6
7
8
[options]
; This is the password that allows database operations:
admin_passwd = StrongMasterPassword
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo-custom-addons
  1. Add the following code to the file. Close and save the file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[Unit]
Description=Odoo17
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target
  1. Reload system daemon for changes to take effect.
1
$ sudo systemctl daemon-reload
  1. Start the Odoo service.
1
$ sudo systemctl start odoo
  1. Enable the service to start on system boot.
1
$ sudo systemctl enable odoo
  1. Check the service status.
1
$ sudo systemctl status odoo
Access Web Interface. To access the Odoo web interface, navigate to your server's IP address at port 8069 in your web browser. For example, http:/DNS_Name:8069. You should see the database setup screen:
  1. Enter the admin_password value you chose in /etc/odoo.conf for the Master Password field.
  2. Enter the other information as desired for your installation.

You have installed Odoo. You can now access the Dashboard and configure it to begin managing your busines