In our last guide, we discussed how to set up Odoo 15 on an Ubuntu 20.04 Instance for development using VSCode. Today we will do Odoo Installation for development on Windows 11 using the help of WSL2. This guide is also applicable for Windows 10 since both Windows 10 and Windows 11 have WSL2.
Generally, it is preferred to use a Linux based distro for development purposes, but there may be instances where we cannot ditch Windows or dual boot Linux distro. In such cases, we are forced to use Windows for development. Even though we can use Windows to develop and debug Odoo, we recommend using WSL2 instead of using Windows as it is. This will help you to make sure that there aren’t any discrepancies once you deploy the project on a Linux distro for production. Once we set up and configure WSL2, the rest of the steps are the same as in our previous guide.
The first thing we need to do is open Powershell or Command Prompt as Administrator.
Once it opens up, run the following command to install Ubuntu as your Linux distro and configure everything so we can run Ubuntu from Windows itself. Make sure that you have an active internet connection before you run the command.
wsl --install -d Ubuntu
Once the downloading is completed and everything is configured properly, you can reboot your system once. Once the system restarts, you can find Ubuntu in the app list from where you can launch and configure the instance.
Once you have everything configured, the next thing you need to do is to install the requirements to run Odoo on Ubuntu. You can follow our guide where we set up Odoo on Ubuntu to get all the details. The only thing different from our previous guide will be that you need to install VSCode in windows and not as a snap app in Ubuntu. Once everything is set up for Odoo Installation, you can start a VSCode session from Ubuntu using the below command.
code /path/to/odoo
Another important thing to note is that, due to some limitations snap packages won’t work on WSL2 by default and also even if you install PostgreSQL, it won’t auto start each time. Instead, you need to manually start PostgreSQL, which can be done using the following command.
sudo /etc/init.d/postgresql start
That’s it guys. We have successfully configured Odoo for development on Windows using WSL2.