Skip to content

Instantly share code, notes, and snippets.

@sourabh-upadhyay
Created December 21, 2016 11:08
Show Gist options
  • Save sourabh-upadhyay/d266ae96d3d34fcc58caf6df31969d0b to your computer and use it in GitHub Desktop.
Save sourabh-upadhyay/d266ae96d3d34fcc58caf6df31969d0b to your computer and use it in GitHub Desktop.
Odoo setup in Ubuntu

Install Database and Server Dependencies

sudo apt-get update && sudo apt-get upgrade

Create Odoo User and Log Directory

  • Create the Odoo system user: sudo adduser --system --home=/opt/odoo --group odoo
  • Create the log directory sudo mkdir /var/log/odoo
  • Install Odoo Server Files from Source
  • Change to the Odoo directory, in our case: cd /opt/odoo/
  • Clone the Odoo files on your server: sudo git clone https://www.github.com/odoo/odoo --depth 1 --branch 9.0 --single-branch .

Create PostgreSQL User

  • Switch to postgres user: sudo su - postgres
  • But if you’re deploying a Production server, you may want to set a strong password for the database user: createuser odoo -U postgres -dRSP password: postgres
  • You’ll be prompted for a password, save it, we’ll need it shortly. Note: In the scenario of a testing or development environment you could create a user with no password using createuser odoo -U postgres -dRS
  • Press CTRL+D to exit from postgres user session. If you want to run multiple Odoo instances on the same Linode remember to check pg_hba.conf and change it according your needs.

Specific Dependencies for Odoo Applications

Using pip instead of apt-get will guarantee that your installation has the correct versions needed. We’ll also abstain of using Ubuntu’s packaged versions of Wkhtmltopdf and node-less.

Install Python Dependencies

Install Python libraries using the following commands:

sudo pip install -r /opt/odoo/doc/requirements.txt
sudo pip install -r /opt/odoo/requirements.txt

Install Less CSS via nodejs and npm

  • Download the nodejs installation script from nodesource: wget -qO- https://deb.nodesource.com/setup | sudo bash -

  • Now that our repository list is updated install nodejs using apt-get:

sudo apt-get install nodejs

  • Time to install a newer version of Less via npm:

sudo npm install -g less less-plugin-clean-css

Install Updated Wkhtmltopdf Version

  • Switch to the /tmp/ directory: cd /tmp/

  • Download the recommended version of wkhtmltopdf for Odoo server, currently 0.12.1: sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

  • Install the package using dpkg: sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

  • To function properly we’ll need to copy the binaries to an adequate location:

    sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
    sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
    

Odoo Server Configuration

  • Copy the included configuration file to a more convenient location, changing its name to odoo-server.conf: sudo cp /opt/odoo/debian/openerp-server.conf /etc/odoo-server.conf

  • Next we need to modify the configuration file. The finished file should look similar to this depending on your deploying needs: File: /etc/odoo-server.conf

      [options]
      admin_passwd = admin
      db_host = False 
      db_port = False
      db_user = odoo
      db_password = <PostgreSQL_user_password>
      addons_path = /opt/odoo/addons
      logfile = /var/log/odoo/odoo-server.log
      xmlrpc_port = 8069
    
    • admin_passwd = admin This is the password that allows database operations.
    • db_host = False Unless you plan to connect to a different database server address, leave this line untouched.
    • db_port = False Odoo uses PostgreSQL default port 5432, change only if necessary.
    • db_user = odoo Database user, in this case we used the default name.
    • db_password = The previously created PostgreSQL user password.
    • addons_path = We need to modify this line to read: addons_path = /opt/odoo/addons. Add </path/to/custom/modules> if needed. We need to include the path to log files adding a new line: logfile = /var/log/odoo/odoo-server.log. Optionally we could include a new line specifying the Odoo Frontend port used for connection: xmlrpc_port = 8069. This only makes sense if you’re planning to run multiple Odoo instances (or versions) on the same server. For normal installation you could skip this line and Odoo will connect by default to port 8069.
@HagarAbouroumia
Copy link

How can i open vscode from a system user to create modules?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment