openerp v7 - editado

14
OpenERP V7.0 installation Update apt source list sudo apt-get update Download and install updates sudo apt-get upgrade install required packages for 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 install some other packages that we will probably need in future sudo apt-get install gcc python-dev mc bzr 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 make python-psutil python-paramiko poppler-utils \ python-pdftools antiword postgresql

Upload: patrick-dawson

Post on 22-Nov-2015

17 views

Category:

Documents


1 download

TRANSCRIPT

OpenERP V7.0 installation

Update apt source listsudo apt-get updateDownload and install updatessudo apt-get upgradeinstall required packages for openerpsudo 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-imaginginstall some other packages that we will probably need in futuresudo apt-get install gcc python-dev mc bzr 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 make python-psutil python-paramiko poppler-utils \python-pdftools antiword postgresqlinstall gdata client(since ubuntu package is old we download and install from source)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

Alterando senha inicial do PostgreSQL [Ubuntu]Ao realizar a instalao doPostgreSQLme deparei com a seguinte questo: para me conectar ao banco era necessrio utilizar uma senha, mas que senha essa? Fiz algumas buscas e descobri que necessrio alterar esta senha aps a instalao. Os comandos so bem simples.

Primeiramente vamos alterar a senha do usurio postgres:

$ sudo passwd postgres

Aps executar o comando aparecero as seguintes mensagens:

Digite a nova senha UNIX: Redigite a nova senha UNIX:

Digite a sua senha e redigite a mesma em seguida. Feito isso, iremos logar com o usurio postgres.

$ su postgres

A senha que ser exigida a mesma que acabamos de alterar.

Agora vamos alterar a senha para conectar ao banco.

Este comando para a verso 7 ou superior:

$ psql -c "ALTER USER postgres WITH PASSWORD 'nova_senha'" -d template1

Onde nova_senha ser a senha que voc deseja.

Pronto, agora voc pode realizar a conexo no seu banco de dados perfeitamente.Configurando o PostgreSQL para Acesso Remoto (etapa opcional)

A configurao que faremos a seguir permitir que qualquer mquina da sua rede ou de fora acessem o banco de dados. Esta configurao muito til para a instalao e testes do OpenERP, mas antes de colocar o sistema em produo bom retornar aqui e controlar quais mquinas podero ter acesso ao sistema.

Vamos agora editar o famoso arquivo pg_hba.conf. No esquea que X.Y deve ser trocado pela sua verso de PostgreSQL

Antes de mais nada, faa um backup do arquivo

sudo cp /etc/postgresql/X.Y/main/pg_hba.conf /etc/postgresql/X.Y/main/pg_hba_bk.conf

Depois abra o editor

sudo pico /etc/postgresql/X.Y/main/pg_hba.conf

Com o comando acima voc ir entrar no editor de textos pico. Se o pico no funcionar em seu sistema, tente o nano. Use as setas do teclado para se movimentar pelo texto. Sero trs alteraes neste arquivo:

I) Vamos configurar o acesso administrativo ao banco de dados. Procure (quase no fim do arquivo) as seguintes linhas:

# Database administrative login by UNIX sockets local all postgres ident

Nas verses mais novas ao invs de "ident" voc vai encontrar "peer"

Troque postgres por all, e ident ou "peer" por trust, para que fique assim:

local all all trust

II) Vamos configurar o acesso local ao banco de dados. Procure as linhas a seguir:

# "local" is for Unix domain socket connections only local all all ident

Troque o ident por trust, para que fique assim:

local all all trust

III) Vamos configurar o acesso remoto (atravs de IP v4). Procure as linhas:

# IPv4 local connections: host all all127.0.0.1/32md5

Troque 127.0.0.1/32 por 0.0.0.0/0, e md5 por trust, para que fique assim:

host all all0.0.0.0/0trust

Tecle Ctrl O seguido de ENTER para salvar as modificaes no arquivo. Saia do pico teclando Ctrl X.

Agora vamos configurar o arquivo postgresql.conf:

Faa um backup do arquivo

sudo cp /etc/postgresql/X.Y/main/postgresql.conf /etc/postgresql/X.Y/main/postgresql_bk.conf

sudo pico /etc/postgresql/X.Y/main/postgresql.conf

Procure a linha:

#listen_addresses = 'localhost'

Retire o #, e troque localhost por *, para que fique assim:

listen_addresses = '*'

Tecle Ctrl O seguido de ENTER para salvar as modificaes no arquivo. Saia do pico teclando Ctrl X.

create a new openerp system user for openerp and other related processessudo adduser openerp --home /opt/openerpCreate database user for openerpcd ..sudo -u postgres createuser -s openerpmove to the install directorysudo su openerpmkdir /opt/openerp/v7cd /opt/openerp/v7

Login Launchpad

1 Criar conta no launchpad.net

2 Criar chave ssh pelo terminal:sudo apt-get install openssh-clientssh-keygen -t rsa

3 - achar o arquivo criado. Copiar o cdigo rsa gerado e colar no campo especfico do launchap.

5 - install bazaaryes | sudo apt-get install bzryes | sudo apt-get install bzrtools

4 loga no launchpad via terminal:bzr launchpad-login nomedadopelolaunchpadrun the bazaar to download the latest revision from launchpad(this will take long if an error occurs just rerun command)bzr branch lp:openerp-web/7.0 web(this will take longer if an error occurs just rerun command)bzr branch lp:openobject-server/7.0 server(this will take much more longer if an error occurs just rerun last command)bzr branch lp:openobject-addons/7.0 addons(this will take much more longer if an error occurs just rerun last command)bzr branch lp:~account-payment-team/account-payment/7.0/ account-payment(this will take much more longer if an error occurs just rerun last command)bzr branch lp:~account-core-editors/openerp-fiscal-rules/7.0/ fiscal-rules(this will take much more longer if an error occurs just rerun last command)bzr branch lp:~openerp-brazil-core-team/openerp.pt-br-localiz/openerp.pt-br-localiz-v7.0/ brIt would be nice if you check if the downloaded revision no pass the tests fromhttp://runbot.openerp.com

Iniciando pela primeira vezcd /opt/openerp/v7/server./openerp-server --db_host=False --db_user=openerp --db_password=False --addons-path=/opt/openerp/v7/addons,/opt/openerp/v7/web/addons,/opt/openerp/v7/account-payment,/opt/openerp/v7/fiscal-rules,/opt/openerp/v7/br --config=openerp-server.conf --save

Exit from openerp and user shellCtrl+Cexit

Copy OpenERP configuration file to /etcsudo cp /opt/openerp/v7/server/openerp-server.conf /etc/openerp-server.confChange the file permissions and file ownership to the openerp user.sudo chown openerp: /etc/openerp-server.confsudo chmod 640 /etc/openerp-server.confCreate log directory for openerpsudo mkdir /var/log/openerpsudo chown openerp:root /var/log/openerpCopy Logrotate file from source to /etc/logrotate.d foldersudo cp /opt/openerp/v7/server/install/openerp-server.logrotate /etc/logrotate.d/openerp-serversudo chmod 755 /etc/logrotate.d/openerp-serverRun the serversudo su openerpcd /opt/openerp/v7/server/./openerp-server -c /etc/openerp-server.conf &test your installation from http://yourserverIP:8069 you should see screen below.

Starting Server Up AutomaticallyAfter playing with init script in source I decided to useOpen Sourcerer'sinit script since it is clean and nice. You can download the original from:http://www.theopensourcerer.com/wp-content/uploads/2012/12/openerp-serverWe just need to change the location of the daemon. below is the init script you can copy paste this to the file.#!/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/binDAEMON=/opt/openerp/v7/server/openerp-serverNAME=openerp-serverDESC=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"

# pidfilePIDFILE=/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 0You can download this edited copy with the following commandFirst Exit from openerp users shellexitsudo nano /etc/init.d/openerp-serverMake the init script executable.sudo chmod +x /etc/init.d/openerp-serversudo chmod 755 /etc/init.d/openerp-serversudo chown root: /etc/init.d/openerp-serverAdd openerp-server to system startupsudo update-rc.d openerp-server defaultsRestart the server to check if init script workssudo shutdown -r nowAfter restart you should be able to connect to the server via http://yourip:8069Notes:1. Used some parts from this nice tutorial:http://www.theopensourcerer.com/2012/12/how-to-install-openerp-7-0-on-ubuntu-12-04-lts/2. I tested above commands with a clean ubuntu 12.04 install and OpenERP works as expected.To update this installation to the latest revisionsudo /etc/init.d/openerp-server stopsudo su openerpcd /opt/openerp/v7/addons/bzr pullcd /opt/openerp/v7/web/bzr pullcd /opt/openerp/v7/server/bzr pullIt would be nice if you check if the downloaded revision no pass the tests ofhttp://runbot.openerp.comYou should run the server with your database name and update your database with the following command../openerp-server -c /etc/openerp-server.conf -u all -d YOURDATABASENAMETo Apply a PatchTo apply a patch you should have a patch file or URL of the patch file.Cd to the project folder (addons,web,server etc). apply patch with bzr commandbzr patch.to apply a patch to the addons branch:cd /opt/openerp/v7/addons/bzr patch PATCH_FILE_NAME_OR_URLTo install an additional independent V7 test server on the same OSOn production you would need to test some code changes or patches or some new modules. To be able to test without risking your production server a test server is a good idea. Best option is to have a virtual machine with openerp installed. However if you like to have an seperate openerp setup.coming...Notes:Why 64 bit not 32I am using an x64 version of ubuntu because my server has more than 4GB of RAM. And 64 is bigger than 32 :)"Unless you have specific reasons to choose 32-bit, we recommend 64-bit to utilise the full capacity of your hardware."https://help.ubuntu.com/community/32bit_and_64bityou can read related article.openerp userMy openerp user is just a normal user (not a system user) who can login to the system. I choose to have it this way since I login as openerp user and do required tasks with this uid. You should select a secure password.Some Linux experts thinks this is not secure enough, keep in mind.Postgresql openerp roleopenerp postgresql role is superuser in my installation, it is not required to but it is easier for me.Some Linux experts thinks this is not secure enough, keep in mind.init.d script for autostartI just found out that there is also a suitable init.d script for debian already "hidden" :) in the source of OpenERP server in the file/opt/openerp/v7/server/debian/openerp.inityou can change the pathnames and use this file also.Please give your feedback about instructions above so I can enhance it.