So you want to install Odoo for your company or business? Follow the tutorial to install Odoo 8, the latest version of Odoo on CentOS 7, which should work also in related distributions such as Red Hat Enterprise Linux (RHEL) and Scientific Linux (possibly with slight change in command i.e. systemctl vs service etc).
Installing PostgreSQL
Unlike most other web apps which are using MySQL or MariaDB, Odoo (and OpenERP) uses PostgreSQL database system. Install PostgreSQL using the following command:
yum install postgresql postgresql-server postgresql-libs
After installing the PostgreSQL, initialize the database with the following command:
postgresql-setup initdb
Make sure that the PostgreSQL service is enabled on boot and start the PostgreSQL server if it’s not running:
systemctl enable postgresql systemctl start postgresql
A user named “postgres” with blank password (no password) is created by default as system user and database user. System user postgres is locked and disabled by default and thus does not accept login except su from root. To secure the system, change the password for database user with the following commands (you must be root to be able to su to postgres user):
# su - postgres $ psql postgres=# \password postgres Enter new password: Enter it again: postgres=# \q $ exit
$ sudo -u postgres psql postgres=# \password postgres
Install EPEL (Extra Packages for Enterprise Linux)
Odoo (or OpenERP) depends on Phython runtime and many other packages that are not included in default standard repository. As such, add the Extra Packages for Enterprise Linux (or EPEL) repository support so that Odoo can get whatever dependencies it required.
yum install epel-release
Add Odoo 8 Repository
Create a file named odoo.repo in /etc/yum.repos.d/ directory, with the following content:
[odoo-nightly] name=Odoo Nightly repository baseurl=http://nightly.odoo.com/8.0/nightly/rpm/ enabled=1 gpgcheck=1 gpgkey=https://nightly.odoo.com/odoo.key
yum-config-manager --add-repo = https://nightly.odoo.com/8.0/nightly/rpm/odoo.repo
Or, you can download the odoo.repo directly:
wget https://nightly.odoo.com/8.0/nightly/rpm/odoo.repo
Install Odoo and Dependencies Automatically
Start the Odoo installation process with the following command. Yum is smart enough to include all required dependencies, including Python packages, at the same time.
yum install odoo
What the installation did was add a local user account and local group account named “odoo”, which own most Odoo files. By default, the local user account is disabled and locked so that no login is possible, except su from root.
In addition, a user account named “odoo” is also created in PostgreSQL database.
Additionally, the Odoo configuration file is created as in /etc/openerp-server.conf or /etc/odoo/openerp-server.conf, which saves the database connection details (No amendment is necessary unless your PostgreSQL DBMS is hosted remotely, has a different port. By default, PostgreSQL allows ident or peer authentication for connection from localhost, which uses client’s operating system user name from kernel or an ident server, and using it as the allowed database user name), and a systemd unit file for Odoo is placed in /usr/lib/systemd/system/odoo.service to allow automatic start of Odoo after server is booted.
Enable Odoo to automatically start the service on system startup and immediately run the Odoo service with following commands:
systemctl enable odoo systemctl start odoo
Open Odoo Port in Firewall
Odoo uses port 8069. Use the following commands to open up the port if you’re accessing remotely:
firewall-cmd --zone=pubic --add-port=8069/tcp --permanent firewall-cmd --reload
Change PostgreSQL template0 / template1 Character Encoding to UTF8
Odoo 8 is using UTF-8 as character encoding. If you’re not setting UTF-8 as your locale and didn’t specify UTF-8 when initiating PostgreSQL database, chance is PostgreSQL database system and its template0 or template1 standard system databases which new databases are based on may be using SQL_ASCII Latin1 encoding, and Odoo will return an error during its initial setup.
To change the encoding of PostgreSQL, login as root (postgres requires root to su into) and perform the following:
# su - postgres $ psql postgres=# update pg_database set encoding = 6, datcollate = 'en_US.UTF8', datctype = 'en_US.UTF8' where datname = 'template0'; postgres=# update pg_database set encoding = 6, datcollate = 'en_US.UTF8', datctype = 'en_US.UTF8' where datname = 'template1'; postgres=# \q $ exit
Restart the PostgreSQL if necessary:
systemctl restart postgresql
host all all 0.0.0.0/0 md5
Access and Configure Odoo (OpenERP)
Access the Odoo at the URL: http://host-IP-address:8069/.
On your first visit, you will arrive at a Database Manager and you need to create a new database and set the password for “admin” account. Once set up, you can log in to the Odoo to install modules and start using the ERP system with user name “admin” and the password you set when creating the database.