Usando Linux para muchas cosas y disfrutando de videojuegos, en dispositivos moviles, consolas y pc. Using Linux for many things and enjoying video games, mobile devices, consoles and pc

Como instalar y configurar OpenERP virtual paso a paso

Hoy les mostrare como instalar OpenERP en un Ubuntu server 10.04 virtualizado con openvz en nuestro server Proxmox. Todo lo haremos desde la cuenta root y usaremos la modalidad de acceso via web a este software.

Requerimientos:
Ubuntu 10.04
ip: 192.168.1.35
OpenERP Server 6.0.3
Open ERP web 6.0.3

-Creamos un usuario sin privilegios
adduser --system --home=/opt/openerp --group openerp

-Instalamos pgsql
apt-get install postgresql

-Cambiamos al user de pgsql para configurar el usuario de openerp
su - postgres

createuser --createdb --username postgres --no-createrole --pwprompt openerp
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) y

exit

-Instalamos librerías de python

apt-get install python python-psycopg2 python-reportlab python-egenix-mxdatetime python-tz python-pychart python-mako python-pydot python-lxml python-vobject python-yaml python-dateutil python-pychart python-pydot python-webdav

-Librerías para cliente web
apt-get install python-cherrypy3 python-formencode python-pybabel python-simplejson python-pyparsing

-Descargamos openerp server
wget -c http://www.openerp.com/download/stable/source/openerp-server-6.0.3.tar.gz

-Descargamos el cliente web
wget -c http://www.openerp.com/download/stable/source/openerp-web-6.0.3.tar.gz

-Descomprimimos
tar xvf /root/openerp-server-6.0.3.tar.gz
tar xvf /root/openerp-web-6.0.3.tar.gz

-Cambiamos atributos
chown -R openerp: *

ls -la
total 16
drwxr-xr-x  4 openerp openerp 4096 Mar  5 17:22 .
drwxr-xr-x  3 root    root    4096 Mar  5 17:05 ..
drwxr-xr-x 10 openerp openerp 4096 Aug 18  2011 openerp-server-6.0.3
drwxr-xr-x  9 openerp openerp 4096 Aug 18  2011 openerp-web-6.0.3

cp -a openerp-server-6.0.3 server
cp -a openerp-web-6.0.3 web

-Creamos el file de configuracion, colocamos en db_password la contraseña que hayamos puesto anteriormente
vi /etc/openerp-server.conf
[options]
; This is the password that allows database operations
; Will be written to by the server when password is changed
; !! Keep this file secure !!
; admin_passwd = admin
root_path = /opt/openerp/server/bin
without_demo = False
verbose = False
; Database settings
db_user = openerp
db_password = contraseña
; Please uncomment the following line *after* you have created the
; database. It activates the auto module check on startup.
; db_name = False
db_port = False
db_host = False
db_maxconn = 64
; Networking Settings
xmlrpc = True
xmlrpc_interface = 127.0.0.1
xmlrpc_port = 8069
netrpc = True
netrpc_interface = 127.0.0.1
netrpc_port = 8070
; Uncomment these for xml-rpc over SSL
xmlrpcs = True
xmlrpcs_interface =
xmlrpcs_port = 8071
secure_pkey_file = /etc/ssl/openerp/server.pkey
secure_cert_file = /etc/ssl/openerp/server.crt
; Log settings
logfile = /var/log/openerp/openerp-server.log
syslog = False
logrotate = True
log_level = info
; False prevents the client displaying the list of databases
list_db = True
addons_path = /opt/openerp/server/bin/addons
demo = {}
soap = False
reportgz = False
translate_modules = ['all']
; Static http parameters
static_http_enable = False
static_http_document_root = /var/www/html
static_http_url_prefix = /
; Outbound email configuration
;smtp_user = info@example.com
;email_from = "OpenERP Support" <info@example.com>
;smtp_port = 25
;smtp_password = ********
;smtp_ssl = True
[webdav]
enable = True
vdir = webdav

-Cambiamos permisos
chown openerp:root /etc/openerp-server.conf
chmod 640 /etc/openerp-server.conf

-Creamos el script de inicio
vi /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/server/bin/openerp-server.py
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

-Cambiamos permisos
chmod 755 /etc/init.d/openerp-server
chown root: /etc/init.d/openerp-server

-Creamos directorio de logs
mkdir /var/log/openerp
chown openerp:root /var/log/openerp

-Iniciamos el server
/etc/init.d/openerp-server start

-Verificamos este ok
cat /var/log/openerp/openerp-server.log
[2012-03-05 17:50:01,937][?] INFO:server:OpenERP version - 6.0.3
[2012-03-05 17:50:01,937][?] INFO:server:addons_path - /opt/openerp/server/bin/addons
[2012-03-05 17:50:01,937][?] INFO:server:database hostname - localhost
[2012-03-05 17:50:01,938][?] INFO:server:database port - 5432
[2012-03-05 17:50:01,938][?] INFO:server:database user - openerp
[2012-03-05 17:50:01,938][?] INFO:server:initialising distributed objects services
[2012-03-05 17:50:02,504][?] INFO:web-services:starting HTTP service at 0.0.0.0 port 8069
[2012-03-05 17:50:02,504][?] INFO:web-services:starting HTTPS service at 0.0.0.0 port 8071
[2012-03-05 17:50:02,505][?] INFO:web-services:Registered XML-RPC over HTTP
[2012-03-05 17:50:02,509][?] INFO:web-services:starting NET-RPC service at 0.0.0.0 port 8070
[2012-03-05 17:50:02,509][?] INFO:server:Starting 3 services
[2012-03-05 17:50:02,510][?] INFO:server:OpenERP server is running, waiting for connections...

-Activamos que ejecute al inicio
update-rc.d openerp-server defaults

-Configuramos el cliente web
cp /opt/openerp/web/doc/openerp-web.cfg /etc/openerp-web.conf

-Editamos
vi /etc/openerp-web.conf
server.socket_host = "127.0.0.1"
tools.proxy.on = True
tools.proxy.base = 'http://192.168.1.35'
tools.csrf.on = False
log.error_file = "/var/log/openerp/openerp-web-error.log"
Salimos guardando

-Cambiamos permisos
chown openerp:root /etc/openerp-web.conf
chmod 640 /etc/openerp-web.conf

-Creamos el script de inicio
vi /etc/init.d/openerp-web
#!/bin/sh

### BEGIN INIT INFO
# Provides:             openerp-web
# 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:    OpenERP Web - the Web Client of the OpenERP
# Description:          Open ERP is a complete ERP and CRM software.
### END INIT INFO

PATH="/sbin:/bin:/usr/sbin:/usr/bin"
DAEMON="/opt/openerp/web/openerp-web.py"
NAME="openerp-web"
DESC="openerp-web"

# Specify the user name (Default: openerp).
USER=openerp

# Specify an alternate config file (Default: /etc/openerp-web.conf).
CONFIGFILE="/etc/openerp-web.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

Salimos guardando

-Cambiamos permisos
chmod 755 /etc/init.d/openerp-web
chown root: /etc/init.d/openerp-web

-Ejecutamos el servicio
/etc/init.d/openerp-web start

-Verificamos conectandonos via firefox
http://192.168.1.35:8080/


-Activamos que ejecute al inicio
update-rc.d openerp-web defaults

-Activamos SSL para apache
a2enmod ssl proxy_http headers rewrite
cd
mkdir temp
cd temp

-Generamos un nuevo certificado
openssl genrsa -des3 -out server.pkey 1024
Generating RSA private key, 1024 bit long modulus
.............++++++
...............................++++++
e is 65537 (0x10001)
Enter pass phrase for server.pkey:
Verifying - Enter pass phrase for server.pkey:

-Evitando tener que colocar la contraseña cada vez que iniciemos apache
openssl rsa -in server.pkey -out server.key
Enter pass phrase for server.pkey:
writing RSA key

-Seguimos
openssl req -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CO
State or Province Name (full name) [Some-State]:Cundinamarca
Locality Name (eg, city) []:Bogota
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Compañia S.A
Organizational Unit Name (eg, section) []:Sistemas
Common Name (eg, YOUR name) []:Manuel Cabrera Caballero
Email Address []:mi-email@gmail.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:contraseña
An optional company name []:

-Terminamos de firmar
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

-Cambiamos permisos y copiamos
chown openerp:root server.crt server.key
chmod 640 server.crt server.key

mkdir /etc/ssl/openerp
chown openerp:root /etc/ssl/openerp
chmod 710 /etc/ssl/openerp
mv server.crt server.key /etc/ssl/openerp/

-Activamos el certificado en apache
vi /etc/apache2/sites-available/openerp-ssl
<VirtualHost *:443>
   SSLEngine on
   SSLCertificateFile /etc/ssl/openerp/server.crt
   SSLCertificateKeyFile /etc/ssl/openerp/server.key
   ProxyRequests Off
 <Proxy *>
   Order deny,allow
   Allow from all
 </Proxy>
   ProxyVia On
   ProxyPass /webdav/ http://127.0.0.1:8069/webdav/
 <Location /webdav/ >
   ProxyPassReverse /webdav/
 <Limit OPTIONS PROPFIND GET REPORT MKACTIVITY PROPPATCH PUT MOVE COPY DELETE LOCK UNLOCK>
   Order Deny,Allow
   Allow from all
   Satisfy Any
 </Limit>
 </Location>
   ProxyPass / http://127.0.0.1:8080/
 <location / >
   ProxyPassReverse /
 </location>
   RequestHeader set "X-Forwarded-Proto" "https"
   # Fix IE problem (httpapache proxy dav error 408/409)
   SetEnv proxy-nokeepalive 1
</VirtualHost>

Salimos guardando

a2ensite openerp-ssl

-Redireccionamos trafico web normal a SSL(colocar las lineas fuera de las clausulas <Directory> al final
vi /etc/apache2/sites-available/default
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]

Salimos guardando

-Reiniamos servicios
service openerp-server restart
service openerp-web restart
service apache2 restart

-Creamos la db desde el cliente web, nos conectamos via https desde firefox
https://192.168.1.35

-Damos click en el boton Databases y creamos una nueva db con una nueva contraseña para el usuario admin de esta db. La contraseña original es admin, la cual por seguridad debemos cambiar. Damos click en el boton Create

-Llegamos a una pagina donde nos dice que tenemos un usuario admin y un usuario demo, damos click en Empezar configuracion

-Proxima pagina, seleccionar Interfaz, dejamos la simplificada y damos click en Siguiente

-Proxima pagina, Informacion de la compañia, cambiamos los datos a nuestra necesidad, subimos el logo de la compañia y damos click en Siguiente

-Proxima pagina, Aplicaciones, podemos escoger o dejarlas desmarcadas para mas adelante instalarlas cuando las necesitemos, damos click en Saltar

Y con esto ya tenemos un server OpenERP listo para configurar segun nuestro negocio.


Si te resulto útil este articulo, se social, haz un tweet, compártelo con otros por medio de los botones o sígueme en twitter google+facebook o email y podrás estar enterado de todas mis publicaciones.
Disfrútenlo.

Share/Bookmark

No hay comentarios:

Publicar un comentario

Dejame un comentario, aprecio la retroalimentacion. Leave me a comment, I appreciate the feedback.