Installing Odoo 9 on Ubuntu 16.04

Hi guys,

1. Introduction

In this tutorial I will teach you how to install Odoo 9 on Ubuntu 16.04. The script that you will use is based on the code from André Schenkels but has been updated and improved.

2. Downloading the script

The first step is to download my script from Github and to add the code in a new .sh file on your Ubuntu machine, wherever you’d like this.
For example right under /home. Open up an Ubuntu terminal and cd to the directory where you’d like to keep the script and then create the file:

If you’re curious about how the whole code looks and works you can find it on my Github account.

Now open up the file and edit the parameters to your liking:

There are some things you can configure/change to your likings at the top of the script. You can choose if you wish to install Wkhtmltopdf or not, which version you’d like, where the location is and most importantly what the master admin password is.
Tip: always modify this for every Odoo you install!

3. Making the Odoo installation file executable

The next step is to make this file executable. After you’ve made it executable you can execute it and everything will be installed automatically.
do this with the following command:

4.Running the script

Now that the code is in your file and the file is executable you simply have to execute it with the following command:

You will see that the script automatically starts updates, downloads required packages, creates the user, downloads the code from Github, …
Give the script a few minutes to configure and install everything and eventually you will see something like this:
Result install script

You now have a fully functional Odoo V9 on your Ubuntu 16.04! Congratulations.
Odoo V9

5. Extra information

In the script you saw there was an option to change the Odoo port (OE_PORT). When you’d change this port number to 8070 in the install script it would be applied to /etc/your-config-file.conf and this would give you the ability to change the default port.
To apply these changes you should do the following:
Changing Odoo settings
The -c will change the configuration and memorize what you’ve changed under /etc/your-config-file.conf. Because my port was set to 8070 this is telling the Odoo that it should run on port 8070. When you would now open up your browser and navigate to http://localhost:8070/ you will see it is running there:
Odoo V9 alternative port

Has this tutorial helped you, do you have any feedback or questions? Post away!
Tutorial sponsored by Oocademy

Updating your Odoo from Github

Hi guys,

In this tutorial I will teach you how to update your Odoo code from Github. In this tutorial you will learn how to use terminal commands to update your local Odoo installation.

In this example I will learn you how to update your Odoo environment from Github and how you can update your database in order to use the newest code.

1. Navigating in to the correct folder

The first thing that you will need to do is to navigate in to the correct folder from your terminal. Usually your Odoo is installed right under the root folder and has a structure along the lines of /odoo/odoo-server. In my local example I’ve installed an Odoo 9 under /odoo9/odoo9-server:
Odoo folder location
So, how do you know in which folder you need to be? if you see the same structure as in my above screenshot you’re in the right place. You should see the and addons folder.

2. Fetch content from Github

Now that you’re in the correct folder you should fetch the content from Github in order to apply it locally later on. Fetch the content from Github:

So, what does this line do? Sudo will execute this command with administrator priveleges, git fetch will tell the system that we want to fetch content from github, origin refers to the origin where Odoo comes from ( and 9.0 is the Odoo version.
Tip: If you have Odoo version 8 you should replace 9.0 with 8.0.
After running this command you will see the following result:
Github fetch origin

3. Apply all changes

You now have everything fetched and you should now tell the system to apply this. At this point the system knows which files and changes need to be made, but you didn’t make them yet. You can do this with git reset. The code:

Tip: git reset –hard will apply all changes, no matter what. If you did add custom code in already existing modules (so in the source code and not in a self made module) you should not use this. Your custom code will be overwritten with this! This is however against all the rules, so if you do code in the source code please start with creating your own modules in place of adding in the source code.
Tip #2: Do you have another version? Simply change 9.0 with the Odoo version you have running. For example if you have Odoo 8:

After you’ve used this command you will see a result similar to this:
Github reset hard example
So, what does this refer to? If I open up Github and look at the latest change that has been made to Odoo you will see that these match up:
Github reset result on Github
As you can see your Odoo code is now up-to-date and is at the latest change that has been made by Odoo.

4. Updating the database

Congratulations, you’ve already updated your whole Odoo code! That was simple, right? There is just one more thing to do. You should now update your database so that the database knows about all changes and applies them in the database.
There are multiple ways to do this but the most simple one is to restart the Odoo service with the correct parameters to update the odoo. Every Odoo has a service running and usually has a name along the lines of odoo-server. Type the following command in your terminal:

Let us break down the whole command to know which part does what.
sudo service odoo9-server restart tells the system to restart a service (so, an Odoo environment). -u all will tell the Odoo to update all modules and -d YourDatabaseName will tell the Odoo to do these changes on the database named ‘YourDatabaseName’.
Tip: Want to know more about the possibilities of the command-line interface? Have a look at the official documentation!

That is all, you’re done! After you’ve run this command you’ve updated the whole database with the latest code.

5. Conclusion

Updating an Odoo environment from Github is actually really easy. Your users will not notice anything (besides of a minor delay when reloading the database) and your system will not need to go down when updating an environment.

Has this tutorial helped you, do you have any feedback or questions? Post away!
Tutorial sponsored by Oocademy