psql --version<\/pre>\nRunning that will show you the current version of PostgreSQL that you have installed:<\/p>\n
# psql --version\r\npsql (PostgreSQL) 12.2 (Ubuntu 12.2-4)<\/pre>\nAfter the installation is complete, make sure to enable the PostgreSQL server to start automatically upon server reboot through systemctl<\/code>:<\/p>\nsystemctl enable postgresql<\/pre>\nAlso, we need to create a PostgreSQL user with the same name as the new system user. Run the following command to create a PostgreSQL user:<\/p>\n
su - postgres -c \"createuser -s odoo\"<\/pre>\n<\/span>5. Install \u2018wkhtmltopdf\u2019<\/span><\/h2>\nOdoo requires the\u00a0wkhtmltopdf<\/code> package, which is an open-source tool that converts the HTML format to PDF so that Odoo can print PDF reports. The recommended version for Odoo is 0.12.5 with patched qt, which is the latest version at the time this tutorial was written. We will download and install it with the following commands:<\/p>\nwget https:\/\/github.com\/wkhtmltopdf\/wkhtmltopdf\/releases\/download\/0.12.5\/wkhtmltox_0.12.5-1.bionic_amd64.deb\r\napt install .\/wkhtmltox_0.12.5-1.bionic_amd64.deb<\/pre>\nVerify that wkhtmltopdf<\/code> is installed on your server:<\/p>\n# wkhtmltopdf --version\r\nwkhtmltopdf 0.12.5 (with patched qt)<\/pre>\n<\/span>6. Install and Configure Odoo 13<\/span><\/h2>\nIn this section, we will download Odoo 13 from the Git repository and install it in a Python virtual environment.<\/p>\n
First, log in as odoo<\/code> user and download Odoo 13 from the Git repository:<\/p>\nsu - odoo\r\ngit clone https:\/\/www.github.com\/odoo\/odoo --depth 1 --branch 13.0 \/opt\/odoo\/odoo13<\/pre>\nOnce the download is complete, create a new Python virtual environment for the Odoo 13 installation with the following command:<\/p>\n
cd \/opt\/odoo && python3 -m venv odoo13-venv<\/pre>\nNext, activate the virtual environment with the following command:<\/p>\n
source odoo13-venv\/bin\/activate<\/pre>\nNext, install the required modules using the pip3<\/code> command as shown below:<\/p>\n(odoo13-venv) $ pip3 install wheel\r\n(odoo13-venv) $ pip3 install -r odoo13\/requirements.txt<\/pre>\nOnce all the required modules are installed successfully, deactivate the virtual environment and switch back to the sudo or root user with the following command:<\/p>\n
(odoo13-venv) $ deactivate && exit<\/pre>\nNext, create a separate directory for Odoo custom addons. The best practice is to install custom Odoo modules in a separate directory. This ensures that if some custom module doesn’t work, it can easily be removed without risking the removal of required\/built-in modules.<\/p>\n
mkdir \/opt\/odoo\/odoo13-custom-addons\r\nchown odoo: \/opt\/odoo\/odoo13-custom-addons<\/pre>\nThe following commands will create a log file for the new Odoo installation:<\/p>\n
mkdir \/var\/log\/odoo && touch \/var\/log\/odoo\/odoo.log\r\nchown -R odoo: \/var\/log\/odoo\/<\/pre>\nNext, open the file \/etc\/odoo.conf<\/code> with nano editor: nano \/etc\/odoo.conf<\/code><\/p>\nWith the file open, enter the following information in it:<\/p>\n
[options]\r\n; This is the password that allows database operations:\r\nadmin_passwd = master_password\r\ndb_host = False\r\ndb_port = False\r\ndb_user = odoo\r\ndb_password = False\r\nxmlrpc_port = 8069\r\n; longpolling_port = 8072\r\nlogfile = \/var\/log\/odoo\/odoo.log\r\nlogrotate = True\r\naddons_path = \/opt\/odoo\/odoo13\/addons,\/opt\/odoo\/odoo13-custom-addons<\/pre>\nMake sure you set master_password<\/code> to something that is strong and difficult to guess. Save and close the file.<\/p>\nThe last thing we need to do is to create a\u00a0systemd<\/code> unit file which will be used to run our Odoo instance as a service.<\/p>\nCreate a new\u00a0odoo.service<\/code>\u00a0file:<\/p>\nnano \/etc\/systemd\/system\/odoo.service<\/pre>\nand enter the following configuration:<\/p>\n
[Unit]\r\nDescription=Odoo13\r\n#Requires=postgresql-12.2.service\r\n#After=network.target postgresql-12.2.service\r\n\r\n[Service]\r\nType=simple\r\nSyslogIdentifier=odoo13\r\nPermissionsStartOnly=true\r\nUser=odoo\r\nGroup=odoo\r\nExecStart=\/opt\/odoo\/odoo13-venv\/bin\/python3 \/opt\/odoo\/odoo13\/odoo-bin -c \/etc\/odoo.conf\r\nStandardOutput=journal+console\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\nOnce the file is saved and closed, we will reload the daemon so that it acknowledges the newly created unit in systemd.<\/p>\n
systemctl daemon-reload<\/pre>\nNext, start the newly-created odoo.service<\/code> and enable it to start after system reboot with the following command:<\/p>\nsystemctl start odoo\r\nsystemctl enable odoo<\/pre>\n