Installing Odoo 10.0
On Ubuntu16.04 LTS
Start by updating the server and add user for the server to run
# update the system
apt-get update && sudo apt-get update && sudo apt-get dist-upgrade
# add system user to run the server
sudo adduser --system --home=/opt/odoo --group odoo
# you will need to specify the shell to switch to odoo user
sudo su - odoo -s /bin/bash
exit
Install PostgreSQL
# install postgres
apt-get install postgresql
# add postgres user
sudo su - postgres createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
exit
Install dependencies
sudo apt-get install python-cups python-dateutil python-decorator python-docutils python-feedparser \
python-gdata python-geoip python-gevent python-imaging python-jinja2 python-ldap python-libxslt1 \
python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 \
python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests \
python-simplejson python-tz python-unicodecsv python-unittest2 python-vatnumber python-vobject \
python-werkzeug python-xlwt python-yaml node-clean-css node-less xfonts-75dpi libgeoip1 libgeoip-dev geoip-bin
Install wkhtmltopdf
# for 64 bit systems, else you need to find the correct architecture package
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo apt-get install xfonts-base
sudo apt-get -f install
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
Install GIT and clone the server code
sudo apt-get install git
sudo su - odoo -s /bin/bash
git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch v10
exit
Set the configuration file
# copy the default configuration file
sudo cp /opt/odoo/v10/debian/odoo.conf /etc/odoo-server.conf
# set correct permissions and access
sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
Change the configuration file
# uncomment and set a really strong password --VERY IMPORTANT--
; admin_passwd = RealllyStrongAndLongPasswordWithCharsAndNumbersAndSymbold
# add the following lines
logfile = /var/log/odoo/odoo-server.log
no_database_list = True
xmlrpc_interface = 127.0.0.1
logrotate = True
proxy_mode = True
Add the service file
sudo nano /etc/init.d/odoo-server
Paste the following content
#!/bin/sh
### BEGIN INIT INFO
# Provides: odoo-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Complete Business Application software
# Description: Odoo is a complete suite of business tools.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/opt/odoo/v10/odoo-bin
NAME=odoo-server
DESC=odoo-server
# Specify the user name (Default: odoo).
USER=odoo
# Specify an alternate config file (Default: /etc/odoo-server.conf).
CONFIGFILE="/etc/odoo-server.conf"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0[ -f $CONFIGFILE ] || exit 0
checkpid() { [ -f $PIDFILE ] || return 1 pid=`cat $PIDFILE` [ -d /proc/$pid ] && return 0 return 1}
case "${1}" in
start)
echo -n "Starting ${DESC}: "
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "${NAME}."
;;
stop)
echo -n "Stopping ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo
echo "${NAME}."
;;
restart|force-reload)
echo -n "Restarting ${DESC}: "
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
--oknodo sleep 1
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_OPTS}
echo "${NAME}."
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Add correct permissions and access to service and create log folder
sudo chmod 755 /etc/init.d/odoo-server
sudo chown root: /etc/init.d/odoo-server
# create the folder to place the log files
sudo mkdir /var/log/odoo
sudo chown odoo:root /var/log/odoo
Start the service file
sudo /etc/init.d/odoo-server start
Check the log for entries (q to quit)
less /var/log/odoo/odoo-server.log
Add startup to the service
sudo update-rc.d odoo-server defaults
Install NGINX
sudo apt-get install nginx
Add NGINX configuration file
sudo nano /etc/nginx/sites-available/odoo-server
Add the folowing code:
# set the upstream servers
upstream odoosrv1 {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoolong1 {
server 127.0.0.:8072 weight=1 fail_timeout=0;
}
server {
listen 80;
server_name www.odooclass.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location /longpolling {
proxy_pass http://odoolong1;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# by default, do not forward anything
proxy_redirect off;
}
# cache some static data in memory for 60mins.
location ~* ^/(openerp|openobject|web)/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoosrv1;
}
location / {
proxy_pass http://odoosrv1;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# by default, do not forward anything
proxy_redirect off;
}
}