<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Open Sourcerer &#187; PostgreSQL</title>
	<atom:link href="http://www.theopensourcerer.com/tag/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.theopensourcerer.com</link>
	<description>The Magic of Open Source</description>
	<lastBuildDate>Tue, 24 Jan 2012 09:10:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>How to install OpenERP 6 on Ubuntu 10.04 LTS Server (Part 1)</title>
		<link>http://www.theopensourcerer.com/2011/04/19/how-to-install-openerp-6-on-ubuntu-10-04-lts-server-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-install-openerp-6-on-ubuntu-10-04-lts-server-part-1</link>
		<comments>http://www.theopensourcerer.com/2011/04/19/how-to-install-openerp-6-on-ubuntu-10-04-lts-server-part-1/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 13:56:25 +0000</pubDate>
		<dc:creator>Alan Lord</dc:creator>
				<category><![CDATA[OpenERP]]></category>
		<category><![CDATA[The Open Learning Centre]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[CalDAV]]></category>
		<category><![CDATA[denyhosts]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Virtualisation]]></category>

		<guid isPermaLink="false">http://www.theopensourcerer.com/?p=2772</guid>
		<description><![CDATA[Recently at work, we&#8217;ve been setting up several new instances of OpenERP for customers. Our server operating system of choice is Ubuntu 10.04 LTS. Installing OpenERP isn&#8217;t really that hard, but having seen several other &#8220;How Tos&#8221; on-line describing various methods where none seemed to do the whole thing in what I consider to be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openerp.com"><img src="http://www.theopensourcerer.com/wp-content/uploads/2011/04/logo1.png" alt="OpenERP Logo" title="OpenERP Logo" width="190" height="46" class="size-full wp-image-2815 alignleft" /></a>Recently at <a href="http://www.theopenlearningcentre.com/">work</a>, we&#8217;ve been setting up several new instances of <a href="http://www.openerp.com">OpenERP</a> for customers. Our server operating system of choice is <a href="http://www.ubuntu.com/business/server/overview">Ubuntu</a> 10.04 LTS.</p>
<p>Installing OpenERP isn&#8217;t really that hard, but having seen several other &#8220;How Tos&#8221; on-line describing various methods where none seemed to do the whole thing in what I consider to be &#8220;the right way&#8221;, I thought I&#8217;d explain how we do it. <em>There are a few forum posts that I&#8217;ve come across where the advice is just plain wrong too, so do be careful.</em></p>
<p>As we tend to host OpenERP on servers that are connected to the big wide Internet, our objective is to end up with a system that is:</p>
<ul>
<ol><strong>A:</strong> Accessible only via encrypted (SSL) services from the GTK client, Web browser, WebDAV and CalDAV</ol>
<ol><strong>B:</strong> Readily upgradeable and customisable</ol>
</ul>
<p>One of my friends said to me recently, &#8220;surely it&#8217;s just <code>sudo apt-get install openerp-server</code> isn&#8217;t it?&#8221; Fair enough; this would actually work. But there are several problems I have with using a packaged implementation in this instance:</p>
<ul>
<li>Out-of-date. The latest packaged version I could see, in either the Ubuntu or Debian repositories, was 5.0.15. OpenERP is now at 6.0.3 and is a major upgrade from the 5.x series.</li>
<li>Lack of control. Being a business application, with many configuration choices, it can be harder to tweak <em>your way</em> when the packager determined that one particular way was the &#8220;true path&#8221;.</li>
<li>Upgrades and patches. Knowing how, where and why your OpenERP instance is installed the way it is, means you can decide when and how to update it and patch it, or add custom modifications.</li>
</ul>
<p>So although the way I&#8217;m installing OpenERP below is manual, it gives us a much more fine-grained level of control. Without further ado then here is <em>my way</em> as it stands currently (&#8220;currently&#8221; because you can almost always improve things. <em>HINT: suggestions for improvement gratefully accepted</em>).</p>
<p><em>[Update 18/08/2011: I've updated this post for the new 6.0.3 release of OpenERP]</em></p>
<h3>Step 1. Build your server</h3>
<p>I install just the bare minimum from the install routine (you can install the openssh-server during the install procedure or install subsequently depending on your preference).</p>
<p>After the server has restarted for the first time I install the openssh-server package (so we can connect to it remotely) and <a href="http://denyhosts.sourceforge.net/">denyhosts</a> to add a degree of brute-force attack protection. There are other protection applications available: I&#8217;m not saying this one is the best, but it&#8217;s one that works and is easy to configure and manage. <em>If you don&#8217;t already, it&#8217;s also worth looking at setting up key-based ssh access, rather than relying on passwords. This can also help to limit the potential of brute-force attacks.</em> [NB: This isn't a How To on securing your server...]</p>
<p><code>sudo apt-get install openssh-server denyhosts</code></p>
<p>Now make sure you are running all the latest patches by doing an update:</p>
<p><code>sudo apt-get update</code><br />
<code>sudo apt-get dist-upgrade</code></p>
<p>Although not always essential it&#8217;s probably a good idea to reboot your server now and make sure it all comes back up and you can still login via ssh.</p>
<p>Now we&#8217;re ready to start the OpenERP install.</p>
<h3>Step 2. Create the OpenERP user that will own and run the application</h3>
<p><code>sudo adduser --system --home=/opt/openerp --group openerp</code></p>
<p>This is a &#8220;system&#8221; user. It is there to own and run the application, it isn&#8217;t supposed to be a <em>person type</em> user with a login etc. In Ubuntu, a system user gets a UID below 1000, has no shell (well it&#8217;s actually <code>/bin/false</code>) and has logins disabled. Note that I&#8217;ve specified a &#8220;home&#8221; of <code>/opt/openerp</code>, this is where the OpenERP server, and optional web client, code will reside and is created automatically by the command above. The location of the server code is your choice of course, but be aware that some of the instructions and configuration files below may need to be altered if you decide to install to a different location. </p>
<h3>Step 3. Install and configure the database server, PostgreSQL</h3>
<p><code>sudo apt-get install postgresql</code></p>
<p>Then configure the OpenERP user on postgres:</p>
<p>First change to the postgres user so we have the necessary privileges to configure the database.</p>
<p><code>sudo su - postgres</code></p>
<p>Now create a new database user. This is so OpenERP has access rights to connect to PostgreSQL and to create and drop databases. Remember what your choice of password is here; you will need it later on:</p>
<p><code>createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp<br />
    Enter password for new role: ********<br />
    Enter it again: ********</code></p>
<p><em>[Update 18/08/2011: I have added the <code>--no-superuser</code> switch. There is no need for the openerp database user to have superuser privileges.]</em></p>
<p>Finally exit from the postgres user account:</p>
<p><code>exit</code></p>
<h3>Step 4. Install the necessary Python libraries for the server</h3>
<p><code>sudo apt-get install python python-psycopg2 python-reportlab \<br />
     python-egenix-mxdatetime python-tz python-pychart python-mako \<br />
     python-pydot python-lxml python-vobject python-yaml python-dateutil \<br />
     python-pychart python-webdav</code></p>
<p>And if you plan to use the Web client install the following:</p>
<p><code>sudo apt-get install python-cherrypy3 python-formencode python-pybabel \<br />
     python-simplejson python-pyparsing</code></p>
<h3>Step 5. Install the OpenERP server, and optional web client, code</h3>
<p>I tend to use wget for this sort of thing and I download the files to my home directory. </p>
<p>Make sure you get the latest version of the application files. At the time of writing this it&#8217;s <del datetime="2011-08-18T17:32:16+00:00">6.0.2</del> 6.0.3; I got the download links from their <a href="http://www.openerp.com/downloads">download page</a>.</p>
<p><code>wget http://www.openerp.com/download/stable/source/openerp-server-6.0.3.tar.gz</code></p>
<p>And if you want the web client:</p>
<p><code>wget http://www.openerp.com/download/stable/source/openerp-web-6.0.3.tar.gz</code></p>
<p>Now install the code where we need it: cd to the <code>/opt/openerp/</code> directory and extract the tarball(s) there.</p>
<p><code>cd /opt/openerp<br />
sudo tar xvf ~/openerp-server-6.0.3.tar.gz<br />
sudo tar xvf ~/openerp-web-6.0.3.tar.gz</code></p>
<p>Next we need to change the ownership of all the the files to the openerp user and group.</p>
<p><code>sudo chown -R openerp: *</code></p>
<p>And finally, the way I have done this is to copy the server and web client directories to something with a simpler name so that the configuration files and boot scripts don&#8217;t need constant editing (I call them, rather unimaginatively, <code>server</code> and <code>web</code>). I started out using a <a href="http://en.wikipedia.org/wiki/Symbolic_link">symlink</a> solution, but I found that when it comes to upgrading, it seems to make more sense to me to just keep a copy of the files in place and then overwrite them with the new code. This way you keep any custom or user-installed modules and reports etc. all in the right place.</p>
<p><code>sudo cp -a openerp-server-6.0.3 server<br />
sudo cp -a openerp-web-6.0.3 web</code></p>
<p>As an example, should OpenERP 6.0.4 come out next, I can extract the tarballs into <code>/opt/openerp/</code> as above. I can do any testing I need, then repeat the copy command (replacing 6.0.3 obviously) so that the modified files will overwrite as needed and any custom modules, report templates and such will be retained. Once satisfied the upgrade is stable, the older 6.0.3 directories can be removed if wanted.</p>
<p>That&#8217;s the OpenERP server and web client software installed. The last steps to a working system are to set up the two (server and web client) configuration files and associated <code>init</code> scripts so it all starts and stops automatically when the server boots and shuts down.</p>
<h3>Step 6. Configuring the OpenERP application</h3>
<p>The default configuration file for the server (in <code>/opt/openerp/server/doc/</code>) could really do with laying out a little better and a few more comments in my opinion. I&#8217;ve started to tidy up this config file a bit and <a href='http://www.theopensourcerer.com/wp-content/uploads/2011/04/openerp-server.conf'>here is a link</a> to the one I&#8217;m using at the moment (with the obvious bits changed). You need to copy or paste the contents of this file into <code>/etc/</code> and call the file <code>openerp-server.conf</code>. Then you should secure it by changing ownership and access as follows:</p>
<p><code>sudo chown openerp:root /etc/openerp-server.conf<br />
sudo chmod 640 /etc/openerp-server.conf</code></p>
<p>The above commands make the file owned and writeable only by the openerp user and only readable by openerp and root.</p>
<p>To allow the OpenERP server to run initially, you should only need to change one line in this file. Toward to the top of the file change the line <code>db_password = ********</code> to have the same password you used way back in step 3.  Use your favourite text editor here. I tend to use nano, e.g. <code>sudo nano /etc/openerp-server.conf</code></p>
<p>Once the config file is edited, you can start the server if you like just to check if it actually runs.</p>
<p><code>/opt/openerp/server/bin/openerp-server.py --config=/etc/openerp-server.conf</code></p>
<p>It won&#8217;t really work just yet as it isn&#8217;t running as the openerp user. It&#8217;s running as your normal user so it won&#8217;t be able to talk to the PostgreSQL database. Just type <code>CTL+C</code> to stop the server.</p>
<h3>Step 7. Installing the boot script</h3>
<p>For the final step we need to install a script which will be used to start-up and shut down the server automatically and also run the application as the correct user. <a href='http://www.theopensourcerer.com/wp-content/uploads/2011/04/openerp-server'>Here&#8217;s a link to the one</a> I&#8217;m using currently.</p>
<p>Similar to the config file, you need to either copy it or paste the contents of this script to a file in <code>/etc/init.d/</code> and call it <code>openerp-server</code>. Once it is in the right place you will need to make it executable and owned by root:</p>
<p><code>sudo chmod 755 /etc/init.d/openerp-server<br />
sudo chown root: /etc/init.d/openerp-server</code></p>
<p>In the config file there&#8217;s an entry for the server&#8217;s log file. We need to create that directory first so that the server has somewhere to log to and also we must make it writeable by the openerp user:</p>
<p><code>sudo mkdir /var/log/openerp<br />
sudo chown openerp:root /var/log/openerp</code></p>
<h3>Step 8. Testing the server</h3>
<p>To start the OpenERP server type:</p>
<p><code>sudo /etc/init.d/openerp-server start</code></p>
<p>You should now be able to view the logfile and see that the server has started.</p>
<p><code>less /var/log/openerp/openerp-server.log</code></p>
<p><em>If there are any problems starting the server now you need to go back and check. There&#8217;s really no point ploughing on if the server doesn&#8217;t start&#8230;</em></p>
<div id="attachment_2794" class="wp-caption alignright" style="width: 528px"><img src="http://www.theopensourcerer.com/wp-content/uploads/2011/04/Screenshot-OpenERP-Login.png" alt="OpenERP - First Login" title="OpenERP - First Login" width="518" height="268" class="size-full wp-image-2794" /><p class="wp-caption-text">OpenERP - First Login</p></div>
<p>If you now start up the GTK client and point it at your new server you should see a message like this:</p>
<p>Which is a good thing. It means the server is accepting connections and you do not have a database configured yet. I will leave configuring and setting up OpenERP as an exercise for the reader. This is a how to for installing the server. Not a how to on using and configuring OpenERP itself&#8230;</p>
<p>What I do recommend you do at this point is to change the super admin password to something nice and strong. By default it is &#8220;admin&#8221; and with that a user can create, backup, restore <strong>and</strong> drop databases (in the GTK client, go to the file menu and choose the Databases -> Administrator Password option to change it). This password is written as plain text into the /etc/openerp-server.conf file. Hence why we restricted access to just openerp and root. </p>
<p><em>One rather strange thing I&#8217;ve just realised is that when you change the super admin password and save it, OpenERP completely re-writes the config file. It removes all comments and scatters the configuration entries randomly throughout the file. I&#8217;m not sure as of now if this is by design or not.</em></p>
<p>Now it&#8217;s time to make sure the server stops properly too: </p>
<p><code>sudo /etc/init.d/openerp-server stop</code></p>
<p>Check the logfile again to make sure it has stopped and/or look at your server&#8217;s process list.</p>
<h3>Step 9. Automating OpenERP startup and shutdown</h3>
<p>If everything above seems to be working OK, the final step is make the script start and stop automatically with the Ubuntu Server. To do this type:</p>
<p><code>sudo update-rc.d openerp-server defaults</code></p>
<p>You can now try rebooting you server if you like. OpenERP should be running by the time you log back in.</p>
<p>If you type <code>ps aux | grep openerp</code> you should see a line similar to this:</p>
<p><code>openerp    708  3.8  5.8 181716 29668 ?  Sl   21:05   0:00 python /opt/openerp/server/bin/openerp-server.py -c /etc/openerp-server.conf</code></p>
<p>Which shows that the server is running. And of course you can check the logfile or use the GTK client too.</p>
<h3>Step 10. Configure and automate the Web Client</h3>
<p>Although it&#8217;s called the web <em>client</em>, it&#8217;s really another server-type application which [ahem] <em>serves</em> OpenERP to users via a web browser instead of the GTK desktop client. </p>
<p>If you want to use the web client too, it&#8217;s basically just a repeat of steps 6, 7, 8 and 9. </p>
<p>The <a href='http://www.theopensourcerer.com/wp-content/uploads/2011/04/openerp-web.conf'>default configuration file for the web client</a> (can also be found in /opt/openerp/web/doc/openerp-web.cfg) is laid out more nicely than the server one and should work as is when both the server and web client are installed on the same machine as we are doing here. I have changed one line to turn on error logging and point the file at our <code>/var/log/openerp/</code> directory. For our installation, the file should reside in <code>/etc/</code>, be called <code>openerp-web.conf</code> and have it&#8217;s owner and access rights set as with the server configuration file:</p>
<p><code>sudo chown openerp:root /etc/openerp-web.conf<br />
sudo chmod 640 /etc/openerp-web.conf</code></p>
<p>Here is a <a href='http://www.theopensourcerer.com/wp-content/uploads/2011/04/openerp-web'>web client boot script</a>. This needs to go into <code>/etc/init.d/</code>, be called <code>openerp-web</code> and be owned by root and executable.</p>
<p><code>sudo chmod 755 /etc/init.d/openerp-web<br />
sudo chown root: /etc/init.d/openerp-web</code></p>
<p>You should now be able to start the web server by entering the following command:</p>
<p><code>sudo /etc/init.d/openerp-web start</code></p>
<p>Check the web client is running by looking in the log file, looking at the process log and, of course, connecting to your OpenERP server with a web browser. The web client by default runs on port 8080 so the URL to use is something like this: <code>http://my-ip-or-domain:8080</code></p>
<p>Make sure the web client stops properly:</p>
<p><code>sudo /etc/init.d/openerp-web stop</code></p>
<p>And then configure it to start and stop automatically.</p>
<p><code>sudo update-rc.d openerp-web defaults</code></p>
<p>You should now be able to reboot your server and have the OpenERP server and web client start and stop automatically.</p>
<p>I think that will do for this post. It&#8217;s long enough as it is! </p>
<p>I&#8217;ll do a part 2 in a little while where I&#8217;ll cover using apache, ssl and mod_proxy to provide encrypted access to all services. </p>
<p><strong>[UPDATE: <a href="http://www.theopensourcerer.com/2011/04/21/how-to-install-openerp-6-on-ubuntu-10-04-lts-server-part-2-ssl/">Part 2 is here</a>]</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.theopensourcerer.com/2011/04/19/how-to-install-openerp-6-on-ubuntu-10-04-lts-server-part-1/feed/</wfw:commentRss>
		<slash:comments>151</slash:comments>
		</item>
		<item>
		<title>Another tale of Open Sourcery</title>
		<link>http://www.theopensourcerer.com/2008/12/01/another-tale-of-open-sourcery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=another-tale-of-open-sourcery</link>
		<comments>http://www.theopensourcerer.com/2008/12/01/another-tale-of-open-sourcery/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 13:46:40 +0000</pubDate>
		<dc:creator>Alan Lord</dc:creator>
				<category><![CDATA[Runes and tales]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CRM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.theopensourcerer.com/?p=554</guid>
		<description><![CDATA[Martyn, from Severn Delta Ltd, emailed me saying he had an Open Source story to tell. I&#8217;ve had this in my inbox for a while now, but have finally got round to publishing it. Alan, I own 50% of a manufacturing company in Bridgwater. When we bought the company out of receivership in &#8217;03 we [...]]]></description>
			<content:encoded><![CDATA[<p>Martyn, from <a title="Severn Delta Ltd" href="http://www.severndelta.co.uk/" target="_blank">Severn Delta Ltd</a>, emailed me saying he had an Open Source story to tell. I&#8217;ve had this in my inbox for a while now, but have finally got round to publishing it.</p>
<blockquote><p>Alan,</p>
<p>I own 50% of a manufacturing company in Bridgwater. When we bought the  company out of receivership in &#8217;03 we had no systems at all. Our former  parent company was running a character based ERP system called MAX on  Unix and a Windows file serving network.</p>
<p>So day 1 (ish!) we set up two RH servers and installed samba, sendmail,  apache etc on one for file print intranet and email and the Linux port  of MAX on the other.</p>
<p>See this post for some other detail.</p>
<p><a title="Severn Delta's Blog" href="http://blogs.severndelta.co.uk/?p=5" target="_blank">http://blogs.severndelta.co.uk/?p=5</a></p>
<p>We have not been able to find a &#8220;right-sized&#8221; ERP solution for our needs  to replace the ageing character based system (which had been &#8220;sunsetted&#8221;  by infor in &#8217;05). We also needed some form of CRM package to mange the  growth of the company once we had moved into our new building in &#8217;05.</p>
<p>So&#8230;. we decided to develop our own system in combination with an open  source CRM package from a company called Senokian Solutions  (<a title="Senokian" href="http://www.senokian.com/" target="_blank">http://www.senokian.com</a>) called <a title="Enterprise Groupware System" href="http://www.enterprisegroupwaresystem.org/" target="_blank">EGS</a>.</p>
<p>EGS is PHP/Ajax based and runs against PostgreSQL. It also has its own  development framework based on MVC that allows you to add modules. EGS  2.0 core has CRM, Project Management, Ticketing modules and a framework  that allows for integrated e-commerce apps and site content management.  It is free and open source.</p>
<p>The tools on which the system is built are:<br />
Linux (Ubuntu)<br />
Apache<br />
PostgreSQL<br />
PHP 5<br />
Ajax<br />
Smarty Template Engine<br />
EZ pdf<br />
XML/SWF Charts</p>
<p>In November 2006 I took on a developer, Dave Easeman, to help code the  accounts/ERP system as I specified it &#8211; we are now 99% of the way  through &#8211; although I guess we will never finish the project! We are  about to go live (Jan 1st) and then the aim is to polish everything up  in Quarter 1/2 2009.</p>
<p>See here for a link on our blog<br />
<a class="moz-txt-link-freetext" href="http://blogs.severndelta.co.uk/?p=58">http://blogs.severndelta.co.uk/?p=58</a></p>
<p>Maybe what I&#8217;ll do is update you as we progress to &#8220;go live&#8221; on Jan 1.</p>
<p>Regards</p>
<p>Martyn Shiner<br />
Financial Director<br />
Severn Delta Limited</p></blockquote>
<p>Thanks for the story Martyn, it&#8217;s very encouraging how companies such as yours (i.e. not some global enterprise with billions of dollars in the bank) are able to deploy, manage, run and develop their own IT systems using FOSS. This is a great example of just how flexible and accessible FOSS really is.</p>
<p>I love this quote (from the first blog link):</p>
<blockquote><p>I will never buy a Windows based PC ever again.</p>
<p>Are you listening Bill?</p></blockquote>
<p>That was written in August last year. I&#8217;m interested if you have managed to stick to that goal Martyn?</p>
<p>Good luck with your deployment. I genuinely hope it goes well, and please do keep us updated on your progress. You seem to have a similar tenacity to Adrian Steele at Mercian Labels who has also been blogging about their own <a title="Mercian Labels: Update on their FOSS migration" href="http://www.selfadhesivelabels.com/blog/2008/11/17/open-source-migration-update/" target="_blank">migration to FOSS</a>. And they also developed a core application from scratch too &#8211; for them it was a CRM/MIS app.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theopensourcerer.com/2008/12/01/another-tale-of-open-sourcery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

