Monday, March 14, 2011

Install OpenERP 6.0.1

I just finished installing OpenERP 6.0.1 at my Ubuntu Server 10.04 Server Edition 64 bit version. OpenERP is a software who can manage Enterprise Resource Planning. The good news, it's free.
I am so sorry, the appearance this article doesn't look good. 


Even openERP installer is available on Debian form, I found some error when installing it. After, Googling for 4 days, I found some tutorial that explain how to install.


Here's the steps. I got it from Google Docs, see reference number 1. I made a comment for what I did :




[How to] Installation OpenERP v6.x.x on Ubuntu server 10.04 LTS


Manual installation of the openerp-server and the openerp-web server (OpenERP v6.x.x) on the same
servermachine, with a fresh installed Ubuntu 10.0.4 LTS server (64 bit). Install only the openssh server,
make no serversystem updates after the server installation.
The result of this installation is an automatic boot-up of the OpenERP servers (application and webserver).
The Ubuntu user must have root rights.


Installation of dependencies and postgresql
sudo addgroup openerp
sudo adduser --ingroup openerp openerp
# password = test1234 --> I did with another password


sudo apt-get install postgresql (installs postgresql 8.4)
sudo su - postgres
createuser --createdb --no-createrole --pwprompt openerp
#password test1234
Shall the new role be a superuser? (y/n) n
exit


sudo apt-get install python-psycopg2 python-reportlab python-imaging python-egenix-mxdatetime python-tz python-pychart python-pydot python-lxml python-vobject python-yaml python-profiler python-setuptools python-mako graphviz python-dev build-essential sudo easy_install PyYaml --> use with only 1 line


Installation of Openerp-server
cd /home/openerp
sudo wget http://www.openerp.com/download/stable/source/openerp-server-6.0.1.tar.gz
sudo tar zxvf openerp-server-6.0.1.tar.gz


cd /home/openerp/openerp-server-6.0.1
sudo python setup.py install
su openerp
cd /home/openerp/openerp-server-6.0.1
openerp-server -s (This starts up the server and also creates a configuration file ".openerp_serverrc" in the directory /home/openerp)


You must see something like this:
[2011-01-29 18:25:21,645][?] INFO:server:OpenERP version - 6.0.1
[2011-01-29 18:25:21,646][?] INFO:server:addons_path - /usr/local/lib/python2.6/dist-packages/openerp-server/addons
[2011-01-29 18:25:21,646][?] INFO:server:database hostname - localhost
[2011-01-29 18:25:21,646][?] INFO:server:database port - 5432
[2011-01-29 18:25:21,646][?] INFO:server:database user - openerp
[2011-01-29 18:25:21,646][?] INFO:server:initialising distributed objects services
[2011-01-29 18:25:21,829][?] INFO:web-services:starting HTTP service at 0.0.0.0 port 8069
[2011-01-29 18:25:21,830][?] INFO:web-services:starting HTTPS service at 0.0.0.0 port 8071
[2011-01-29 18:25:21,830][?] INFO:web-services:Registered XML-RPC over HTTP
[2011-01-29 18:25:21,831][?] INFO:web-services:starting NET-RPC service at 0.0.0.0 port 8070
[2011-01-29 18:25:21,831][?] INFO:server:Starting 3 services
[2011-01-29 18:25:21,833][?] INFO:server:OpenERP server is running, waiting for connections...


Control C (to shut down the openerp-server)
exit


Installation of the Openerp-server daemon
sudo vi /etc/init.d/openerp-server (create a new file)
Copy-paste these lines :


#! /bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $syslog


# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenERP Server - the server
# Description: OpenERP is a complete ERP and CRM software
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC=openerp-server
NAME=openerp-server
DAEMON=/usr/local/bin/openerp-server
# Specify the user name (Default: openerp).
USER="openerp"
# Specifty an alternate config file (Default: ~/.openerp_serverrc)
CONFIGFILE="/home/openerp/.openerp_serverrc"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon
DAEMON_OPTS="-c $CONFIGFILE"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
# function that starts the daemon/service
#
if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then
do_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
#
# Function that stops the daemon/service
do_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
else
do_start() {
$DAEMON $DAEMON_OPTS > /dev/null 2>&1 &


RETVAL=$?
sleep 5 # wait for few seconds
echo $! > $PIDFILE # create pidfile
return $RETVAL
}
do_stop() {
pid=`cat $PIDFILE`
kill -15 $pid
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
if [ -f $PIDFILE ]; then
do_stop
fi
do_start
return $?
}
fi
start_daemon() {
if [ -f $PIDFILE ]; then
echo "pidfile already exists: $PIDFILE"
exit 1
fi
echo -n "Starting $DESC: "
do_start
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
stop_daemon() {
checkpid
if [ $? -eq 1 ]; then
exit 0
fi
echo -n "Stopping $DESC: "
do_stop
if [ $? -eq 1 ]; then
echo "failed."
exit 1
fi
echo "done."
}
restart_daemon() {
echo -n "Reloading $DESC: "
do_restart
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
status_daemon() {


echo -n "Checking $DESC: "
checkpid
if [ $? -eq 1 ]; then
echo "stopped."
else
echo "running."
fi
}
case "$1" in
start) start_daemon ;;
stop) stop_daemon ;;
restart|force-reload) restart_daemon ;;
status) status_daemon ;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
# vim: sts=4 st=4 et


sudo chmod +x /etc/init.d/openerp-server
sudo mkdir /var/log/openerp
sudo touch /var/log/openerp/openerp-server.log
sudo chown -R openerp:openerp /var/log/openerp/
sudo update-rc.d openerp-server defaults


su openerp
cd /home/openerp
vi .openerp_serverrc
Change:
[options]
without_demo = False
smtp_port = 25
db_password = test1234 --> the openerp password that we've created before
xmlrpcs_interface =
syslog = False
logrotate = True
xmlrpcs_port = 8071
test_report_directory = False
list_db = True
xmlrpc_interface =
timezone = False
cache_timeout = 100000
smtp_password = False
secure_pkey_file = server.pkey
xmlrpc_port = 8069
log_level = info
test_disable = False
admin_passwd = admin
assert_exit_level = error
smtp_server = localhost
static_http_url_prefix = None
test_commit = False
xmlrpcs = True
demo = {}
login_message = False
import_partial =
pidfile = None
db_maxconn = 64
stop_after_init = False
test_file = False
reportgz = False
xmlrpc = True
netrpc_port = 8070
db_port = 5432
db_name = False
debug_mode = False
netrpc = True
secure_cert_file = server.cert
logfile = /var/log/openerp/openerp-server.log
csv_internal_sep = ,
pg_path = None
static_http_enable = False
translate_modules = ['all']
smtp_ssl = False
root_path = /usr/local/lib/python2.6/dist-packages/openerp-server
netrpc_interface =
smtp_user = False
db_user = openerp --> No quote mark
db_host = localhost
email_from = False
addons_path = /usr/local/lib/python2.6/dist-packages/openerp-server/addons
static_http_document_root = None


exit
sudo chmod 777 /usr/local/lib/python2.6/dist-packages/openerp-server/addons
sudo /etc/init.d/openerp-server start
sudo /etc/init.d/openerp-server status (it must say: running)


Installing Openerp-web
cd /home/openerp
sudo wget http://www.openerp.com/download/stable/source/openerp-web-6.0.1.tar.gz
sudo tar zxvf openerp-web-6.0.1.tar.gz
cd /home/openerp/openerp-web-6.0.1
sudo python setup.py install (this installation takes a while)


./openerp-web.py (start server for testing)


You must see something like this:
[29/Jan/2011:19:37:37] ENGINE Bus STARTING
[29/Jan/2011:19:37:37] ENGINE Started monitor thread '_TimeoutMonitor'.
[29/Jan/2011:19:37:37] ENGINE Started monitor thread 'Autoreloader'.
[29/Jan/2011:19:37:37] ENGINE Serving on 0.0.0.0:8080
[29/Jan/2011:19:37:37] ENGINE Bus STARTED


Control C (to shut down the openerp-web server).


Installation of the Openerp-web daemon
sudo mkdir /usr/local/bin/openerp
sudo vi /usr/local/bin/openerp/openerp-web
Copy-paste:


#!/bin/sh
cd /home/openerp/openerp-web-6.0.1
exec /usr/bin/python ./openerp-web.py $@


sudo chmod +x /usr/local/bin/openerp/openerp-web
sudo vi /etc/init.d/openerp-web (create a new file)


Copy-paste:


#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-web
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2345
# Default-Stop: 016
# Short-Description: OpenERP Web - the Web Client of the OpenERP
# Description: OpenERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin/openerp
DAEMON=/usr/local/bin/openerp/openerp-web
NAME=openerp-web
DESC=openerp-web
# Specify the user name (Default: openerp).
USER="openerp"
# Specify an alternate config file (Default: /etc/openerp-web.cfg).
CONFIGFILE="/etc/openerp-web.cfg"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon
DAEMON_OPTS="-c $CONFIGFILE"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
# function that starts the daemon/service
#
if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then
do_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
#
# Function that stops the daemon/service
do_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS


RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
else
do_start() {
$DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
RETVAL=$?
sleep 5 # wait for few seconds
echo $! > $PIDFILE # create pidfile
return $RETVAL
}
do_stop() {
pid=`cat $PIDFILE`
kill -15 $pid
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
if [ -f $PIDFILE ]; then
do_stop
fi
do_start
return $?
}
fi
start_daemon() {
if [ -f $PIDFILE ]; then
echo "pidfile already exists: $PIDFILE"
exit 1
fi
echo -n "Starting $DESC: "
do_start
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
stop_daemon() {
checkpid
if [ $? -eq 1 ]; then
exit 0
fi
echo -n "Stopping $DESC: "
do_stop
if [ $? -eq 1 ]; then
echo "failed."
exit 1
fi
echo "done."
}
restart_daemon() {
echo -n "Reloading $DESC: "
do_restart
checkpid
if [ $? -eq 1 ]; then


rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
status_daemon() {
echo -n "Checking $DESC: "
checkpid
if [ $? -eq 1 ]; then
echo "stopped."
else
echo "running."
fi
}
case "$1" in
start) start_daemon ;;
stop) stop_daemon ;;
restart|force-reload) restart_daemon ;;
status) status_daemon ;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
# vim: sts=4 st=4 et


sudo chmod +x /etc/init.d/openerp-web
sudo chmod 777 /home/openerp/openerp-web-6.0.1/addons
sudo cp /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.1-py2.6.egg/doc/openerp-web.cfg /etc/
sudo vi /etc/openerp-web.cfg
Change:


log.access_file = "/var/log/openerp-web/access.log"
log.error_file = "/var/log/openerp-web/error.log"


sudo mkdir -p /var/log/openerp-web
sudo touch /var/log/openerp-web/access.log
sudo touch /var/log/openerp-web/error.log
sudo chown -R openerp:openerp /var/log/openerp-web/
sudo update-rc.d openerp-web defaults
sudo /etc/init.d/openerp-web start


Browser interface


Type in your browser:
http://ipaddressserver:8080
You must see a login screen; create first a database.


[ End How to]


-------
Q&A
-------

  • If you found error about cherrypy said that  "ImportError: cannot import name as_dict" you must downgrade the version of cherrypy. It still use version 3.1.2 meanwhile the installation will install version 3.2.0



Here's the step how to downgrade it :



   easy_install -m cherrypy
   sudo rm /usr/local/lib/python2.6/dist-packages/CherryPy-3.2.0-py2.6.egg/
   easy install cherrypy==3.1.2


  • If you found error like this

[2011-03-14 12:05:47,843][template1] ERROR:db.connection_pool:Connection to the database failed
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/openerp-server/sql_db.py", line 303, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
OperationalError: FATAL:  password authentication failed for user ""openerp""
FATAL:  password authentication failed for user ""openerp""

You need to make sure that at .openerp-serverrc file, db_user = openerp --> without quote mark




Reference :


  1. From Google Docs
  2. Another document from Google Docs
  3. http://brunogirin.blogspot.com/2010/05/installing-openerp-on-ubuntu-1004-lts.html
  4. http://doc.openerp.com/v6.0/book/1/1_1_Inst_Config/1_1_Inst_Config_install.html#installation-of-an-openerp-web-server
  5. http://doc.openerp.com/v6.0/install/linux/server/index.html
  6. http://powerphil.wordpress.com/2011/01/28/how-to-install-and-configure-an-openerp-6-0-1-server-and-web-server-on-an-ubuntu-10-10-server/
  7. http://www.openerp.com/forum/topic23011.html
  8. http://www.openerp.com/forum/topic22157.html
Post a Comment