Você está na página 1de 11

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
install 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 do PostgreSQL me 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 all 127.0.0.1/32 md5

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

host all all 0.0.0.0/0 trust

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
processes
sudo adduser openerp --home /opt/openerp
Create database user for openerp
cd ..
sudo -u postgres createuser -s openerp
move to the install directory
sudo su openerp
mkdir /opt/openerp/v7
cd /opt/openerp/v7

Login Launchpad

1 Criar conta no launchpad.net

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

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

5 - install bazaar
yes | sudo apt-get install bzr
yes | sudo apt-get install bzrtools

4 loga no launchpad via terminal:
bzr launchpad-login nomedadopelolaunchpad

run 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/ br
It would be nice if you check if the downloaded revision no pass the tests
from http://runbot.openerp.com

Iniciando pela primeira vez
cd /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/acc
ount-payment,/opt/openerp/v7/fiscal-rules,/opt/openerp/v7/br --config=openerp-
server.conf --save

Exit from openerp and user shell
Ctrl+C
exit

Copy OpenERP configuration file to /etc
sudo cp /opt/openerp/v7/server/openerp-server.conf /etc/openerp-server.conf
Change the file permissions and file ownership to the openerp user.
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf
Create log directory for openerp
sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp
Copy Logrotate file from source to /etc/logrotate.d folder
sudo cp /opt/openerp/v7/server/install/openerp-server.logrotate
/etc/logrotate.d/openerp-server
sudo chmod 755 /etc/logrotate.d/openerp-server
Run the server
sudo su openerp
cd /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 Automatically
After playing with init script in source I decided to use Open Sourcerer's init
script since it is clean and nice. You can download the original
from: http://www.theopensourcerer.com/wp-content/uploads/2012/12/openerp-
server
We 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/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
You can download this edited copy with the following command First Exit
from openerp users shell
exit
sudo nano /etc/init.d/openerp-server
Make the init script executable.
sudo chmod +x /etc/init.d/openerp-server
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
Add openerp-server to system startup
sudo update-rc.d openerp-server defaults
Restart the server to check if init script works
sudo shutdown -r now
After restart you should be able to connect to the server via
http://yourip:8069
Notes:
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 revision
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/server/
bzr pull
It would be nice if you check if the downloaded revision no pass the tests
of http://runbot.openerp.com You 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 YOURDATABASENAME
To Apply a Patch
To 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
command bzr patch.
to apply a patch to the addons branch:
cd /opt/openerp/v7/addons/
bzr patch PATCH_FILE_NAME_OR_URL
To install an additional independent V7 test server on the same OS
On 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 32
I 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_64bit you can read
related article.
openerp user
My 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 role
openerp 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 autostart
I 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.init you can change the pathnames
and use this file also.
Please give your feedback about instructions above so I can enhance it.

Você também pode gostar