Skip to content

Instantly share code, notes, and snippets.

@cmorisse
Last active April 15, 2018 09:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cmorisse/250b4dfe441e0a110f2bcdeba6751b65 to your computer and use it in GitHub Desktop.
Save cmorisse/250b4dfe441e0a110f2bcdeba6751b65 to your computer and use it in GitHub Desktop.
Install odoo in a cloud9 "Blank" workspace
 _____          _        _ _   _____     _               _                          
|_   _|        | |      | | | |  _  |   | |             (_)                         
  | | _ __  ___| |_ __ _| | | | | | | __| | ___   ___    _ _ __                     
  | || '_ \/ __| __/ _` | | | | | | |/ _` |/ _ \ / _ \  | | '_ \                    
 _| || | | \__ \ || (_| | | | \ \_/ / (_| | (_) | (_) | | | | | |                   
 \___/_| |_|___/\__\__,_|_|_|  \___/ \__,_|\___/ \___/  |_|_| |_|                   
                                                                                    
                                                                                    
 _ _______ _             _    _ _   _    _            _                             
( | ) ___ \ |           | |  ( | ) | |  | |          | |                            
 V V| |_/ / | __ _ _ __ | | __V V  | |  | | ___  _ __| | _____ _ __   __ _  ___ ___ 
    | ___ \ |/ _` | '_ \| |/ /     | |/\| |/ _ \| '__| |/ / __| '_ \ / _` |/ __/ _ \
    | |_/ / | (_| | | | |   <      \  /\  / (_) | |  |   <\__ \ |_) | (_| | (_|  __/
    \____/|_|\__,_|_| |_|_|\_\      \/  \/ \___/|_|  |_|\_\___/ .__/ \__,_|\___\___|
                                                              | |                   
                                                              |_|                   
=====================================================================================

Install Odoo in a Cloud9 "blank" workspace

Hi there! Welcome to Cloud9 IDE!

To get you started with Odoo follow instructions in next paragraphs.

You can also visit http://docs.c9.io for our documentation. If you want, you can also go watch some training videos at http://www.youtube.com/user/c9ide.

Happy coding! The Cloud9 IDE team

Odoo setup instructions

Setup a locale

This steps are required to allow using/restoring a database UTF8 encoded.

Open a terminal and type:

sudo locale-gen fr_FR fr_FR.UTF-8
sudo update-locale

Then edit ~/.bashrc to add this lines:

export LANG=fr_FR.UTF-8
export LANGUAGE=fr_FR
export LC_ALL=fr_FR.UTF-8
export LC_CTYPE=fr_FR.UTF-8

Save the file and close your terminal. Theses settings must be active next time you open a new Terminal window.

Install Postgresql Server

Open a terminal and enter these commands:

sudo apt-get update
sudo apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev
sudo apt-get install -y postgresql
sudo pg_dropcluster 9.3 main
sudo pg_createcluster 9.3 main  # To force create the cluster with the locale defined in previous paragraph
sudo pg_ctlcluster 9.3 main start

Note: Don't try to launch a sudo apt-get upgrade to optimize your workspace disk space.

Create a postgresql user for Odoo

Odoo requires a postgresql user with a particular set of privileges. Enter these commands in a terminal:

sudo su - postgres -c psql
psql (9.3.13)
Type "help" for help.

postgres=# CREATE ROLE UBUNTU WITH LOGIN SUPERUSER CREATEDB CREATEROLE PASSWORD 'ubuntu';
CREATE ROLE
postgres=# \q

Install Odoo

Depending on your Cloud9 account type, you will clone Odoo differently. With a free account, you must do a git shallow clone.

Open a terminal and enter the commands set corresponding to your Clud9 account type.

On a "Free" Cloud9 account

git clone --depth 5 http://github.com/odoo/odoo -b 9.0 # replace 9.0 with the version you want to run
sudo pip install -r /home/ubuntu/workspace/odoo/requirements.txt 

On an "Individual" or "Team" account

git clone http://github.com/odoo/odoo
cd odoo
git checkout 9.0 # replace 9.0 with the version you want to run
sudo pip install -r /home/ubuntu/workspace/odoo/requirements.txt 

Launch Odoo

To launch odoo, enter this command in a terminal or use it to create a run configuration:

cd /home/ubuntu/workspace/odoo
./odoo.py --db_host=127.0.0.1 --db_user=ubuntu --db_password=ubuntu --xmlrpc-port=$C9_PORT --database=my_database

You can refer to odoo's commande line documentation: Command-line interface: odoo.py

Odoo will create a database named "my_database" with a user "admin" and password "admin".

Open the Preview URL in a new browser after having replaced the "https://" by "http://".

Once logged in a browser tab, you can use Cloud9 Integrated Preview.

@bishisht
Copy link

bash: ./odoo.py: No such file or directory
on 11.0

@bitsnaps
Copy link

bitsnaps commented Dec 24, 2017

Hi, got an error at:
sudo su - postgres -c psql
saying:
psql: could not connect to server: Connection refused Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I had to run postgresql service first:
service postgresql start

@vsanjuan
Copy link

I've got an error while launching Odoo OperationalError: FATAL: database "my_database" does not exist.
So I guess Odoo is not creating the database

@robertkalapurackal
Copy link

@bishisht
In Odoo 11 its ./odoo-bin
./odoo-bin --db_host=127.0.0.1 --db_user=ubuntu --db_password=ubuntu --xmlrpc-port=$C9_PORT --database=my_database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment