In our previous blog, we discussed how we can set up Odoo16 on AWS. Now let’s proceed further to know how we can set up odoo 17 on the AWS cloud server.
Steps to setup Odoo 17 on the AWS server
Step 1: Update The Apt Source List
1 |
sudo apt-get update |
apt-get update: Updates the list of available packages and their versions from the repositories.
Step 2: Install The Required Python Libraries
Let’s install further Python libraries –
1 |
sudo apt-get install git python3-pip build-essential wget libpq-dev libsasl2-dev libldap2-dev -y |
These tools are required to –
- git: Version control system for cloning repositories.
- python3-pip: Python package installer for Python 3.
- build-essential: Includes necessary tools for building software (like gcc, make).
- wget: Utility for downloading files from the web.
- libpq-dev: Development files for PostgreSQL.
- libsasl2-dev: Development files for SASL (Simple Authentication and Security Layer).
- libldap2-dev: Development files for LDAP (Lightweight Directory Access Protocol).
- -y: Automatically answers “yes” to prompts.
Step 3: Create A User To Run The Odoo Application
1 |
sudo useradd -m -d /opt/odoo17 -U -r odoo17 |
Note: However, You can create your own version-specific user.
- useradd: will create a new user account.
- -m: Creates a home directory for the user.
- -d /opt/odoo17: Specifies the user’s home directory.
- -U: Creates a user group with the same name.
- -r: Creates a system account (not a regular user).
Step 4: Install & Configure The PostgreSQL Database Server
A database can be served from the local database server as well as through the AWS RDS.
Case 1: If you are using Local Database Server (PostgreSQL)
Use this command to install the PostgreSQL server –
1 |
sudo apt install -y postgresql |
After installing the PostgreSQL, We will set up a new PostgreSQL user to do the interactions with the database from the odoo application.
1 |
sudo su - postgres -c "createuser -s odoo17" |
- su – postgres: Switches to the Postgres user.
- -c “createuser -s odoo17”: Executes the createuser command to create a superuser named odoo17.
Case 2: If you are using AWS RDS
To connect to an RDS PostgreSQL instance from an Ubuntu server and create a user, you can follow these steps:
Install the PostgreSQL client on your Ubuntu server if it’s not already installed:
1 |
sudo apt install postgresql-client -y |
Now, you can connect to your RDS and run the following command.
1 |
psql -p 5432 -h yourrdsendpoint -U username |
- psql: PostgreSQL interactive terminal.
- -p 5432: Specifies the port number (default PostgreSQL port).
- -h yourrdsendpoint: Specifies the RDS endpoint.
- -U username: Specifies the username to connect with.
Now you can CREATE ROLE odoo17 WITH LOGIN PASSWORD ‘$ecretp@$$’;
Step 5: Clone The latest Code From Github After Switching To The Odoo17 User
1 |
sudo su - odoo17 -s /bin/bash |
1 |
git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 /opt/odoo17/odoo |
- sudo su – odoo17 -s /bin/bash : Switches to the odoo17 user and starts a new shell.
- git clone: Clones a repository.
- –depth 1: Fetches only the latest snapshot of the repository.
- –branch 17.0: Specifies the branch to clone.
- /opt/odoo17/odoo: Directory where the repository will be cloned.
Once the latest code is cloned on your server, you can exit from the odoo17 user and be the root user to run further commands.
Step 6: Install Required Web Dependencies For The Odoo
1 2 3 |
sudo apt install -y npm sudo apt install -y node-less sudo npm install -g less less-plugin-clean-css |
- npm: Node.js is a package manager.
- node-less: LESS (Leaner Style Sheets) compiler for Node.js.
- -g: Installs packages globally.
Step 7: Installing Wkhtmltopdf
To install the Wkhtmltopdf
package on an Ubuntu 22.04 server, you need to have the libssl1.1
package (libssl1.1_1.1.1f-1ubuntu2_amd64.deb
) installed on the server.
Wkhtmltopdf is used for generating PDF documents from HTML content. This is useful for generating reports, invoices, or any other document that needs to be printed or archived in a PDF format.
1 |
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb |
This command will help download and install a specific version of the OpenSSL library
provides cryptographic functions, SSL (Secure Sockets Layer), and TLS (Transport Layer Security) protocols.
1 |
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb |
1 |
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb |
1 |
sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb -y |
1 |
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin |
This command copies the wkhtmltopdf executable to /usr/bin, making it available system-wide. This is useful if the executable is not already in the system’s PATH.
1 |
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin |
This command just like the previous command will convert HTML to images (e.g., PNG).
Step 8: Install Required Python 3 Dependencies For Odoo
1 |
cd /opt/odoo17/odoo |
1 |
pip3 install -r requirements.txt |
pip3 install -r requirements.txt: Installs Python dependencies listed in requirements.txt.
if you face cffi issue because of version incompatibility.
Run the below command.
1 |
pip3 install --upgrade pip |
again run the requirement txt
Now the cffi package issue has been Fixed
Step 9: Make A Directory To Keep Track Of Odoo Logs
1 |
sudo mkdir /var/log/odoo |
1 |
sudo chown odoo17:root /var/log/odoo |
- mkdir: Creates a new directory to keep track of odoo logs.
- chown: Changes file owner to odoo and group to root.
Step 10: Create A Configuration File For The Odoo
1 |
sudo nano /etc/odoo-server.conf |
Sample configuration file.
1 2 3 4 5 6 7 8 9 |
[options];This is the password that allows database operations: ; admin_passwd = admin db_host = False #If using RDS then define your rdsendpoint db_port = False db_user = odoo17 db_password = False #add your own password addons_path = /opt/odoo17/odoo/addons logfile = /var/log/odoo/odoo-server.log proxy_mode = True |
Further, Set the ownership and permission to the file.
- admin_passwd: Sets the administrator password.
- db_host: Database host (set to RDS endpoint if using RDS).
- db_port: Database port.
- db_user: Database user.
- db_password: Database user password.
- addons_path: Path to Odoo add-ons.(We use webkul addons here)
- logfile: Path to the log file.
- proxy_mode: Enables proxy mode.
1 |
sudo chown odoo17: /etc/odoo-server.conf |
1 |
sudo chmod 640 /etc/odoo-server.conf |
Step 11: Now Create An Odoo Boot Script
This script will let us start/stop the Odoo as a service automatically. Click here to get the script.
1 |
sudo nano /etc/init.d/odoo-server |
Note:- Copy the script to your server and change the daemon path with your respective path.
Now, let’s set the ownership and the permission also for the file.
1 2 |
sudo chmod 755 /etc/init.d/odoo-server sudo chown root: /etc/init.d/odoo-server |
Step 12: Start/Stop Odoo Service
1 |
sudo /etc/init.d/odoo-server start |
Monitor logs of the Odoo using the below command.
1 |
tail -f /var/log/odoo/odoo-server.log |
- /etc/init.d/odoo-server start: Starts the Odoo service.
- tail -f: Continuously displays the log file contents.
Let’s try the IP and port in your preferred browser if the logs don’t show any indication of an error.
Note – Do open the 8069 port from the AWS console in the Security group.
Now your Odoo is successfully operating on a browser with a given IP address and port.
If you want to configure your Odoo application with Nginx, then you can refer to the Blog.
Need Support?
Thank You for reading this Blog!
For further more interesting blogs, keep in touch with us. If you need any kind of support, simply raise a ticket at https://webkul.uvdesk.com/en/. Also, visit our useful OpenCart modules.
For further help or queries, please contact us or raise a ticket.