Installing OdooThis tutorial will show you how to install the ERP and CRM platform Odoo. You can find what changes you need to make to your account, how to install Odoo automatically, how to install Odoo manually, how to force Odoo to always work over HTTPS, and how to use the odoo-bin CLI management tool to manage your Odoo installation. Note: This guide has been tested with Odoo version 17.0. PrerequisitesBefore you install Odoo, there are a few settings to check and configure on your hosting account.
Quick (automatic) installationTo install and configure Odoo, you can upload this Odoo installation script to your account, set 755 permissions for it, and execute it via SSH. This can be easily achieved by connecting to your account via SSH and running the following command: wget https://tickets.suresupport.com/faq_img/4869.sh -q -P /home/$USER/private && chmod 755 /home/$USER/private/4869.sh && /home/$USER/private/4869.sh && rm /home/$USER/private/4869.sh The output of the Odoo installation script should look like this:
Important: To get Odoo working with a domain/subdomain of your account, you need to edit the "odoo1" web application and configure its Domain, Subdomain, and Web access path settings through the hosting Control Panel > WebApps section. Manual installationTo install Odoo manually, you will need to connect to your account via SSH and follow the steps listed below. Install PostgreSQLOdoo uses PostgreSQL as database backend, so you need to have PostgreSQL installed on your account. If PostgreSQL is already installed and running on your account, you can skip this step. Otherwise, you can install PostgreSQL as a separate web application by running this command via SSH: wget https://tickets.suresupport.com/faq_img/4166.sh -q -P /home/$USER/private && chmod 755 /home/$USER/private/4166.sh && /home/$USER/private/4166.sh postgres1 && rm /home/$USER/private/4166.sh && . "/home/$USER/.bashrc"
Create a PostgreSQL database and userAfter PostgreSQL is configured and running on your account, you will need to create a new database and user for Odoo. You can create a randomly generated user, password, and database by running these commands: odoodbuser="$(pwgen -A 24 1)" && createuser -DRS $odoodbuser && echo -e "DB user: "$odoodbuser If you would like to use specific PostgreSQL user, password, and database, run these commands: read -p 'Enter PostgreSQL user for Odoo: ' odoodbuser && createuser -e -DRS $odoodbuser
Download OdooNext, you will need to download Odoo to your account. The easiest way to do this is to download the files from the Odoo GIT page to the directory where Odoo will be deployed (e.g. ~/private/odoo1). If the directory does not exist yet, you can create it by running this command: mkdir /home/$USER/private/odoo1 You can clone the files of the latest version of Odoo to the desired deployment directory on your account (e.g. ~/private/odoo1) by running this command: git clone --depth 1 https://github.com/odoo/odoo.git /home/$USER/private/odoo1
Install the latest Python versionThe latest version of Odoo requires Python version 3.11+, and the Python version available by default on our servers is 3.9. You can use pyenv to install the latest stable version of Python. To install pyenv, run these commands: Load the new settings in your current shell session: Set up a Python virtual environmentSince Odoo runs on Python, it is advisable to set up an isolated environment where you can install Python dependencies only for this application. You can achieve this by setting up a Python virtual environment with virtualenv in a "venv" folder within the Odoo deployment directory (e.g. ~/private/odoo1/venv) by running these commands: mkdir -p "/home/$USER/.local/bin" The last command activates the virtual environment. Install dependenciesAfter the Python virtual environment is activated, you can proceed with upgrading Python and installing all the required packages for Odoo by executing these commands: pip3 install -U pip The commands may take a while to finish. Create the web applicationUse the sureapp CLI tool to create a web application named "odoo1" by running this command: sureapp project create --engine custom --engine-version - --release-dir /home/$USER/private/odoo1 --start-cmd '. "/home/'$USER'/private/odoo1/venv/bin/activate" && python /home/'$USER'/private/odoo1/odoo-bin --config /home/'$USER'/private/odoo1/odoo.conf' odoo1
Configure OdooYou will need to obtain the port of the web application as it required for the installation of Odoo. You can do this with the following command: while [ -z "$odooappport" ]; do sleep 5; odooappport="$(sureapp project list | grep -E "odoo1.*/home/$USER/private/odoo1" | awk '{print $NF}')"; ((odoocounter++)) && ((odoocounter==12)) && echo 'Could not retrieve port...' && break; done; echo $odooappport Alternatively, you can get the port from the Port column next to the "odoo1" web application inside the hosting Control Panel > WebApps section. If you do this, you will need to replace the $odooappport string with that port number in the installation command. Run the following command to install and configure Odoo on your account: python /home/$USER/private/odoo1/odoo-bin --db_host /home/$USER/private/postgres1/run --db_user $odoodbuser --database $odoodbname --db_password $odoodbpass --http-port $odooappport -i base --stop-after-init --save --config /home/$USER/private/odoo1/odoo.conf Please allow some time for the command to finish as the Odoo database initialization process is lengthy. Configure the Odoo URLNavigate to the hosting Control Panel > WebApps section and edit the web application by clicking on the button (pencil icon) next to it. On the edit page, select the domain, subdomain, and directory where you would like Odoo to run, and click on the Update button. Start the web applicationClick on the Enable () button to enable the web application.
Access OdooTo access Odoo, visit the URL you specified in the previous step. It will be listed in the URL column for the web application and should lead you to the Odoo login page (e.g. http://www.example.com/web/login): You can log in using the default username and password for Odoo - "admin". Force HTTPSOdoo transmits authentication information in plain text, so forcing HTTPS for Odoo is strongly recommended. To do this, you need to install an SSL certificate on the server for your domain or subdomain. Once an SSL certificate is installed, click on the Enable button next to your domain/subdomain in the hosting Control Panel > SSL/HTTPS section > Force HTTPS subsection. Manage Odoo via odoo-binIf you need to run any commands with odoo-bin (the Odoo CLI tool), we would strongly recommend that you create the following simple wrapper script. cat <<MANAGE_SH > "/home/$USER/private/odoo1/venv.sh" The script will allow you to use the manage-odoo command which will execute the odoo-bin CLI tool directly in the Python virtual environment configured for Odoo. |