jueves, septiembre 04, 2014

Installing OpenERP 7 in Ubuntu Server 12.04 from launchpad

OpenERP
 Begin installing the necessary software to install 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
 
Create the OpenERP user:
sudo adduser openerp  --home=/opt/openerp 

Create the database and user openerp postgresql:

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

Install the OpenERP server:
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
 

Configuring the OpenERP server:
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
 
In the configuration file /etc/openerp-server.conf leave it at that:
[options]
; This is the password that allows database operations:
admin_passwd = <administrator-password>
db_host = False
db_port = False
db_user = openerp
db_list = False
db_password = <postgresql-password>
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 
 

Configuring the system for proper functioning of the 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

Auto Start OpenERP server, then:
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

Contents of file-server /etc/init.d/openerp:
#!/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
 
To start the server:
sudo /etc/init.d/openerp-server start 

 

OpenERP on port 80 and 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 

Apply updates

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>

Patching

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

 
Sources of information:
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


No hay comentarios: