ssh root@IP_Address -p Port_number<\/code><\/pre>\n\n\n\nReplace ‘IP_Address’ and ‘Port_number’ with your server’s actual IP address and SSH port number. If needed, replace ‘root’ with the username of your sudo account.<\/p>\n\n\n\n
Once logged in, you must make sure that all AlmaLinux OS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\n\n\n\n
dnf update && dnf upgrade<\/code><\/pre>\n\n\n\n<\/span>Step 2. Install Dependencies<\/span><\/h2>\n\n\n\nNext, install essential dependencies on your server. Run the following command to install these dependencies:<\/p>\n\n\n\n
dnf install git gcc redhat-rpm-config libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel curl unzip openssl-devel wget yum-utils make libffi-devel zlib-devel tar libpq5-devel<\/code><\/pre>\n\n\n\n<\/span>Step 3. Enable PowerTools Repository<\/span><\/h2>\n\n\n\nThe PowerTools repository is necessary to install the psycopg2<\/code> module required by Odoo to connect to PostgreSQL. You can activate it by running the below command:<\/p>\n\n\n\ndnf config-manager --set-enabled crb<\/code><\/pre>\n\n\n\n<\/span>Step 4. Install Python 3.10<\/span><\/h2>\n\n\n\nOdoo 17 requires Python 3.10 or later to run. Let’s download the source code for the latest Python 3.10 version, which is 3.10.13 at the time of writing. Use the following command:<\/p>\n\n\n\n
wget https:\/\/www.python.org\/ftp\/python\/3.10.13\/Python-3.10.13.tgz<\/code><\/pre>\n\n\n\nHere’s how the output should look:<\/p>\n\n\n\n
# wget https:\/\/www.python.org\/ftp\/python\/3.10.13\/Python-3.10.13.tgz\n--2023-11-27 14:45:01-- https:\/\/www.python.org\/ftp\/python\/3.10.13\/Python-3.10.13.tgz\nResolving www.python.org (www.python.org)... 199.232.96.223, 2a04:4e42:58::223\nConnecting to www.python.org (www.python.org)|199.232.96.223|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 26111363 (25M) [application\/octet-stream]\nSaving to: \u2018Python-3.10.13.tgz\u2019\nPython-3.10.13.tgz\n100%[==========================================================>]\n24.90M 4.54MB\/s in 5.5s\n2023-11-27 14:45:07 (4.53 MB\/s) - \u2018Python-3.10.13.tgz\u2019 saved [26111363\/26111363<\/code><\/pre>\n\n\n\nNext, extract the downloaded file using the following command:<\/p>\n\n\n\n
tar xvf Python-3.10.13.tgz<\/code><\/pre>\n\n\n\nAfter extracting, navigate into the Python installation folder and start the configuration by running the following commands:<\/p>\n\n\n\n
cd Python-3.10.13\n.\/configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions<\/code><\/pre>\n\n\n\nThis step will set up the Python installation and configure it for compilation.<\/p>\n\n\n\n
Next, we compile and install the source code using the make<\/code> command. Use the following commands:<\/p>\n\n\n\nmake -j ${nproc}\nmake altinstall<\/code><\/pre>\n\n\n\nAfter the installation finishes, verify the Python version by using the following command:<\/p>\n\n\n\n
python3.10 -V<\/code><\/pre>\n\n\n\nYou should get the following output:<\/p>\n\n\n\n
# python3.10 -V\nPython 3.10.13<\/code><\/pre>\n\n\n\n<\/span>Step 5. Install PostgreSQL<\/span><\/h2>\n\n\n\nOdoo 17 utilizes PostgreSQL as its database system and requires version 12.0 or later. For this, you will need to add the official PostgreSQL Repository for AlmaLinux by running the below command:<\/p>\n\n\n\n
dnf install -y https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-9-x86_64\/pgdg-redhat-repo-latest.noarch.rpm<\/code><\/pre>\n\n\n\nNow install the latest version of PostgreSQL with the following command:<\/p>\n\n\n\n
dnf install -y postgresql16-server postgresql16 postgresql16-devel<\/code><\/pre>\n\n\n\nOnce the installation is complete, initialize the PostgreSQL database:<\/p>\n\n\n\n
\/usr\/pgsql-16\/bin\/postgresql-16-setup initdb<\/code><\/pre>\n\n\n\nNext, initiate and enable the PostgreSQL service with the following command. This command will start PostgreSQL and configure it to launch automatically during boot.<\/p>\n\n\n\n
systemctl enable postgresql-16 && systemctl start postgresql-16<\/code><\/pre>\n\n\n\nAfter installing PostgreSQL, create a new PostgreSQL user for Odoo with the following command:<\/p>\n\n\n\n
su - postgres -c \"createuser -s odoo17\"<\/code><\/pre>\n\n\n\n<\/span>Step 6. Install Wkhtmltopdf<\/span><\/h2>\n\n\n\nTo use PDF export functions in Odoo 17, you will need a wkhtmltopdf<\/code> version greater than 0.12.5. <\/p>\n\n\n\nWkhtmltopdf is a command-line tool that transforms HTML content into PDF format using Qt WebKit. To install wkhtmltopdf<\/code> on your Alma Linux server, use the following command:<\/p>\n\n\n\ndnf install -y https:\/\/github.com\/wkhtmltopdf\/packaging\/releases\/download\/0.12.6.1-2\/wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm<\/code><\/pre>\n\n\n\nYou can then check the version of the installed package like so:<\/span><\/p>\n\n\n\nwkhtmltopdf --version<\/code><\/pre>\n\n\n\nHere’s how the output will look:<\/p>\n\n\n\n
# wkhtmltopdf --version\n\nwkhtmltopdf 0.12.6.1 (with patched qt)<\/code><\/pre>\n\n\n\nWe now have all of our required dependencies installed. You can now proceed to install Odoo 17 on AlmaLinux 9.<\/p>\n\n\n\n
<\/span>Step 7. Install and Configure Odoo 17<\/span><\/h2>\n\n\n\nWe’re setting up an Odoo 17 instance using a dedicated system user account. To do this, let’s create a new system account named “odoo17” using the following command:<\/p>\n\n\n\n
useradd -m -d \/opt\/odoo17 -U -r -s \/bin\/bash odoo17<\/span><\/span><\/code><\/pre>\n\n\n\nNext, switch users to the \u201codoo17\u201d user and clone the Odoo 17 repository from GitHub:<\/p>\n\n\n\n
su - odoo17\n\ngit clone https:\/\/www.github.com\/odoo\/odoo --depth 1 --branch 17.0 \/opt\/odoo17\/odoo<\/code><\/pre>\n\n\n\nNext, we’re creating a new Python virtual environment. This adds a lot of flexibility, like running more than one Odoo instance on the same server, or even multiple versions. Let’s create the Python virtual environment for your Odoo 17 instance with the following command:<\/p>\n\n\n\n
python3.10 -m venv odoo17-venv<\/code><\/pre>\n\n\n\nNext, activate your virtual environment:<\/p>\n\n\n\n
source odoo17-venv\/bin\/activate<\/code><\/pre>\n\n\n\nNext, install all required Python dependencies using the following command:<\/p>\n\n\n\n
pip3 install -r odoo\/requirements.txt<\/code><\/pre>\n\n\n\nNow you can deactivate the virtual environment and create a new directory to upload your custom Odoo add-ons:<\/p>\n\n\n\n
deactivate\n\nmkdir \/opt\/odoo17\/custom-addons<\/code><\/pre>\n\n\n\nOnce Odoo installation is completed, exit from user \u2018odoo17\u2019 and create the Odoo log directory.<\/p>\n\n\n\n
exit\n\nmkdir \/var\/log\/odoo17<\/code><\/pre>\n\n\n\nMake sure to set permissions to the log folder to match your Odoo user:<\/p>\n\n\n\n
chown -R odoo17: \/var\/log\/odoo17\/<\/code><\/pre>\n\n\n\nNext, create an Odoo configuration file with the following command:<\/p>\n\n\n\n
nano \/etc\/odoo17.conf<\/code><\/pre>\n\n\n\nCopy and paste the following content into the Odoo configuration file:<\/p>\n\n\n\n
[options]\nadmin_passwd = StrongPassword\ndb_host = False\ndb_port = False\ndb_user = odoo17\ndb_password = False\nxmlrpc_port = 8069\nlogfile = \/var\/log\/odoo17\/odoo.log\naddons_path = \/opt\/odoo17\/odoo\/addons,\/opt\/odoo17\/custom-addons<\/code><\/pre>\n\n\n\nBe sure to update the value of the “admin_passwd” key above with a more secure password. This is used as your Odoo master password, which is necessary for creating, deleting, and restoring databases.<\/p>\n\n\n\n
<\/span>Step 8. Create Odoo Systemd Service File<\/span><\/h2>\n\n\n\nNow that Odoo is installed and configured. To start, restart, or stop it, you need to create a Systemd service file. You can create it using the following command:<\/p>\n\n\n\n
nano \/etc\/systemd\/system\/odoo17.service<\/code><\/pre>\n\n\n\nAdd the following lines:<\/p>\n\n\n\n
[Unit]\nDescription=Odoo17\nRequires=postgresql-16.service\nAfter=network.target postgresql-16.service\n\n[Service]\nType=simple\nSyslogIdentifier=odoo17\nPermissionsStartOnly=true\nUser=odoo17\nGroup=odoo17\nExecStart=\/opt\/odoo17\/odoo17-venv\/bin\/python3 \/opt\/odoo17\/odoo\/odoo-bin -c \/etc\/odoo17.conf\nStandardOutput=journal+console\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\nSave and close the file, then reload the systemd daemon to apply the changes:<\/p>\n\n\n\n
systemctl daemon-reload<\/code><\/pre>\n\n\n\nNext, initiate and enable the Odoo 17 service with the following command. This command will start Odoo 17 and configure it to launch automatically during boot.<\/p>\n\n\n\n
systemctl start odoo17 && systemctl enable odoo17<\/code><\/pre>\n\n\n\nCheck if the Odoo 17 service is started correctly using the following command:<\/p>\n\n\n\n
systemctl status odoo17<\/code><\/pre>\n\n\n\nIf the service starts correctly, its output should be similar to the following:<\/p>\n\n\n\n
# systemctl status odoo17\n\u25cf odoo17.service - Odoo17\n Loaded: loaded (\/etc\/systemd\/system\/odoo17.service; enabled; preset: disabled)\n Active: active (running) since Mon 2023-11-27 13:50:48 CST; 1h 31min ago\n Main PID: 45691 (python3)\n Tasks: 5 (limit: 11059)\n Memory: 294.8M\n CPU: 1min 37.736s\n CGroup: \/system.slice\/odoo17.service\n \u2514\u250045691 \/opt\/odoo17\/odoo17-venv\/bin\/python3 \/opt\/odoo17\/odoo\/odoo-bin -c \/etc\/odoo17.conf<\/code><\/pre>\n\n\n\nYou can access the Odoo backend using the URL http:\/\/YOUR_SERVER_IP:8069<\/code>. You should see the following page:<\/p>\n\n\n\n <\/figure>\n\n\n\n