Recently, when leading a training workshop for OpenERP, one of our attendees helped me take a mostly automated method of installing OpenERP and turn it into a 100% automated method. Piping YES to commands, and using SED took me back to my University days when I first learned UNIX!
Since I also got a comment from my post My first hour with OpenERP 7 asking for the VM I used, I decided to share both the script and the VM.
The script will automatically install the latest LTS (Long Term Support) revision of OpenERP (version 7.0.). Like I do often, I created a Virtual Machine to test this method. Virtual machines have many benefits, and are great for 'trying out' new software. I actually get better performance from OpenERP running it on Ubuntu inside a VM on my windows machines!
On the VM, I used the latest LTS release of Ubuntu (version 12.04.1) and I have shared the VM at the end of the post for anyone who wants it.
What you need:
I will assume you have Virtual Box installed on your 'host' operating system, and have created a VM and installed Ubuntu 12.04.1 on it. There are PLENTY of resources on the web if you need detailed help with that! I also installed the openssh-server package while installing the OS.
Once you have done that, you are ready to install OpenERP. I created a user called ubuntu to download, install and run OpenERP. If you use a different user, you will need to adjust the commands in the script to use your user instead.
The install script:
yes | sudo apt-get update
Then, upgrade any outdated packages:
yes| sudo apt-get upgrade
Once you have done this, you will be able to copy and paste the following into your console, or paste it into a script to run:
#create the install directory for OpenERP
sudo mkdir /opt/openerp
sudo chown ubuntu /opt/openerp
sudo chgrp ubuntu /opt/openerp
cd /opt/openerp
#install PostgreSQL
yes | sudo apt-get install postgresql
#create a postgres user for OpenERP
sudo su postgres
createuser -s -e ubuntu
exit
#install Python dependencies
yes | sudo apt-get install python-dateutil python-docutils python-feedparser python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi poppler-utils
#install GDATA
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
cd ..
#install bazaar
yes | sudo apt-get install bzr
yes | sudo apt-get install bzrtools
#install the three OpenERP branches
bzr co lp:openerp-web/7.0 web
bzr co lp:openobject-server/7.0 server
bzr co lp:openobject-addons/7.0 addons
#setup logfile
sudo mkdir /var/log/openerp
sudo chown ubuntu:root /var/log/openerp
#setup configuration file
sudo cp /opt/openerp/server/install/openerp-server.conf /etc/
sudo chown ubuntu: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf
sudo sed -i'' 's/db_user = .*/db_user = ubuntu/g' /etc/openerp-server.conf
sudo echo "logfile = /var/log/openerp/openerp-server.log" >> /etc/openerp-server.conf
sudo echo "addons_path=/opt/openerp/addons,/opt/openerp/web/addons" >> /etc/openerp-server.conf
#setup auto-startup
cd /etc/init.d
sudo curl -O http://174.129.226.169/openerp_config/openerp-server
sudo sed -i'' 's/USER=.*/USER=ubuntu/g' /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 /etc/init.d/openerp-server start
That's it!
Once you are done, reboot the server to test that OpenERP starts automatically:
sudo reboot -h now
If you see the following, it worked!
Download the result:
The username and password for the VM is ubuntu and the root account password is locked as it is in the default install.
You will need 7ZIP to unpack it, I used ULTRA compression so it will take longer than a normal archive - expect about 15-20 minutes.
DON'T FORGET to change the network settings to match the bridged adapter present on your host! It won't find my network card on your machine! If you need help getting up and running with Virtual Box, I suggest searching the web - there are lots of good resources available.


RSS Feed