One of the most frequently asked questions on odoo forums, groups and chat is the way to install Odoo on own server.
In this article, i will try to describe how to use CRND Deploy to easily install production ready odoo on Ubuntu 20.04 and how to manage third-party addons in this kind of installaton.
Installation of Odoo
Basically, this type of installation includes following steps:
Install system requirements for CRND Deploy script
Clone CRND Deploy script some where on machine
Call CRND Deploy with desired aruments to run odoo installation in desired way.
So, let's install odoo.
At first we have to install some dpendencies to ensure that CRND Deploy script could run:
sudo apt-get update && sudo apt-get install sudo git wget
After this command executed, we can clone the CRND Deploy script (for example) to /tmp directory.
cd /tmp
git clone https://github.com/crnd-inc/crnd-deploy
So, after CRND Deploy script on our machine, we can start installation of Odoo. But at first, let's take a look at it's help message to better undrstand what it can do.
/tmp/crnd-deploy/crnd-deploy.bash --help
This command will print help message. And now, based on help message, we can see that this script can automatically install and configure PostgreSQL server and nginx as frontend for odoo. In our case, we want to install both, postgres and nginx in this article.
So, let's install Odoo 14.0 with this script:
/tmp/crnd-deploy/crnd-deploy.bash --odoo-version 14.0 --install-mode archive --local-postgres --local-nginx
After this command completed, odoo will be installed in the system. Also, this script will automatically install and configure odoo-helper-scripts, that will simplify management of this installation.
So, next we have to start odoo server. It is already configured to autostart on system boot, but just after installation it is not started yet.
odoo-helper server start
As alternative, you can use more convenient for linux call:
/etc/init.d/odoo start
After this, odoo have to be available at http://localhost:8069 port.
As next step we have to activate nginx config generated by CRND Deploy script. The generated config is located at /etc/nginx/sites-available/hostnam.conf.
After, checking this config, we have to activate it. to do this, we have to create symlink for this config in sites-enabled directory, and restart nginx.
cd /etc/nginx/sites-enabled
sudo ln -s "/etc/nginx/sites-available/$(hostname -s).conf" ./
sudo service nginx restart
After this, your odoo have to be available on http://your-ip
Lets summarize, following commands (script) will install odoo on the system:
sudo apt-get update && sudo apt-get install git wget
cd /tmp
git clone https://github.com/crnd-inc/crnd-deploy
/tmp/crnd-deploy/crnd-deploy.bash --odoo-version 14.0 --install-mode archive --local-postgres --local-nginx
sudo service postgresql start
sudo service odoo start
cd /etc/nginx/sites-enabled
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s "/etc/nginx/sites-available/$(hostname -s).conf" ./
sudo service nginx restart
After this, you have to create your first database and start work.
Management of third-party addons
Basically, third-party addons could be delivered in following common ways:
as Odoo Apps package (most of module authors publish apps on Odoo Apps
as python package (published on PYPI) (used by OCA and some other maintainers
as git repository
Usually we deliver our addons to customers as git rpositories, and also most of free odoo addons available on git (github).
odoo-helper-scripts (installed during odoo installation) designed to simplyfy management of addons via git, but also supports installation of addons delivered by other means.
So, let's install all modules from OCA repository `partner-contact`. To do this, all we need is to run command below:
sudo odoo-helper fetch --repo https://github.com/OCA/partner-contact
Afther this command completed, all addons from mentioned repository will be downloadd and placed in /opt/odoo/repositories/oca/partner-contact and symlinked to /opt/odoo/custom_addons
Next, to make this addons available in your database you can run following command:
sudo odoo-helper addons update-list
And after that, you can run following command to install all addons from the repository to all databases:
sudo odoo-helper addons install --dir /opt/odoo/repositories/oca/partner-contact
If you want to install only single addon (for example partner_capital) to single database, then you have to run following command
sudo odoo-helper addons install -d my_database partner_capital
The update of addons works in similar way:
sudo odoo-helper addons update --dir /opt/odoo/repositories/oca/partner-contact
Visit documentation site for odoo-helper-scripts for mor details, especially:
That's all!