Outils personnels

OpenERP v6 - Installation sur Debian 6

De wikiGite

Remarque : A finir de valider lors d'une prochaine installation (notamment les droits dans Postgresql)

Facultatif

A exécuter en tant que root  :

dpkg-reconfigure locales
apt-get install -y mc vim sudo

Installation des pré-requis

(A exécuter en tant qu'utilisateur normal)

Paquets Requis :

  • python
  • postgresql
  • python-lxml
  • python-mako
  • python-egenix-mxdatetime
  • python-dateutil
  • python-psycopg2
  • python-pychart
  • python-pydot
  • python-tz
  • python-reportlab
  • python-yaml
  • python-vobject
  • python-setuptools
  • python-dev build-essential
sudo apt-get install <liste_des_paquets_séparés_par_un_espace>
sudo easy_install PyYaml
sudo easy_install mako

Création de l'utilisateur OpenERP

sudo adduser openerp --disabled-login --gecos OpenERP

Configuration de Postgresql

Création de l'utilisateur

sudo su - postgres
createuser openerp
Le nouveau rôle est-il super-utilisateur ? (o/n) n
Le nouveau rôle est-il autorisé à créer des bases de données ? (o/n) o
Le nouveau rôle est-il autorisé à créer de nouveaux rôles ? (o/n) n
sudo su postgres -c psql
ALTER USER openerp WITH PASSWORD 'openerp'
exit

Paramétrage des fichiers de configuration

sudo vim /etc/postgresql/8.4/main/pg_hba.conf

Remplacer ident par md5 :

# "local" is for Unix domain socket connections only

local all all md5

sudo vim /etc/postgresql/8.4/main/postgresql.conf

Remplacer localhost par * :

#listen_addresses = 'localhost' # what IP address(es) to listen on;

listen_addresses = '*' # what IP address(es) to listen on;

Téléchargement des fichiers d'installation d'OpenERP

sudo su - openerp
wget http://www.openerp.com/download/stable/source/openerp-server-6.0.2.tar.gz
wget http://www.openerp.com/download/stable/source/openerp-web-6.0.2.tar.gz
tar -zvxf openerp-server-6.0.2.tar.gz
tar -zvxf openerp-web-6.0.2.tar.gz
cd openerp-server-6.0.1
sudo python setup.py install
cd ..
cd openerp-web-6.0.1
sudo python setup.py install
cd ..

Lancement manuel des services

Attention : A lancer dans 2 terminaux différents

openerp-server --db_user=openerp --db_password=openerp
openerp-web

Paramétrage du démarrage automatique des services

sudo vim /etc/init.d/openerp-server

Contenu de /etc/init.d/openerp-server :

#!/bin/sh

### BEGIN INIT INFO
# Provides:        openerp-server
# Required-Start:    $syslog
# Required-Stop:    $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:        OpenERP is a complete ERP and CRM software.
### END INIT INFO
 
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/local/bin/openerp-server
NAME=openerp-server
DESC=openerp-server
USER=openerp

test -x ${DAEMON} || exit 0

set -e

case "${1}" in
start)
echo -n "Starting ${DESC}: "

start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- --config=/etc/openerp-server.conf

echo "${NAME}."
;;

stop)
echo -n "Stopping ${DESC}: "

start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
--oknodo

echo "${NAME}."
;;

restart|force-reload)
echo -n "Restarting ${DESC}: "

start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \
--oknodo

sleep 1

start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- --config=/etc/openerp-server.conf

echo "${NAME}."
;;

*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0
sudo chmod +x /etc/init.d/openerp-server
sudo mkdir -p /var/log/openerp
sudo touch /var/log/openerp/openerp.log
sudo chown -R openerp.root /var/log/openerp/
sudo vim /etc/openerp-server.conf

Contenu de /etc/openerp-server.conf :

[options]
without_demo = True
; This is the password that allows database operations:
; admin_passwd = admin
upgrade = False
verbose = False
netrpc = True
; netrpc_interface =
; netrpc_port =
xmlrpc = True
; xmlrpc_interface =
xmlrpc_port = 8069
db_host = False
db_port = False
; Please uncomment the following line *after* you have created the
; database. It activates the auto module check on startup.
; db_name = terp
db_user = openerp
db_password = openerp
; Uncomment these for xml-rpc over SSL
; secure = True
; secure_cert_file = /etc/openerp/server.cert
; secure_pkey_file = /etc/openerp/server.key
root_path = None
soap = False
translate_modules = ['all']
demo = {}
addons_path = None
reportgz = False

; Static http parameters
static_http_enable = False
static_http_document_root = /var/www/html
static_http_url_prefix = /root@openerp-cosmic:~#
sudo vim /etc/init.d/openerp-web

Contenu de /etc/init.d/openerp-web :

#!/bin/sh

### BEGIN INIT INFO
# Provides:             openerp-web
# Required-Start:       $syslog
# Required-Stop:        $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# 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
DAEMON=/usr/local/bin/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"

[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0

checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}

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
}

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
sudo chmod +x /etc/init.d/openerp-web
sudo vim /etc/openerp-web.cfg

Contenu de /etc/openerp-web.cfg :

[global]
server.environment = "development"

# Some server parameters that you may want to tweak
server.socket_host = "0.0.0.0"
server.socket_port = 8080

# Sets the number of threads the server uses
server.thread_pool = 10

tools.sessions.on = True
tools.sessions.persistent = False

# Simple code profiling
server.profile_on = False
server.profile_dir = "profile"

# if this is part of a larger site, you can set the path
# to the TurboGears instance here
#server.webpath = ""

# Set to True if you are deploying your App behind a proxy
# e.g. Apache using mod_proxy
#tools.proxy.on = True

# If your proxy does not add the X-Forwarded-Host header, set
# the following to the *public* host url.
#tools.proxy.base = '<a href="http://mydomain.com/" target="_blank">http://mydomain.com</a>'

# logging
#log.access_file = "/var/log/openerp-web/access.log"
#log.error_file = "/var/log/openerp-web/error.log"
log.access_level = "INFO"
log.error_level = "INFO"

# OpenERP tools
tools.nestedvars.on = True
# Set to false to disable CSRF checks
tools.csrf.on = True

# OpenERP Server
openerp.server.host = 'localhost'
openerp.server.port = '8070'
openerp.server.protocol = 'socket'
openerp.server.timeout = 450

# Web client settings
[openerp-web]
# filter dblists based on url pattern?
# NONE: No Filter
# EXACT: Exact Hostname
# UNDERSCORE: Hostname_
# BOTH: Exact Hostname or Hostname_

dblist.filter = 'NONE'

# whether to show Databases button on Login screen or not
dbbutton.visible = True

# will be applied on company logo
company.url = 
sudo update-rc.d openerp-web defaults
sudo update-rc.d openerp-server defaults

Création de la base de données et première connexion à OpenERP

Adresse : http://<adresse_ip>:8080

Administrateur :

admin / <mot_de_passe_défini_à_la_création_de_la_base>

Utilisateur Démo :

demo / demo