Mostrando entradas con la etiqueta postgresql. Mostrar todas las entradas
Mostrando entradas con la etiqueta postgresql. Mostrar todas las entradas

lunes, septiembre 02, 2013

Instalación de OpenERP 7 en Ubuntu Server 12.04 desde launchpad

OpenERP
Comenzaremos instalando el software necesario para poder instalar OpenERP:

sudo apt-get install graphviz ghostscript postgresql-client \
python-dateutil python-feedparser python-matplotlib \
python-ldap python-libxslt1 python-lxml python-mako \
python-openid python-psycopg2 python-pybabel python-pychart \
python-pydot python-pyparsing python-reportlab python-simplejson \
python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-imaging postgresql bzr
 
sudo apt-get install python-dev mc python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools python-psutil python-paramiko poppler-utils \
python-pdftools antiword  

wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.tar.gz 
tar zxvf gdata-2.0.17.tar.gz 
cd gdata-2.0.17/
sudo python setup.py install
 
Creamos el usuario de openerp:
sudo adduser openerp  --home=/opt/openerp 

Creamos la base de datos y usuario de openerp en postgresql:

sudo passwd postgres
su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
exit

Instalamos el servidor de openERP: 
su - openerp 
mkdir v7
cd v7
bzr branch lp:openerp-web/7.0 web
bzr branch lp:openobject-server/7.0 server
bzr branch lp:openobject-addons/7.0 addons
bzr branch lp:openerp-spain/7.0    
exit
 

Configuración del servidor openERP:
sudo cp /opt/openerp/v7/server/install/openerp-server.conf /etc/openerp-server.conf
sudo chown openerp.openerp /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf 
sudo nano /etc/openerp-server.conf
 
En el fichero de configuración /etc/openerp-server.conf lo dejamos así:
[options]
; This is the password that allows database operations:
admin_passwd = <clave-administrador>
db_host = False
db_port = False
db_user = openerp
db_list = False
db_password = <nuestra-clave-de-base-datos-postgresql>
addons_path = /opt/openerp/v7/addons,/opt/openerp/v7/web/addons,/opt/openerp/v7/7.0
;Log settings
logfile = /var/log/openerp/openerp-server.log
log_level = error 

Configurando el sistema para el correcto funcionamiento del log:


sudo mkdir /var/log/openerp
sudo chown openerp.root /var/log/openerp
sudo cp /opt/openerp/v7/server/install/openerp-server.logrotate /etc/logrotate.d/openerp-server
sudo chmod 755 /etc/logrotate.d/openerp-server

Inicio automático del servidor de openERP, para ello: 
sudo touch  /etc/init.d/openerp-server
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
sudo update-rc.d openerp-server defaults
sudo nano /etc/init.d/openerp-server
Contenido del fichero /etc/init.d/openerp-server : 
#!/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/v7/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
 
Para iniciar el servidor:
sudo /etc/init.d/openerp-server start 

 

OpenERP en el puerto 80 y 443

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8069
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8070
iptables-save 

Aplicar actualizaciones

sudo /etc/init.d/openerp-server stop
sudo su openerp
cd /opt/openerp/v7/addons/
bzr pull
cd /opt/openerp/v7/web/
bzr pull
cd /opt/openerp/v7/7.0/
bzr pull
cd /opt/openerp/v7/server/
bzr pull

./openerp-server -c /etc/openerp-server.conf -u all -d <base-de-datos>

Aplicar parches

cd /opt/openerp/v7/addons/
bzr patch <url-al-parche>

 
Fuentes de información:
http://help.openerp.com/question/2562/how-to-install-openerp-v70-on-ubuntu-1204-from-launchpad-repository/ 
http://www.theopensourcerer.com/2012/12/how-to-install-openerp-7-0-on-ubuntu-12-04-lts/ 
http://huber.salazarcarlos.com/?p=23