<?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>No pain no gain &#187; Linux</title>
	<atom:link href="http://www.dikant.de/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dikant.de</link>
	<description>Personal blog of Peter Dikant</description>
	<lastBuildDate>Sat, 28 Jan 2012 12:25:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Speeding up ProFTPD logins</title>
		<link>http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/</link>
		<comments>http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 18:21:25 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[proftpd]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=220</guid>
		<description><![CDATA[One year ago I have switched from PureFTPd to ProFTPD because it runs smoother on the virtual server I am running. The server is really easy to setup and maintain, but with the standard configuration it always takes around 5 &#8230; <a href="http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dikant.de/wp-content/uploads/2011/08/proftpd.png"><img src="http://www.dikant.de/wp-content/uploads/2011/08/proftpd-150x92.png" alt="" title="ProFTPD" width="150" height="92" class="alignleft size-thumbnail wp-image-221" /></a>One year ago I have switched from <a href="http://www.pureftpd.org" target="_blank">PureFTPd</a> to <a href="http://www.proftpd.org/" target="_blank">ProFTPD</a> because it runs smoother on the virtual server I am running. The server is really easy to setup and maintain, but with the standard configuration it always takes around 5 to 10 seconds to log on to the server. After searching for a solution to these slow logins, it turns out that there is even a point in the <a href="http://www.proftpd.org/docs/faq/linked/faq-ch4.html#AEN341" target="_blank">FAQ</a> on how to speed up the login process.</p>
<p>Just edit the file <code>/etc/proftpd/proftpd.conf</code> and add these 2 lines:</p>

<div class="wp_syntax"><div class="code"><pre class="config" style="font-family:monospace;">UseReverseDNS off
IdentLookups off</pre></div></div>

<p>Lesson learned: I should read manuals more often.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2011/08/16/speeding-up-proftpd-logins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a VPN-server on Amazon EC2</title>
		<link>http://www.dikant.de/2010/10/08/setting-up-a-vpn-server-on-amazon-ec2/</link>
		<comments>http://www.dikant.de/2010/10/08/setting-up-a-vpn-server-on-amazon-ec2/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 17:34:24 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[pptpd]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=129</guid>
		<description><![CDATA[Amazon has recently announced the new Micro Instances in their Elastic Cloud service. A so called Micro Instance is a virtual machine with 620 MB main memory and CPU power in the area of an 1 GHz Opteron processor. The &#8230; <a href="http://www.dikant.de/2010/10/08/setting-up-a-vpn-server-on-amazon-ec2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dikant.de/wp-content/uploads/2010/10/imgres.jpg"><img src="http://www.dikant.de/wp-content/uploads/2010/10/imgres.jpg" alt="" title="imgres" width="116" height="47" class="alignleft size-full wp-image-130" /></a><a href="http://aws.amazon.com">Amazon</a> has recently announced the new Micro Instances in their Elastic Cloud service. A so called Micro Instance is a virtual machine with 620 MB main memory and CPU power in the area of an 1 GHz Opteron processor. The advantage of the Micro Instance is its low cost of only $0.02 per hour of operation (be advised, there are some additional costs for traffic and storage). </p>
<p>The EC2 Micro Instance is an ideal way to operate your own VPN-server, when you need it only a couple of hours per month. Let&#8217;s assume, that you want to use it for about 50 hours per month with around 10 GB of traffic, this means $1.00 for computation time + $1.50 for 15 GB of storage + $1.50 for 10 GB outgoing traffic. So for $4 this is quite a good offer. Granted, you can find commercial VPN providers for $5 per month, but it is more fun to do it yourself. In this article I will describe, how to setup an EC2 instance as a VPN-server.<br />
<span id="more-129"></span><br />
I choose to setup a PPTP server. PPTP is not the most secure type of VPN, but it has the big advantage, that it is the most compatible. Nearly every OS is able to open a PPTP connection without additional software and this includes mobile devices like iPhones/iPads. </p>
<p>First, you need to choose a base image to boot in the Micro Instance. I have selected an 32-bit Ubuntu 10.04 server image. The AMI-ID of this image is <code>ami-6c06f305</code>. Start this image in a Micro Instance and log in with your SSH-key. For more details on these steps, refer to the AWS documentation.</p>
<p>Once you are logged in, you can install the pptp-daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> pptpd</pre></div></div>

<p>Configuring the pptp-daemon is a breeze. First you to define an IP address range which will be used for connected clients. This can be any IP range, but keep in mind, if you want to avoid routing problems, choose a private IP range. Uncomment and modify 2 lines at the end of <code>/etc/pptpd.conf</code>:</p>
<pre>
localip 192.168.240.1
remoteip 192.168.240.2-9
</pre>
<p>With the above settings, the pptpd server will get the address 192.168.240.1 and there are 8 possible client addresses 192.168.240.2 to 192.168.240.9.</p>
<p>It is also a good idea to specify the address of at least one DNS server. You can use the DNS server of amazon (<code>172.16.0.23</code>) or the Google Public DNS. I choose the latter. Open the file <code>/etc/ppp/pptpd-options</code> and make sure it contains the following settings:</p>
<pre>
ms-dns 8.8.8.8
ms-dns 8.8.4.4
</pre>
<p>The last step for configuring the pptpd-daemon is to add a user account for the service:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;USERNAME pptpd PASSWORD *&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ppp<span style="color: #000000; font-weight: bold;">/</span>chap-secrets</pre></div></div>

<p>Replace <code>USERNAME</code> and <code>PASSWORD</code> with whatever credentials you like. It is possible to add as many users as you like.</p>
<p>Now restart the pptp-daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>pptpd restart</pre></div></div>

<p>It is already possible to open a PPTP-connection to the server, although no traffic will be forwarded to the Internet. We still need to enable packet forwarding and network address translation on the server.</p>
<p>To enable packet forwarding, uncomment the following line in <code>/etc/sysctl.conf</code>:</p>
<pre>
net.ipv4.ip_forward=1
</pre>
<p>Now reload this config:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> sysctl <span style="color: #660033;">-p</span></pre></div></div>

<p>The last step is to enable network address translation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> POSTROUTING <span style="color: #660033;">-o</span> eth0 <span style="color: #660033;">-j</span> MASQUERADE</pre></div></div>

<p>This setting is reset on every reboot, so make sure that you add the following line above <code>exit 0</code> in the file <code>/etc/rc.local</code>:</p>
<pre>
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
</pre>
<p>Now the VPN server is fully functional. The only small problem is, that the server will get a new IP address every time you reboot it. I would recommend using a dynamic dns-provider to assign this machine a unique domain name. I am using <a href="http://www.dyndns.com/">DynDNS</a>.</p>
<p>The <a href="http://sourceforge.net/apps/trac/ddclient">ddclient</a> is a great little tool to update the current IP address on a number of different dynamic DNS services. Installation is done as usual:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ddclient</pre></div></div>

<p>Once installed, the configuration is done in the file <code>/etc/ddclient.conf</code>. It will already contain some usefull settings, because the installer will require you to enter some information about the DNS service you are using. In the end the configuration should look something like this:</p>
<pre>
protocol=dyndns2
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
server=members.dyndns.org
login=LOGINNAME
password='PASSWORD'
DOMAINNAME.dyndns.org
</pre>
<p>Replace <code>LOGINNAME</code>, <code>PASSWORD</code> and <code>DOMAINNAME.dyndns.org</code> with your own settings. The most important line is the one starting with <code>use=</code>. This defines that the registered IP-address is detected by DynDNS itself. This is neccessary, because the virtual machine is running with a private IP address.</p>
<p>That&#8217;s it! Now you have your own VPN-server up and running. Just start the instance in the <a href="https://console.aws.amazon.com/ec2/home">AWS Management Console</a> whenever you need it.</p>
<p><em>Update:</em></p>
<p>Here is a screenshot of the security groups setup I am using:<br />
<a href="http://www.dikant.de/wp-content/uploads/2010/10/ec2_security_setup.gif"><img src="http://www.dikant.de/wp-content/uploads/2010/10/ec2_security_setup.gif" alt="" title="ec2_security_setup" width="775" height="287" class="alignleft size-full wp-image-163" /></a></p>
<p><em>Update 2:</em></p>
<p>Please take a look at my <a href="http://www.dikant.de/2011/10/03/configuring-a-pptp-vpn-on-ios-and-android/" title="Configuring a PPTP-VPN on iOS and Android">follow up posting</a> on how to connect to the VPN from an iOS or Android device.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2010/10/08/setting-up-a-vpn-server-on-amazon-ec2/feed/</wfw:commentRss>
		<slash:comments>59</slash:comments>
		</item>
		<item>
		<title>Setting up PureFTPD on a virtual server</title>
		<link>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/</link>
		<comments>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 19:21:46 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PureFTP]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=56</guid>
		<description><![CDATA[PureFTPD is a secure and easy to configure FTP server. It has all the features you usually need, like TLS encryption, virtual users, quotas and limits. The only downside is that PureFTPD is not easy to install on a virtual &#8230; <a href="http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.dikant.de/wp-content/uploads/2009/01/pure-ftpd.png" alt="PureFTPD Logo" title="PureFTPD Logo" width="224" height="64" class="alignleft size-full wp-image-55" /> <a href="http://www.pureftpd.org">PureFTPD</a> is a secure and easy to configure FTP server. It has all the features you usually need, like TLS encryption, virtual users, quotas and limits. The only downside is that PureFTPD is not easy to install on a virtual server because the default Debian package is compiled with some options that are not supported by the standard OpenVZ and Virtuozzo kernels. Therefore you need to recompile PureFTPD with some reasonable settings. In This post I will explain how to do that and do a basic service setup.</p>
<p><span id="more-56"></span></p>
<p>First you could try to install the default Debian package to check whether you need to recompile PureFTPD. This can be done via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> pure-ftpd-common pure-ftpd</pre></div></div>

<p>The following steps are needed to recompile the package with the necessary options to make it run on a virtual server. You only need to do these steps if you find the following message in your syslog when trying to connect to the ftp server:</p>

<div class="wp_syntax"><div class="code"><pre class="syslog" style="font-family:monospace;"> pure-ftpd: (?@?) [ERROR] Unable to switch capabilities : Operation not permitted</pre></div></div>

<p>In that case, make sure that you have enabled the Debian source repositories in your <code>/etc/apt/sources.list</code> and fetch the source files via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #7a0874; font-weight: bold;">source</span> pure-ftpd</pre></div></div>

<p>The source files have now been downloaded to your current directory. There should now some new files and a directory <code>pure-ftpd-1.0.21</code>. Enter this directory and edit the file <code>debian/rules</code> you should change the line starting with <code>optflags</code> and add <code>--without-capabilities</code> to that line, so that it looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="make" style="font-family:monospace;">optflags<span style="color: #004400;">=--</span>with<span style="color: #004400;">-</span>everything <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>largefile <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>pam <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>privsep <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>tls <span style="color: #004400;">--</span>without<span style="color: #004400;">-</span>capabilities</pre></div></div>

<p>Now grab the dependencies needed to build the source and compile the Debian installation package:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> build-dep pure-ftpd
dpkg-buildpackage <span style="color: #660033;">-uc</span> <span style="color: #660033;">-b</span></pre></div></div>

<p>The resulting Debian package should now have been built without errors and you can install it via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> ..<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd_1.0.1-<span style="color: #000000;">8</span>_i386.deb</pre></div></div>

<p>The filename of the package might vary depending on the current patch level in the Debian repository.</p>
<p>When installing the package you will be asked whether to use a chrooted setup which you should do and if you prefer a standalone installation or inetd-based operation. For low volume sites I would prefer the inetd installation.</p>
<p>Now let&#8217;s get on to the configuration of PureFTPD. I prefer a setup using virtual users which are mapped to a central user account on the server. So I usually create a new account without a shell or home directory which belongs to the Apache user group to have access to hosted webs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-g</span> www-data <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> ftpuser</pre></div></div>

<p>You can also use the existing user <code>www-data</code> instead. In that case you need to enable that user account (on Debian/Ubuntu it has the user id 33) in the PureFTP config:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">33</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>MinUID</pre></div></div>

<p>The configuration of PureFTP is done via distinct files in the directory <code>/etc/pure-ftpd/conf</code>. Each file contains a single configuration setting and we can setup a decent configuration with the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ChrootEveryone
<span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> PAMAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> UnixAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;</span> TLS
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>auth
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ..<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>PureDB 50pure</pre></div></div>

<p>With the above settings we disable all authentication methods except the internal PureFTPD user database. We also lock down each user into a chroot-environment and enable secure authentication via TLS. PureFTPD excepts a certificate in the file <code>/etc/ssl/private/pure-ftpd.pem</code>. You could copy your apache certificate to that file, or generate a new one via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">4312</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-keyout</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd.pem <span style="color: #660033;">-out</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd.pem</pre></div></div>

<p>The user administration and setup is now done with the PureFTPD tool <code>pure-pw</code>. You can add a new user via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pure-pw useradd myusername <span style="color: #660033;">-u</span> ftpuser <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>homedir</pre></div></div>

<p>The above command will ask you for a password and register the user which is mapped to the system user <code>ftpuser</code> within PureFTPD. Every time you modify the user database you need to rebuild the PureFTPD user configuration via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pure-pw mkdb</pre></div></div>

<p>Now you should be able to connect to your server with secure authorization with the newly created user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hosting OpenVZ on Ubuntu 8.04</title>
		<link>http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/</link>
		<comments>http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 18:10:49 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=46</guid>
		<description><![CDATA[The long term support edition 8.04 of Ubuntu Linux will provide security updates until 2013. Therefore it is an ideal distribution for building the base of a secure hosting solution. In this article I will describe how you can setup &#8230; <a href="http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The long term support edition 8.04 of <a href="http://www.ubuntu.com/">Ubuntu Linux</a> will provide security updates until 2013. Therefore it is an ideal distribution for building the base of a secure hosting solution. In this article I will describe how you can setup the virtualization software <a href="http://wiki.openvz.org/">OpenVZ</a> on Ubuntu 8.04. OpenVZ allows you to run multiple virtual Linux servers on top of your Ubuntu system. It is extremely performant and OpenVZ is also the base of the well known <a href="http://www.parallels.com/en/products/virtuozzo/">Virtuozzo</a> solution which is widely used in the web hosting market. Compared to <a href="http://xen.org/">Xen</a>, OpenVZ is more limited in regards to different operating system you can run, but on the other hand it has a lower overhead and is therefore more performant. It is also possible to run OpenVZ inside of <a href="http://www.virtualbox.org/">VirtualBox</a> which is not possible with Xen.</p>
<p><span id="more-46"></span></p>
<p>The first step in setting up an OpenVZ server is to install a minimal setup of Ubuntu server 8.04. When installing Ubuntu you should select LVM in the partitioning options as this will enable backups of your OpenVZ containers without downtime while they are running. The only service that we will install is OpenSSH to access the installation remotely.</p>
<p>Once the base system is setup and you can login remotely via SSH you could update the whole system to make sure you have the latest versions of all installed applications:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade</pre></div></div>

<p>The OpenVZ-Kernel does not work well with the AppArmor package, which is installed by default, so disable it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-rc.d <span style="color: #660033;">-f</span> apparmor remove</pre></div></div>

<p>Now it is time to install the OpenVZ-kernel:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> linux-openvz</pre></div></div>

<p>The above package is a meta package which will install the kernel, the kernel modules and any required header-files and libraries. Now take a look at the file <code>/boot/grub/menu.lst</code> and make sure that the new OpenVZ kernel is the default kernel when booting. Now reboot and check that the correct kernel is loaded:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-r</span></pre></div></div>

<p>If you can see something like <code>2.6.24-18-openvz</code> when running the above command, the correct kernel has been booted. If not, check your boot config.</p>
<p>The next step is to install the OpenVZ tools:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> vzctl vzquota</pre></div></div>

<p>Now you can run the OpenVZ daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vz start</pre></div></div>

<p>Basically that&#8217;s it. OpenVZ is now running and you can setup your VZ containers. The OpenVZ project page has a lot of different container templates you can use as a starting point. Take a look at the list on <a href="http://wiki.openvz.org/Download/template/precreated">http://wiki.openvz.org/Download/template/precreated</a> and download all templates you want to use to <code>/var/lib/vz/template/cache</code>. You can choose from a wide selection of Linux distributions.</p>
<p>You can now start creating your virtual machine containers and run them:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> vzctl create <span style="color: #000000;">101</span> <span style="color: #660033;">--ostemplate</span> ubuntu-<span style="color: #000000;">8.04</span>-i386-minimal
<span style="color: #c20cb9; font-weight: bold;">sudo</span> vzctl start <span style="color: #000000;">101</span></pre></div></div>

<p>Of course you need to configure your containers, but this is a different topic which I will describe in a followup to this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

