Step 1. Build your server
install the openssh-server package (so we can connect to it remotely) and denyhosts to add a degree of brute-force attack protection
sudo apt-get install openssh-server denyhosts
Now make sure your server has all the latest versions & patches by doing an update:
sudo apt-get update
sudo apt-get dist-upgrade
Step 2. Create the OpenERP user that will own and run the application
sudo adduser –system –home=/opt/openerp –group openerp
Now run command
sudo su – openerp -s /bin/bash
This will change your current terminal login to openerp user.
Now you can leave the openerp user’s shell by typing exit.
Step 3. Install and configure the database server ( PostgreSQL )
sudo apt-get install postgresql
First change to the postgres user by typing
sudo su – postgres
Now create a new database user.This is so OpenERP has access rights to connect to PostgreSQL and to create and drop databases. Remember what your choice of password is here you will need it later on:
createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt openerp
Enter password for new role: ********
Enter it again: ********
Finally exit from the postgres user account:
exit
Step 4. Install the necessary Python libraries for the server
sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata \
python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \
python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing \
python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \
python-webdav python-werkzeug python-xlwt python-yaml python-zsi
Step 5. Install the OpenERP server
Download the latest version of the application:
wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.tar.gz
Now install the code where we need it
cd /opt/openerp
sudo tar xvf ~/openerp-7.0-latest.tar.gz
(In place of ‘~’ write the path where you have downloaded openerp latest version. If it is root then above commant is right.)
Next we need to change the ownership of all the the files to the OpenERP user and group we created earlier.
sudo chown -R openerp: *
And finally, the way I have done this is to copy the server directory to something with a simpler name so that the configuration files and boot scripts don’t need constant editing
sudo cp -a openerp-7.0 server
(name openerp-7.0 may differ. Just type the name of folder you untar under /opt/openerp)
Step 6. Configuring the OpenERP application
The default configuration file for the server (in /opt/openerp/server/install/
) is actually very minimal and will, with only one small change work fine so we’ll simply copy that file to where we need it and change it’s ownership and permissions:
sudo cp /opt/openerp/server/install/openerp-server.conf /etc/
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf
The above commands make the file owned and writeable only by the openerp user and group and only readable by openerp and root.
Now open file openerp-server
sudo nano /etc/openerp-server.conf
Toward to the top of the file change the line db_password = False to the same password you used back in step 3.
Also add a line at the end of same file
logfile = /var/log/openerp/openerp-server.log
Once the configuration file is edited and saved, you can start the server just to check if it actually runs.
sudo su – openerp -s /bin/bash
/opt/openerp/server/openerp-server
If you end up with a few lines eventually saying OpenERP is running and waiting for connections then you are all set.
enter “ctrl+c” to stop the server and then “exit” to leave the openerp user account and go back to your own shell.
Step 7. Installing the boot script
For the final step we need to install a script which will be used to start-up and shut down the server automatically and also run the application as the correct user.There is a script you can use in /opt/openerp/server/install/openerp-server.init
but this will need a few small modifications to work with the system installed the way I have described above.
Now we will make a file in /etc/init.d with name openerp-server.So type:
sudo nano /etc/init.d/openerp-server
This will open an empty file openerp-server.Copy below code
#!/bin/sh ### BEGIN INIT INFO # Provides: openerp-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: Enterprise Resource Management software # Description: Open ERP is a complete ERP and CRM software. ### END INIT INFO PATH=/bin:/sbin:/usr/bin DAEMON=/opt/openerp/server/openerp-server NAME=openerp-server DESC=openerp-server # Specify the user name (Default: openerp). USER=openerp # Specify an alternate config file (Default: /etc/openerp-server.conf). CONFIGFILE="/etc/openerp-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
to openerp-server file and save this file.Once it is in the right place you will need to make it executable and owned by root:
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
In the configuration file there’s an entry for the server’s log file. We need to create that directory first so that the server has somewhere to log to and also we must make it writeable by the openerp user:
sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp
Step 8. Testing the server
To start the OpenERP server type:
sudo /etc/init.d/openerp-server start
If everything above seems to be working OK then your server will be started and you can check it here in your browser:
http://IP_or_domain.com:8069
Now it’s time to make sure the server stops properly too:
sudo /etc/init.d/openerp-server stop