Odoo Installation
This guide covers how to install and configure Odoo
00:13Install Odoo 10 on Ubuntu 16.04
Before You Begin
-
Complete the Getting Started guide.
-
Follow the Securing Your Server guide to create a standard user account, harden SSH access and remove unnecessary network services. Do not follow the Configuring a Firewall section in the Securing Your Server Guide–we will configure the firewall for an Odoo production server in the next section.
This guide will usesudo
wherever possible.
-
Update your packages:
1
sudo apt update && sudo apt upgrade
Configure UFW Firewall for Odoo
Before installing Odoo, we’ll set up some basic firewall rules to allow SSH connections and access to the Odoo server. In this example we’ll use Odoo’s default port8069
, but this could be any
port you specify later in the configuration file. If you plan to run any
other services, you can add their ports here as well. Refer to our
guide on how to Configure a Firewall with UFW for help with rules and settings:1 2 3 | sudo ufw allow ssh sudo ufw allow 8069/tcp sudo ufw enable |
Install PostgreSQL Database and Server Dependencies
Install the PostgreSQL database, Python, and other necessary server libraries:1 | sudo apt install git python-pip postgresql postgresql-server-dev-9.5 python-all-dev python-dev python-setuptools libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl8.6-dev tk8.6-dev python-tk libyaml-dev fontconfig |
Create a PostgreSQL User
-
Switch to the
postgres
user:
1
sudo su - postgres
-
Set a strong password for the database user and record it in a secure location, you’ll need it in the following sections:
1
createuser odoo -U postgres -dRSP
-
Press CTRL+D to exit the
postgres
user session.
If you want to run multiple Odoo instances on the same Linode
remember to check your PostgreSQL client configuration file (as of the
date this guide is published, located at /etc/postgresql/9.5/main/pg_hba.conf
) and modify it according your needs.
Create an Odoo User
In order to separate Odoo from other services, create a new Odoo system user to run its processes:1 | sudo adduser --system --home=/opt/odoo --group odoo |
If you’re running multiple Odoo versions on the same Linode, you may want to use different users and directories for each instance.
Configure Logs
For logging, Ubuntu 16.04 usessystemd
and journald
by default. With that in mind, you can set up Odoo 10 logs in several
ways. We’ll consider two scenarios in this guide. Your choice of option
will depend on your particular needs:-
To use journals and a separate Odoo log file at the same time, create the corresponding directory:
1
sudo mkdir /var/log/odoo
-
To only use
journald
for logging, you don’t need to create any directory.
Install Odoo
Clone the Odoo files onto your server:1 | sudo git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch /opt/odoo |
Using git offers great flexibility. When a new upgrade is
available, pull the new branch. You can even install a different version
alongside the production one, just change the destination directory and
the --branch X.x
flag. Before upgrading, remember to make a full backup of your database and custom files.
Install Dependencies for Odoo Applications
Before your Odoo applications are ready to use, you’ll need to install some dependencies. We’ll use the Python package manager,pip
, instead of apt
to guarantee that you install the correct versions. We’ll also refrain from using Ubuntu’s packaged versions of Wkhtmltopdf and node-Less.Be sure to follow the steps in this section as your limited, non-root user (not the
odoo
user).Install Python Dependencies
Install the required Python libraries:1 2 | sudo pip install -r /opt/odoo/doc/requirements.txt sudo pip install -r /opt/odoo/requirements.txt |
requirements.txt
files provided
with your Odoo installation to ensure you’re getting the correct
versions of the packages your applications depend on.Install Less CSS via nodejs and npm
-
Download and run the
nodejs
installation script from nodesource:
1
sudo curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
-
Now that our repository list is updated install
nodejs
usingapt
.
1
sudo apt install -y nodejs
-
Install a newer version of Less via
npm
, the NodeJS package manager.
1
sudo npm install -g less less-plugin-clean-css
Install Stable Wkhtmltopdf Version
-
Navigate to a temporary directory:
1
cd /tmp
-
Download the recommended version of wkhtmltopdf for Odoo server. In this example, we use 0.12.1. See the Odoo repository for an up-to-date list of compatible versions:
1
sudo wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
-
Install the package using
dpkg
:
1
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
-
To ensure wkhtmltopdf functions properly, copy the binaries to a location in your executable path:
1 2
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
While wkhtmltopdf version 0.12.2.4 is available in the official Ubuntu 16.04 repository, we don’t advise installing it from there due to the large number of dependencies including:xserver
,gstreamer
,libcups
,wayland
,qt5
and many more. There isn’t an official Xenial package from the project page yet, but the Trusty package from Ubuntu 14.04 is compatible as of this publication.
Odoo Server Configuration
-
Copy the included configuration file to a more convenient location, changing its name to
odoo-server.conf
1
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo-server.conf
-
Next, modify the configuration file. The complete file should look similar to this, depending on your deployment needs:
- /etc/odoo-server.conf
1 2 3 4 5 6 7 8 9 10
[options] admin_passwd = admin db_host = False db_port = False db_user = odoo db_password = FALSE addons_path = /opt/odoo/addons ;Uncomment the following line to enable a custom log ;logfile = /var/log/odoo/odoo-server.log xmlrpc_port = 8069
admin_passwd = admin
- This is the password that allows database operations. Be sure to changeadmin
to something more secure.db_host = False
- Unless you plan to connect to a different database server address, leave this line untouched.db_port = False
- Odoo uses PostgreSQL default port5432
, change this only if you’re using custom PostgreSQL settings.db_user = odoo
- Name of the PostgreSQL database user. In this case we used the default name, but if you used a different name when creating your user, substitute that here.db_password = FALSE
- ChangeFALSE
to the PostgreSQL password you created previously.addons_path =
- Modify this line to read:addons_path = /opt/odoo/addons
. Add
logfile = /var/log/odoo/odoo-server.log
. You can skip this line if you plan to only use journald
for logging.xmlrpc_port = 8069
.
This only makes sense if you’re planning to run multiple Odoo instances
(or versions) on the same server. For normal installation, you can skip
this line and this instance of Odoo will connect by default to port 8069
.As explained in the Configure Logs section, you have many options for Odoo logging in Ubuntu 16.04. This configuration file assumes you’ll use Ubuntu system journals in addition to a custom log path.
Create an Odoo Service
Create a systemd unit calledodoo-server
to allow your application to behave as a service. Create a new file at /lib/systemd/system/odoo-server.service
and add the following contents:- /lib/systemd/system/odoo-server.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[Unit] Description=Odoo Open Source ERP and CRM Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple PermissionsStartOnly=true SyslogIdentifier=odoo-server User=odoo Group=odoo ExecStart=/opt/odoo/odoo-bin --config=/etc/odoo-server.conf --addons-path=/opt/odoo/addons/ WorkingDirectory=/opt/odoo/ StandardOutput=journal+console [Install] WantedBy=multi-user.target
StandardOutput=journal+console
. As configured in the example above, Odoo logs will be completely managed by the system journal (Option 2 in the Configure Logs section). If you want a separate log file, omit that line and configure odoo-server.conf
accordingly, specifying the location of your log file. Remember that journald
will always capture main Odoo service activity (service start, stop,
reboot, errors), using a separate log file will only exclude journal
“info” messages like webserver messages, rendering engine, etc.Change File Ownership and Permissions
-
Change the
odoo-server
service permissions and ownership so only root can write to it, while theodoo
user will only be able to read and execute it.
1 2
sudo chmod 755 /lib/systemd/system/odoo-server.service sudo chown root: /lib/systemd/system/odoo-server.service
-
Since the
odoo
user will run the application, change its ownership accordingly.
1
sudo chown -R odoo: /opt/odoo/
-
If you chose to use a custom log, set the
odoo
user as the owner of log directory as well (this applies only if you decided to use a separate log file):
1
sudo chown odoo:root /var/log/odoo
-
Finally, protect the server configuration file. Change its ownership and permissions so no other non-root user can access it:
1 2
sudo chown odoo: /etc/odoo-server.conf sudo chmod 640 /etc/odoo-server.conf
Test the Server
-
Confirm that everything is working as expected. First, start the Odoo server:
1
sudo systemctl start odoo-server
-
Check the service status to make sure it’s running. This will
also include journal logs. You can see an example output in the picture
bellow:
1
sudo systemctl status odoo-server
-
Check the database journal to make sure there are no errors:
1
sudo journalctl -u postgresql
-
Verify that the server is able to stop properly:
1
sudo systemctl stop odoo-server
-
Run a service status check again to make sure there were no errors:
1
sudo systemctl status odoo-server
Enable the Odoo Service
-
If your system journal doesn’t indicate any problems, enable the
odoo-server
unit to start and stop with the server:
1
sudo systemctl enable odoo-server
-
Log into the Linode Manager and reboot your Linode to see if everything is working as expected.
-
Once restarted, log in via SSH and verify your journal messages:
1
sudo journalctl -u odoo-server
Test Odoo
-
Open a new browser window and enter in the address bar:
1
http://
:8069 -
If everything is working properly, a screen similar to this should appear:
-
Congratulations, now you can create your first database and start using Odoo 10 applications!
Updating Odoo
Before updating your Odoo system, you should check that everything will work as expected, especially third-party modules. The safest way to do this is to use a testing environment, which is nothing more than a separate Odoo installation.Depending on your server resources, security concerns and testing the scope of this second installation can be done alongside the production instance or in another location (remote or local). For the purpose of this guide, we’ll use a testing environment running on the same server as the production one.
Configure UFW Firewall
In order to use the testing environment at the same time than production we need to use a different TCP port for server connections:1 | sudo ufw allow 8080/tcp |
Create a Separate Database User
An independent database user is a good idea to keep everything off production, however it’s not necessary to use a password as before:1 2 | sudo su - postgres createuser odoo-te -U postgres -dRS |
postgres
user session.Create a Test Odoo User
It’s very important to use a different odoo user than production one:1 | sudo adduser --system --home=/opt/odoo-te --group odoo-te |
Configure Logs
In the case of the testing environment it’s advisable to use a separate log file:1 | sudo mkdir /var/log/odoo-te |
Install Odoo Testing Environment
Clone the updated Odoo source which is different from your older production instance:1 | sudo git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch /opt/odoo-te |
Testing Environment Configuration
The advantage of using the same server is that all dependencies are already meet. What is next is to configure the server accordingly.-
Copy the original configuration file from the source to appropiate location:
1
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo-server-te.conf
-
Modify the configuration file, paying attention to changes from previous installation especially the inclusion of
logfile
and the communication port:
- /etc/odoo-server.conf
1 2 3 4 5 6 7 8 9
[options] admin_passwd = admin db_host = False db_port = False db_user = odoo-te db_password = FALSE addons_path = /opt/odoo-te/addons logfile = /var/log/odoo-te/odoo-server-te.log xmlrpc_port = 8080
-
Create a systemd unit for the Odoo testing environment. This allows you to run it as an independent service:
- /lib/systemd/system/odoo-server-te.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[Unit] Description=Odoo Open Source ERP and CRM (Test Env) Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple PermissionsStartOnly=true SyslogIdentifier=odoo-server-te User=odoo-te Group=odoo-te ExecStart=/opt/odoo-te/odoo-bin --config=/etc/odoo-server-te.conf --addons-path=/opt/odoo-te/addons/ WorkingDirectory=/opt/odoo-te/ [Install] WantedBy=multi-user.target
Change File Ownership and Permissions
Just as you did before, set permissions for the testing environment:1 2 3 4 5 6 | sudo chmod 755 /lib/systemd/system/odoo-server-te.service sudo chown root: /lib/systemd/system/odoo-server-te.service sudo chown -R odoo-te: /opt/odoo-te/ sudo chown odoo-te:root /var/log/odoo-te sudo chown odoo-te: /etc/odoo-server-te.conf sudo chmod 640 /etc/odoo-server-te.conf |
Check your Testing Environment
Now you can start your new Odoo service and verify log entries for errors:1 2 3 4 | sudo systemctl start odoo-server-te sudo systemctl status odoo-server-te sudo journalctl -u postgresql sudo cat /var/log/odoo-te/odoo-server-te.log |
Prepare your System for Production Tests
At this point, you have a completely independent Odoo installation. Next steps will setup your testing environment to replicate the production one.-
Make a backup of your production database using the Odoo
graphical interface. Navigate to the following URL in your web browser.
This assumes that your are using the default port 8069:
1
http://your_domain_or_IP_address:8069/web/database/manager
-
Start your
odoo-server-te
service and restore the production database using the Odoo graphical interface by navigating to the URL below. Note that this time you’ll be using port 8080 since that’s where the test environment is running:
1
http://your_domain_or_IP_address:8080/web/database/manager
-
The final step is to update Odoo modules to newer versions,
this is done restarting the service and updating database entries which
tells the system to apply changes:
1
sudo service odoo-server-te restart -u all -d
-
If everything goes as expected, you can start your load tests
modules “behavior” tests (which are different from code-incompatible
errors), and any other tests you’ve configured.
Update your Production System
If all your tests pass, you can safely update your production installation.-
Download the new code from source:
1 2
cd /opt/odoo sudo git fetch origin 10.0
-
Apply the changes to your repository:
1
sudo git reset --hard origin/10.0
-
Access your new system:
1
http://your_domain_or_IP_address:8069
OpenERP V7 and V8(odoo) installation on Ubuntu
2. Install Git. GIT is the Versioning control system used for Odoo Source code hosting. You may always pull latest source from git by using specific commands. Please note that setting up bzr is in next points. You can now use any version of OpenERP/Odoo from git.sudo apt-get update && sudo apt-get upgrade
3. Install Required Python Packages for OpenERP - v7 so that we will not get any errors related the package requirement.sudo apt-get install git
4. Install Required Packages for Odoo - v8 so that we will not get any errors related the package requirement.sudo apt-get install python-matplotlib python-pyparsing python-imaging python-psycopg2 python-libxslt1 python-libxml2 graphviz postgresql pgadmin3 python-lxml mx44 python-reportlab python-pychart python-tz python-openssl python-hippocanvas python-yaml python-pydot python-setuptools flashplugin-installer python-mako python-pybabel python-werkzeug python-openid bzr python-mock python-unittest2 python-docutils
5. Install Supporting Packages for Odoo and it will fulfill the dependencies of the modules, because some modules require python libraries to be installed before you install modules in odoo.sudo apt-get install graphviz ghostscript postgresql-client python-dateutil python-feedparser python-matplotlib python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-imaging
6. Install Gdata client if not installed yet! This is specially used for Google related integrations.sudo apt-get install gcc python-dev mc bzr python-setuptools python-babel python-feedparser python-reportlab-accel python-zsi python-openssl python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock python-docutils lptools make python-psutil python-paramiko poppler-utils python-pdftools python-pypdf python-requests python-decorator python-passlib antiword
7. Create directory for OpenERP(v7) and fetching the same from launchpad. (NOTE: Use /home directory of your user)wget http://gdata-python-client.googlecode.com/files/gdata-2.0.18.tar.gz tar zxvf gdata-2.0.18.tar.gz cd gdata-2.0.18 sudo python setup.py install
8. Creating User For Postgresql. (NOTE: Replace username with your system User)sudo mkdir openerp cd openerp bzr branch lp:openerp-web/7.0 web bzr branch lp:openobject-server/7.0 server bzr branch lp:openobject-addons/7.0 addons
9. Alter User Of Postgres. (NOTE: Replace username&password with your System User&password)sudo -u postgres createuser -s username
10. Starting OpenERP(v7) Server by going to the server directory of OpenERP.sudo su postgres psql alter user username with password 'password'; \q exit
11. Create Directory For Cloning OpenERP/Odoo Gnd Go To That Directory.cd /home/workspace/openerp/server python openerp-server - -addons-path=../addons/,../web/addons/
cd /home/workspace/odoo
12. Cloning the latest code of 8.0(odoo) from GitHub.
13. Go to odoo directory.git clone https://github.com/odoo/odoo.git
14. Start 8.0(odoo) server.cd odoo
NOTE: To stop the server press CRTL+C keys and to restart do the same procedure as above.
0 comments