Return to site

How to Run Odoo on WSL (Windows Subsystem for Linux)

how to quickly install Odoo on your home PC/Laptop/Surface

Introduction

When Microsoft released Windows Subsytem for Linux (WSL) on Windows 10 I thought it was a cool thing and many people liked it a lot! But after testing it was clear that some components were not yet implemented, in particular communication sockets..

Well, since Microsoft release released Windows 10 Release 1803 sockets in WSL were in place, so I had to kick the tires! So why not a full blown ERP system with Postgres as the database.

I mean, if WSL can run that, it can do a lot!

This is not meant to be the how-to nor to convince you to run Odoo on your computer.. but more like an exercise on what can you do...

Requirements:

First make sure you have Window Release 1803 (was deployed to my home PC on early June,2018)

Now Enable WSL in your desktop (reboot is required):

  1. Open PowerShell as Administrator and run:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Restart your computer when prompted.

Now install Ubuntu

I know there are others but Odoo is kind of picky with other Linux distributions..

Save yourself a lot of trouble and just use Ubuntu, after all this whole thing is just to kick the tires.. (you've been warned).

Go to to the Microsoft Store and install Ubuntu: https://www.microsoft.com/store/p/ubuntu/9nblggh4msv6

Now let the fun begin!

When opening Ubuntu for the first time it will do the installation and you will have to provide a username and password, these are not related to anything in your Windows machine

 

Type odoo for username and odoo (or whatever you prefer) in the password

broken image

Commands to get Odoo running..

Just copy/paste the following commands (one at a time) on your Ubuntu prompt and after about 30 minutes you will have a fully functional Odoo on your PC!!

sudo -i
for y in $(locale | cut -d '=' -f 2| sort |uniq );do locale-gen $y; done
apt-get update && apt-get upgrade -y
apt-get install postgresql -y
cd /etc/init.d
./postgresql start
su - postgres
psql template1 -c 'SHOW SERVER_ENCODING'
psql postgres -c "update pg_database set datallowconn = TRUE where datname = 'template0';"
psql template0 -c "update pg_database set datistemplate = FALSE where datname = 'template1';"
psql template0 -c "drop database template1;"
psql template0 -c "create database template1 with template = template0 encoding = 'UTF8';"
psql template0 -c "update pg_database set datistemplate = TRUE where datname = 'template1';"
psql template1 -c "update pg_database set datallowconn = FALSE where datname = 'template0';"
psql template1 -c 'SHOW SERVER_ENCODING'
createuser -s odoo
psql -c "alter user odoo with password 'odoo';"
exit
wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
echo "deb http://nightly.odoo.com/11.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
apt-get update && apt-get install odoo -y
./odoo start

Lets open Odoo

Now its time, just open your browser of choice and type your PC's IP address followed by port 8069

Or just type: http://localhost:8069

 

and you should see the screen to build the database:

broken image

Fill out with the credentials you previously created and...

Here it is...

Here's odoo running on your PC..

 

broken image

Let me know if you have any questions and I'll try my best to answer them...

 

Enjoy kicking the tires of Odoo on WSL

Final Notes

When you're done kicking the tires... You need to stop odoo and postgress so they don't consume resources

To stop Odoo and Posrgres (must be connected as root via 'sudo command' or 'sudo -i':

cd /etc/init.d
./odoo stop
./postgresql stop

To start Odoo and Postgres (must be connected as root via 'sudo command' or 'sudo -i':

cd /etc/init.d
./postgresql start
./odoo start