# lsb_release -a<\/pre>\nYou should get this as the output:<\/p>\n
Distributor ID: Debian\r\nDescription: Debian GNU\/Linux 10 (buster)\r\nRelease: 10\r\nCodename: buster<\/pre>\nThen, run the following command to make sure that all installed packages on the server are updated to their latest available versions:<\/p>\n
# apt update && apt upgrade\r\n<\/pre>\n<\/span>Step 2: Install Odoo 12 Dependencies<\/span><\/h2>\nBefore starting, we will need to install some dependencies required to install Odoo 12. You can install all the dependencies by running the following command:<\/p>\n
apt-get install git wget build-essential node-less libjpeg-dev libpq-dev python3-pip python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools<\/pre>\n<\/span>Step 3: Install wkhtmltopdf<\/span><\/h2>\nIn order to render HTML into PDF and various image formats, we will need to install the\u00a0wkhtmltopdf<\/code> tool. You can download the wkhtmltopdf<\/code> package with the following command:<\/p>\nwget https:\/\/github.com\/wkhtmltopdf\/wkhtmltopdf\/releases\/download\/0.12.4\/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz<\/pre>\nOnce downloaded, extract and install the downloaded package using the following command:<\/p>\n
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz\r\nmv wkhtmltox\/bin\/wkhtmlto* \/usr\/bin\/\r\nln -nfs \/usr\/bin\/wkhtmltopdf \/usr\/local\/bin\/wkhtmltopdf<\/pre>\n<\/span>Step 4: Create a System User<\/span><\/h2>\nNext, we will need to create a new system user to run Odoo. You can create a new user with named odoo12<\/code> with the home directory set to\u00a0\/opt\/odoo12<\/code> using the following command:<\/p>\nuseradd -m -d \/opt\/odoo12 -U -r -s \/bin\/bash odoo12<\/pre>\n<\/span>Step 5: Install PostgreSQL<\/span><\/h2>\nOdoo uses a PostgreSQL database to store its information so we have to install and use the PostgreSQL service.<\/p>\n
You can run the following command to install PostgreSQL server:<\/p>\n
apt-get install postgresql<\/pre>\nAfter installing PostgreSQL, 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 odoo12\"<\/pre>\n<\/span>Step 6: Install and Configure Odoo 12<\/span><\/h2>\nIn this section, we will download Odoo 12 from the Git repository and install it in a Python virtual environment.<\/p>\n
First, log in as odoo12<\/code> user and download Odoo 12 from the Git repository:<\/p>\nsu - odoo12\r\ngit clone https:\/\/www.github.com\/odoo\/odoo --depth 1 --branch 12.0 odoo<\/pre>\nOnce the download is complete, create a new Python virtual environment for the Odoo 12 installation with the following command:<\/p>\n
python3 -m venv odoo-venv<\/pre>\nNext, activate the virtual environment with the following command:<\/p>\n
odoo12@debian:~$ source odoo-venv\/bin\/activate<\/pre>\nYou should get the following output:<\/p>\n
(odoo-venv) odoo12@debian:~$<\/pre>\nNext, install the required modules using the pip3<\/code> command as shown below:<\/p>\n(odoo-venv) odoo12@debian:~$ pip3 install wheel\r\n(odoo-venv) odoo12@debian:~$ pip3 install -r odoo\/requirements.txt<\/pre>\nOnce all the required modules are installed successfully, deactivate the virtual environment with the following command:<\/p>\n
(odoo-venv) odoo12@debian:~$ deactivate<\/pre>\nNext, create a separate directory for Odoo 12 custom addons:<\/p>\n
mkdir \/opt\/odoo12\/odoo-custom-addons<\/pre>\nNext, exit from the odoo12<\/code> user with the following command:<\/p>\nexit<\/pre>\nNext, we will need to create a configuration file for the Odoo 12 instance. You can copy the sample configuration file with the following command:<\/p>\n
cp \/opt\/odoo12\/odoo\/debian\/odoo.conf \/etc\/odoo12.conf<\/pre>\nNext, open the file \/etc\/odoo12.conf<\/code> with nano editor:<\/p>\nnano \/etc\/odoo12.conf<\/pre>\nMake the following changes:<\/p>\n
[options]\r\n; This is the password that allows database operations:\r\nadmin_passwd = password<\/span>\r\ndb_host = False\r\ndb_port = False\r\ndb_user = odoo12<\/span>\r\ndb_password = False\r\nxmlrpc_port = 8069<\/span>\r\naddons_path = \/opt\/odoo12\/odoo\/addons,\/opt\/odoo12\/odoo-custom-addons<\/pre>\nNote : replace ‘password<\/span>‘ with a strong password, odoo12<\/span> with the Odoo system user and 8069<\/span> with the port you want to run Odoo on. It is necessary if you want to run multiple Odoo instances on the same server.<\/p>\nNext, change the ownership of \/etc\/odoo12.conf<\/code> to odoo12<\/span>:<\/p>\nchown odoo12:odoo12 \/etc\/odoo12.conf<\/pre>\n<\/span>Step 7: Create a Systemd Service File for Odoo 12<\/span><\/h2>\nNext, we will need to create a systemd service file to manage Odoo 12 service. You can create it in the \/etc\/systemd\/system\/<\/code> directory:<\/p>\nnano \/etc\/systemd\/system\/odoo12.service<\/pre>\nAdd the following lines:<\/p>\n
[Unit]\r\nDescription=Odoo12\r\nRequires=postgresql.service\r\nAfter=network.target postgresql.service\r\n\r\n[Service]\r\nType=simple\r\nSyslogIdentifier=odoo12\r\nPermissionsStartOnly=true\r\nUser=odoo12<\/span>\r\nGroup=odoo12<\/span>\r\nExecStart=\/opt\/odoo12\/odoo-venv\/bin\/python3 \/opt\/odoo12\/odoo\/odoo-bin -c \/etc\/odoo12.conf\r\nStandardOutput=journal+console\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\nNote : Change User and Group with the Odoo system user if it differs from our example user.<\/p>\n
Save and close the file. Then, reload the systemd daemon with the following command:<\/p>\n
systemctl daemon-reload<\/pre>\nNext, start the newly-created odoo12 service and enable it to start after system reboot with the following command:<\/p>\n
systemctl start odoo12\r\nsystemctl enable odoo12<\/pre>\nYou can now verify the status of Odoo service with the following command:<\/p>\n
systemctl status odoo12<\/pre>\nYou should get the following output:<\/p>\n
\u25cf odoo12.service - Odoo12\r\nLoaded: loaded (\/etc\/systemd\/system\/odoo12.service; disabled; vendor preset: enabled)\r\nActive: active (running) since Sun 2019-08-25 11:48:40 EDT; 7s ago\r\nMain PID: 13043 (python3)\r\nTasks: 2 (limit: 1138)\r\nMemory: 63.8M\r\nCGroup: \/system.slice\/odoo12.service\r\n\u251c\u250013043 \/opt\/odoo12\/odoo-venv\/bin\/python3 \/opt\/odoo12\/odoo\/odoo-bin -c \/etc\/odoo12.conf\r\n\u2514\u250013046 \/usr\/local\/bin\/wkhtmltopdf --version\r\n\r\nAug 25 11:48:40 debian systemd[1]: Started Odoo12.\r\nAug 25 11:48:46 debian odoo12[13043]: 2019-08-25 15:48:46,062 13043 INFO ? odoo: Odoo version 12.0\r\nAug 25 11:48:46 debian odoo12[13043]: 2019-08-25 15:48:46,065 13043 INFO ? odoo: Using configuration file at \/etc\/odoo12.conf\r\nAug 25 11:48:46 debian odoo12[13043]: 2019-08-25 15:48:46,073 13043 INFO ? odoo: addons paths: ['\/opt\/odoo12\/.local\/share\/Odoo\/addons\/12.0', '\/\r\nAug 25 11:48:46 debian odoo12[13043]: 2019-08-25 15:48:46,074 13043 INFO ? odoo: database: odoo12@default:default\r\nAug 25 11:48:47 debian odoo12[13043]: 2019-08-25 15:48:47,600 13043 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf<\/pre>\nYou can also verify the Odoo listening port using the following command:<\/p>\n
netstat -plntu | grep 8069<\/span><\/pre>\nYou should get the output one below:<\/p>\n
tcp 0 0 0.0.0.0:8069 0.0.0.0:* LISTEN 13208\/python3<\/pre>\n