<?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>wekadesign &#187; linux</title>
	<atom:link href="http://www.wekadesign.co.nz/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wekadesign.co.nz</link>
	<description>web apps that solve problems</description>
	<lastBuildDate>Sun, 20 Jun 2010 04:08:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing VMware Server 2.0.2 in Ubuntu 10.04</title>
		<link>http://www.wekadesign.co.nz/2010/06/20/installing-vmware-server-2-0-2-in-ubuntu-10-04/</link>
		<comments>http://www.wekadesign.co.nz/2010/06/20/installing-vmware-server-2-0-2-in-ubuntu-10-04/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 04:08:13 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lucid lynx]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vmware server 2]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=195</guid>
		<description><![CDATA[After updating my trusty old server to Ubuntu Lucid Lynx 10.04 the installation of VMware Server 2.0.1 started giving problems. Resinstalling VMware didn&#8217;t help as I was repeatedly getting compilation problems in vmmon and vmnet modules. Luckily I stumbled across the following process from one of the VMware forum pages which pointed to a great [...]]]></description>
			<content:encoded><![CDATA[<p>After updating my trusty old server to Ubuntu Lucid Lynx 10.04 the installation of VMware Server 2.0.1 started giving problems. Resinstalling VMware didn&#8217;t help as I was repeatedly getting compilation problems in vmmon and vmnet modules. Luckily I stumbled across the following process from one of the VMware<a title="VMware forum" href="http://communities.vmware.com/thread/266625" target="_blank"> forum pages</a> which pointed to a great work-around from the <a href="http://radu.cotescu.com/2009/10/30/how-to-install-vmware-server-2-0-x-on-ubuntu-9-10-karmic-koala/" target="_blank">radu cotescu</a> site.</p>
<p>So I take no credit for this but simply repeat it here so that the search gods may recognise it&#8217;s usefulness and +1 it&#8217;s importance.</p>
<p>Start by downloading VMware Server 2.0.2 from the official VMware site. If you haven&#8217;t already got a few licenses, get one now. (They&#8217;re free so you might as well get a few) I&#8217;m going to assume the downloaded file is in your <em>home</em> directory.</p>
<p>You also need to update the header files for your current kernel so that the configuration scripts from VMware can build the appropriate modules.</p>
<pre>sudo apt-get install linux-headers-`uname -r` build-essential</pre>
<p>Now just run the following commands.</p>
<pre><code>cd /usr/local/src
sudo wget [http://codebin.cotescu.com/vmware/vmware-server-2.0.x-kernel-2.6.3x-install.sh]
sudo tar xvzf raducotescu-vmware-server-linux-2.6.3x-kernel-592e882.tar.gz
cd raducotescu-vmware-server-linux-2.6.3x-kernel-592e882/
sudo cp /home/&lt;your_username&gt;/</code><code>VMware-server-2.0.2-203138.i386.tar.gz</code> .
<code>sudo tar xvzf VMware-server-2.0.2-203138.i386.tar.gz
sudo chmod +x vmware-server-2.0.x-kernel-2.6.3x-install.sh
./vmware-server-2.0.x-kernel-2.6.3x-install.sh
</code></pre>
<p>If you have a previous installation of VMware Server, you&#8217;ll be prompted that it&#8217;ll be removed as part of the install. Don&#8217;t worry, any guest VMs you had should still be there afterwards. The script will run through the usual prompts and you&#8217;ll see references to the patched files from Radu Cotescu. After a few minutes you should have a working install of VMware Server 2.0.2 on your Ubuntu 10.04 server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/06/20/installing-vmware-server-2-0-2-in-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running WordPress &amp; PHP Behind ISA Proxy</title>
		<link>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/</link>
		<comments>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/#comments</comments>
		<pubDate>Fri, 14 May 2010 06:23:45 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[cntlm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=178</guid>
		<description><![CDATA[Some things work well on their own but when mixed make your life hard. Things like Linux and PHP work very well. Microsoft ISA proxy also does a good job in a corporate MS environment. But making the two work together in a controlled environment can be an exercise in frustration. In this post I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Some things work well on their own but when mixed make your life hard. Things like Linux and PHP work very well. Microsoft ISA proxy also does a good job in a corporate MS environment. But making the two work together in a controlled environment can be an exercise in frustration.</p>
<p>In this post I&#8217;ll pass on the methods I found to get PHP and your Linux boxes talking out through a corporate ISA proxy server. You can then bring in RSS feeds, updates and other things in WordPress and use <em>apt-get</em> to update Ubuntu.<span id="more-178"></span></p>
<h3>cntlm</h3>
<p>To start with we need to install <a href="http://cntlm.sourceforge.net/" target="_blank"><em>cntlm</em></a> on a Linux box (I&#8217;ll mention Ubuntu here but any flavour should work with a couple of tweaks). <em>cntlm</em> is &#8220;<em>an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy</em>&#8220;. Basically your non-Windows machines and apps can now talk to <em>cntlm</em> which will then talk to the ISA proxy in your organisation. So you stay within your corporate infrastructure and keep the security guys happy.</p>
<p>Download the deb installation package to your Ubuntu machine and install it with,</p>
<pre>sudo dpkg -i cntlm_0.35.1-1_i386.deb</pre>
<p>Open the config file for <em>cntlm</em> and edit it to add in your ISA proxy information and a valid user, domain and password that has web access with download rights. Further down the settings make sure gateway is enabled and you set suitable restrictions on the IP ranges that can use <em>cntlm</em>.</p>
<pre>sudo nano /etc/cntlm.conf</pre>
<p>Restart <em>cntlm</em> to make sure it gets the new settings,</p>
<pre>sudo /etc/init.d/cntlm restart</pre>
<p>Test your <em>cntlm</em> configuration by attempting to get to an external website,</p>
<pre>sudo cntlm -M <a href="http://www.google.com/" target="_blank">http://www.google.com</a> -u your_user@your_domain -p your_password your_isa_proxy:port</pre>
<h3>apt-get</h3>
<p>Configure <em>apt-get</em> to use the new proxy by editing the <em>apt-get</em> config,</p>
<pre>sudo nano /etc/apt/apt.conf.d/70debconf</pre>
<p>and add this line pointing to your <em>cntlm</em> proxy gateway. Change the IP and port if you&#8217;ve installed <em>cntlm</em> on another machine or different port.</p>
<pre>Acquire::http::proxy "http://127.0.0.1:3128";</pre>
<h3>WordPress</h3>
<p>Add these extra lines to the wp-config.php file in your WordPress directory. This works from version 2.8 onward and means you can keep your install and plugins up to date and secure. Again, make sure you change the IP and port to that of your <em>cntlm</em> proxy gateway. You may be able to comment out the username and password if things don&#8217;t work as expected. It&#8217;ll depend on your <em>cntlm</em> configuration.</p>
<pre>define('WP_PROXY_HOST', '127.0.0.1');
define('WP_PROXY_PORT', '3128');
define('WP_PROXY_USERNAME', 'my_user_name');
define('WP_PROXY_PASSWORD', 'my_password');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');</pre>
<p>With any luck you now have a Linux machine and WordPress install that can easily be kept up to date inside your corporate environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Replication on Ubuntu with DRBD</title>
		<link>http://www.wekadesign.co.nz/2010/01/15/mysql-replication-on-ubuntu-with-drbd/</link>
		<comments>http://www.wekadesign.co.nz/2010/01/15/mysql-replication-on-ubuntu-with-drbd/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 21:45:31 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[drbd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/?p=81</guid>
		<description><![CDATA[I&#8217;ve been looking around for some easy and open-source ways to handle database replication for a handful of small but important MySQL databases. A few options were viable but usually included too many config changes for things like creating a new database. DRDB on a Linux server seems to be one of the fastest and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking around for some easy and open-source ways to handle database replication for a handful of small but important MySQL databases. A few options were viable but usually included too many config changes for things like creating a new database. <a href="http://www.drbd.org" target="_blank">DRDB</a> on a Linux server seems to be one of the fastest and easiest methods to handle database synchronisation for DR purposes, so this is the subject of this post. The content is a combination of two main sources from <a href="http://marksitblog.blogspot.com/2007/07/mysql-5-high-availability-with-drbd-8.html" target="_blank">Mark Schoonover</a> and the <a href="https://help.ubuntu.com/9.04/serverguide/C/drbd.html" target="_blank">Ubuntu server guide</a> and the gotchas I found along the way.</p>
<p>This post will show you how to create two MySQL servers that automatically replicate all their databases using DRBD. With Heartbeat installed on a third machine you&#8217;ll have basic fail over protection as well (we&#8217;ll do this in another post). Only one of the database servers will be active at any one time.<span id="more-81"></span></p>
<p>To follow along exactly, you&#8217;ll need the following items set up or readily at hand:</p>
<ul>
<li>VMware Server or ESXi, etc to host the virtual machines we use. You could just as easily use physical machines if you have the hardware lying around.</li>
<li>Ubuntu 9.04 server &#8211; other versions or distros should work just as well but you may have to make some changes to the steps as you go through.</li>
<li>Some basic skills in cmd-line usage of Ubuntu and MySQL.</li>
<li>Being Ubuntu we&#8217;re using a whole heap of <em>sudo</em> prefixed commands here. If you want to drop them out, you can switch to a root session with <em>sudo -s</em>.</li>
</ul>
<p>Start things off by creating a virtual machine<em> </em> with 512MB RAM and two 2GB disks attached. One disk will be for the OS and one will be used as the data location for MySQL. You can change the RAM or disk sizes as you like but we will be duplicating this machine so don&#8217;t use up all your RAM and disk space with the first one.</p>
<p>Install Ubuntu 9.04 server onto this machine and name it <em>node0</em> (that&#8217;s n-o-d-e-zero if the font isn&#8217;t clear). Just use one of the disks for the OS and don&#8217;t format or prepare the second one yet. You can also leave out the LAMP and other installation packages for now as we&#8217;ll grab what we need later.</p>
<p>Once the install is complete, reboot the node0 server, login, run a package update and install MySQL and DRBD with,</p>
<pre>sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server mysql-client drbd8-utils heartbeat</pre>
<p>You&#8217;ll have to download roughly 45MB of packages for those four items and the extras that come with them.</p>
<p>You now have one server configured with the software we need to do the rest. Depending on your luck, you now have two options for creating the node1 virtual machine.</p>
<h3><strong>1. Duplicate the Virtual machine in VMware</strong></h3>
<p>To make things easy, we&#8217;ll simply copy the<em> node0</em> machine in VMware to create our <em>node1</em>. Make sure you shutdown the <em>node0</em> machine in VMware and (assuming your VMware server host is Ubuntu too) open up a cmd prompt and run,</p>
<pre>cd /var/lib/vmware/Virtual\ Machines
sudo cp -r node0 node1</pre>
<p>Once that&#8217;s completed, you should be able to open the <em>node0.vmx</em> file that&#8217;s in the new node1 folder using VMware console. VMware will add the &#8216;new&#8217; virtual machine to it&#8217;s inventory and you&#8217;ll probably have to rename it as VMware will have kept the same <em>node0</em> name.</p>
<p>Start up your new node1 machine and watch for VMware to prompt you about the machine ID. You&#8217;ll need to say you copied the VM to create a new virtual machine ID in VMware.</p>
<p>Log in to node1 and change the server name in /etc/hostname and /etc/hosts files, so the two servers don&#8217;t get confused over their identities. Shutdown node1 for the changes to take effect. While the server is offline, edit it&#8217;s VMware configuration to remove the NIC and then re-add it. You need to do this to keep the virtual networking in VMware happy.</p>
<p>Depending on how you network is configured, it may be a good idea to set both servers to have static IP addresses. If you don&#8217;t want to do this, make sure you know their IPs and add them to the &#8220;other&#8221; server&#8217;s /etc/hosts file. This will mean that <em>node0</em> can reach<em> node1</em> by it&#8217;s DNS name and vice versa. Test it&#8217;s all working with a ping from each machine to the other.</p>
<h3><strong>2. Repeat the Ubuntu Installation</strong></h3>
<p>OK, so maybe your virtual machine just didn&#8217;t want to be duplicated like mine. If so, just create a new VMware guest config with the same settings as the first and install Ubuntu server the same way.</p>
<h3><strong>3. Disk Configuration</strong></h3>
<p>Now that we have our two node servers configured and the required apps installed, let&#8217;s practice safe-virtualisation by taking a VMware snapshot of both servers. Then if it all blows up in the next few steps, at least we&#8217;ll have something to go back to.</p>
<p>Let&#8217;s create a new disk partition on that extra virtual hard disk we added to both our machines. On both<em> node0</em> and <em>node1</em> use fdisk to add a Linux type 83 partition.</p>
<pre>sudo fdisk /dev/sdb</pre>
<p>Press p to make sure you have the right disk and there are no current partitions. Press n and create a primary partition with the ID of 1, accept the other default options. Press w to save the changes and exit fdisk.</p>
<h3><strong>4. Configure DRBD</strong></h3>
<p>We can now configure DRBD to use this empty partition space we&#8217;ve created. Like many other Linux apps we need to set up DRBD by editing a config file &#8211; <em>/etc/drbd.conf</em></p>
<p>On <em>node0</em>, make your <em>drbd.conf</em> file look something like the file linked below. There are plenty a massive number of other settings and comments but these are the key ones &#8211; assuming you&#8217;ve used the same disk names as above and apply your own network addresses. My server IPs were node0:192.168.0.17 and node1:192.168.0.18 so replace those with your information. Take your time to read through at least some of this file as other things like disconnects on failures may come in handy.</p>
<p><a href="http://www.wekadesign.co.nz/blog/wp-content/uploads/2010/01/drbd.txt">drbd.conf</a></p>
<p>From <em>node0</em>, copy that <em>drbd.conf</em> file to your home directory (~) on <em>node1</em> using the scp command,</p>
<pre>sudo scp /etc/drbd.conf node1:~</pre>
<p>You&#8217;ll have to accept the RSA key for<em> node1</em> if you haven&#8217;t SSH&#8217;d between those servers yet.</p>
<p>And on <em>node1</em> we need to move that file to the correct place,</p>
<pre>sudo mv ~/drbd.conf /etc/</pre>
<p>DRBD will now start, but we need to prepare the partition we created earlier so that DRBD can use it. Turn off <em>node1</em> and on <em>node0</em> do this,</p>
<pre>sudo drbdadm create-md mysql</pre>
<p>Restart <em>node0</em> and log back in again. Typing &#8216;yes&#8217; to DRBD&#8217;s timeout will speed things up. You&#8217;ll see some warnings about using the &#8216;drbd-peer-outdater&#8217; in a mode where something else needs root privileges. Just ignore that for now and we&#8217;ll make those changes later.</p>
<p>Run <em>cat /proc/drbd</em> on <em>node0</em> to have a look at the messages logged when drbd started up. We can see that <em>node0</em> is in an unknown state as it can&#8217;t see what&#8217;s happening on <em>node1</em> properly. So lets sort out <em>node1</em>.</p>
<p>On <em>node1</em> create the drbd file system just like a couple of minutes ago,</p>
<pre>sudo drbdadm create-md mysql</pre>
<p>And restart DRBD on node1 to make sure it&#8217;s using that new data,</p>
<pre>sudo /etc/init.d/drbd restart</pre>
<p>Run <em>cat /proc/drbd</em> again to check the status on both <em>node0</em> and <em>node1</em> and you should see that they are both connected and set as secondary with an inconsistent status. If you don&#8217;t see that then give both nodes a reboot and try again. If you still don&#8217;t see that output, start back tracking and check the previous steps.</p>
<p>At this stage both nodes are essentially looking at each other but don&#8217;t know who is the primary so they&#8217;re not going to do anything. By running the following command on <em>node0</em> you make that machine the primary and data will start to be replicated straight away.</p>
<pre>sudo drbdadm -- --overwrite-data-of-peer primary mysql</pre>
<p>You can either use <em>cat /proc/drbd</em> or <em>watch -n1 cat /proc/drbd</em> to view the status of the replication as it happens. This may take some time, even for the relatively small 2GB of empty space we are using, as DRBD will replicate every block in the device /dev/mysql. Between the VMs on an old P4 with a PATA disk I was seeing about 2.8 MB/s.</p>
<p>When you ran that command to set the primary, you probably got some messages about the heartbeat program requiring root privileges to run drbdsetup and drbdmeta. Do that now to get rid of those warnings.</p>
<pre>sudo chgrp haclient /sbin/drbdsetup
sudo chmod o-x /sbin/drbdsetup
sudo chmod u+s /sbin/drbdsetup
sudo chgrp haclient /sbin/drbdmeta
sudo chmod o-x /sbin/drbdmeta
sudo chmod u+s /sbin/drbdmeta</pre>
<h3>Prepare, Mount &amp; Test the DRBD Device</h3>
<p>Now although we have our two nodes talking and set as primary and secondary, the disk space is not formatted or mounted for any apps (i.e. MySQL) to use. So we first format our <em>/dev/drbd0</em> device with ext3 and a nice filesystem label.</p>
<pre>sudo mkfs.ext3 -L mysql /dev/drbd0</pre>
<p>Then we create the mount point on <em>node0</em> and mount the new filesystem. Whatever gets dropped into <em>/mnt/mysql</em> will magically be synchronised from the primary node to the secondary.</p>
<pre>sudo mkdir /mnt/mysql
sudo mount /dev/drbd0 /mnt/mysql</pre>
<p>To test our new setup copy some files and folders into <em>/mnt/mysql</em> and unmount the DRBD device. We then switch the primary <em>node0</em> to be the secondary and jump onto the <em>node1</em> server.</p>
<pre>sudo cp -r ~ /mnt/mysql
sudo umount /mnt/mysql
sudo drbdadm secondary mysql</pre>
<p>Now move to the <em>node1</em> server and create the same mount point, mount our DRBD device and we&#8217;ll see what&#8217;s inside.</p>
<pre>sudo mkdir /mnt/mysql
sudo mount /dev/drbd0 /mnt/mysql</pre>
<p>Like magic you should now see that same data you copied on <em>node0</em>, has appeared in the same device on <em>node1</em>.</p>
<p>Now switch the roles back again so <em>node0</em> is the primary and <em>node1</em> is the secondary, and delete the test data in <em>/mnt/mysql</em>.</p>
<h3>Configure MySQL</h3>
<p>The core settings for MySQL is in a file called /etc/mysql/<em>my.cnf</em> and it&#8217;s this file that we are going to edit to tell MySQL to use our DRBD device to store it&#8217;s databases, indexes and logs.</p>
<p>At this point it&#8217;s <strong>very important</strong> that you do not have any MySQL databases already running on <em>node0</em> or <em>node1</em> &#8211; none that you want to keep anyway. Let&#8217;s stop the MySQL server and backup our original MySQL settings so we can then make changes on <em>node0</em>.</p>
<pre>sudo /etc/init.d/mysql stop
cd /etc/mysql
sudo cp my.cnf myold.cnf</pre>
<p>Open up the <em>my.cnf</em> file in your favorite text editor like vi or nano, and change the datadir option as below. If you have logging enabled, or will at some point, you may want to synchronise the log files as well. For more information on other options in this file see the <a href="http://dev.mysql.com/doc/refman/5.1/en/option-files.html" target="_blank">MySQL documentation</a>.</p>
<pre>datadir = /mnt/mysql/data</pre>
<p>Save <em>my.cnf</em> and make the same changes on <em>node1</em>. We have to repeat this as these files aren&#8217;t in out replicating DRBD device.</p>
<p>Run the following commands to set the correct permissions on the new location and also update the AppArmor settings to allow access. This is important else the <em>mysql</em> user and group will not be able to access the new directory properly and you will get errors. Trying to restart the MySQL daemon at the moment will fail.</p>
<pre>sudo chown -R mysql:mysql /mnt/mysql
sudo nano /etc/apparmor.d/usr.sbin.mysqld</pre>
<p>On the bottom of the list of locations, add the following (within the curly closing bracket } ),</p>
<pre>/mnt/mysql/data/ r,
/mnt/mysql/data/** rwk,</pre>
<p>Restart AppArmor to pick up the new locations for MySQL,</p>
<pre>sudo /etc/init.d/apparmor restart</pre>
<p>Make the same changes to AppArmor on <em>node1</em> &#8211; again these changes are server based and not automatically replicated.</p>
<p>We should try and move the previous databases into the new location with the following commands. Repeat the first copy command for any other databases you might have. (That <em>mysql</em> directory we&#8217;re copying first is the MySQL system database.)</p>
<pre>sudo cp -r /var/lib/mysql/mysql /mnt/mysql/data/
...
sudo chown -R mysql:mysql /mnt/mysql/data/*</pre>
<p>The last thing to do is restart MySQL and check it&#8217;s working.</p>
<pre>sudo /etc/init.d/mysql start</pre>
<p>If this gives permission errors about the <em>debian-sys-maint</em> user, check your permissions and/or restart the server. Restarting MySQL might not be enough.</p>
<p>Connect to mysql as the <em>root</em> user and let&#8217;s just create a new database and table to test things before we do another manual fail-over to <em>node1</em>.</p>
<pre>mysql -u root -p
create database drbdtest;
use drbdtest;
create table users (id INTEGER(9), name VARCHAR(255));
exit;</pre>
<p>You can now see your new database files in <em>/mnt/mysql/data/drbdtest</em>. So we fail-over from <em>node0</em> to <em>node1</em> again, just for practice. <strong>We must stop the mysql server before we unmount the DRBD device</strong> else very bad things may happen.</p>
<pre>sudo /etc/init.d/mysql stop
sudo umount /mnt/mysql
sudo drbdadm secondary mysql</pre>
<p>and over on <em>node1</em> . . .</p>
<pre>sudo drbdadm primary mysql</pre>
<p>And check those database files are there with the mysql client or looking in <em>/mnt/mysql/data/drbdtest.</em></p>
<h3>Conclusion</h3>
<p>So we can see that this will save us (with some manual intervention), when our MySQL storage falls over. But wouldn&#8217;t it be nice if there was an automated way to make this happen? See the next article on using Heartbeat to make this happen.</p>
<h3>Potential Issues</h3>
<p>If you try and mount <em>/dev/drbd0</em> and get an error about the device being read-only, check that the DRBD node you&#8217;re on is in the correct mode i.e. primary or secondary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/01/15/mysql-replication-on-ubuntu-with-drbd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable WakeUp from PS2 Keyboard in Ubuntu 8.10</title>
		<link>http://www.wekadesign.co.nz/2009/03/08/enable-wakeup-from-ps2-keyboard-in-ubuntu-810/</link>
		<comments>http://www.wekadesign.co.nz/2009/03/08/enable-wakeup-from-ps2-keyboard-in-ubuntu-810/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 00:02:01 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Interesting Stuff]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[power management]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wakeup]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/?p=66</guid>
		<description><![CDATA[One of the annoying &#8220;missing features&#8221; I&#8217;ve struggled with under Ubuntu is that I was unable to wakeup the PC from suspend or hibernate with my keyboard. Of course, Windows just does it &#8211; tap the keyboard and the PC starts up again. I could press the power button on the front of the PC, [...]]]></description>
			<content:encoded><![CDATA[<p>One of the annoying &#8220;missing features&#8221; I&#8217;ve struggled with under Ubuntu is that I was unable to wakeup the PC from suspend or hibernate with my keyboard. Of course, Windows just does it &#8211; tap the keyboard and the PC starts up again. I could press the power button on the front of the PC, but its down the side of the desk and not easily accessible.</p>
<p>I found an older post in the Ubuntu forums that had the fix for USB devices and it also works for PS2 with the simplest of changes. So follow these steps and you should be saving power and getting back to work faster.</p>
<p>Open a Terminal and type,</p>
<pre>cat /proc/acpi/wakeup</pre>
<p>Note the entries that come back and you should see a device called &#8220;PS2K&#8221; toward the top if you have a PS2 keyboard. For those with USB, it&#8217;ll be one of the USB items toward the bottom. The entry will probably also have &#8220;Disabled&#8221; on the same line, hence your problem.</p>
<p>To enable this entry, switch to a root session by typing,</p>
<pre>sudo -s</pre>
<p>and enter your password. Now type the following to update the acpi file and toggle &#8220;disabled&#8221; to &#8220;enabled&#8221;, (those with USB devices can try USB0, USB1, etc)</p>
<pre>echo PS2K &gt; /proc/acpi/wakeup</pre>
<p>That should have now enabled your PS2 keyboard to wakeup your PC for <em>this session</em>. Give it a test by putting your machine to sleep and then tapping a key on your keyboard. Probably a good idea to save stuff first, just in case.</p>
<p>If you tried changing a USB device, it may take a few guesses until you find the KB. My mouse was USB0 and clicking any mouse button can also do the wakeup task.</p>
<p>To make this change permanant, you need to add that line to a script and run it when Ubuntu starts. So we create a file called wakeup.sh with the following contents,</p>
<pre>#!/bin/bash
echo PS2K &gt; /proc/acpi/wakeup</pre>
<p>Save it and from a Terminal make it executable so it runs properly as a script and not just a text file,</p>
<pre>chmod +x wakeup.sh</pre>
<p>Now to add it to the startup area go back to your Terminal that&#8217;s running as root. We need to copy the file to the correct location and add it to the startup processes. You&#8217;ll need to run the <em>cp</em> command in the same folder as where you saved your wakeup.sh file.</p>
<pre>cp wakeup.sh /etc/init.d/wakeup.sh
update-rc.d wakeup.sh defaults</pre>
<p>Now when you reboot, the script will run and enable your PS2 keyboard in ACPI so you can wakeup your PC.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2009/03/08/enable-wakeup-from-ps2-keyboard-in-ubuntu-810/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing VMware Server 1.06 on Linux</title>
		<link>http://www.wekadesign.co.nz/2008/06/07/installing-vmware-server-on-linux/</link>
		<comments>http://www.wekadesign.co.nz/2008/06/07/installing-vmware-server-on-linux/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 10:40:47 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Interesting Stuff]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/blog/?p=33</guid>
		<description><![CDATA[Installing the free VMware Server is a common but slightly tricky process on some newer Linux systems. Having had to go through it again recently I thought I&#8217;d write some of it down. Of course if you are using Ubuntu 7.10 then the simple option is to enable the Canonical Partner repository and just use [...]]]></description>
			<content:encoded><![CDATA[<p>Installing the free VMware Server is a common but slightly tricky process on some newer Linux systems. Having had to go through it again recently I thought I&#8217;d write some of it down. Of course if you are using Ubuntu 7.10 then the simple option is to enable the Canonical Partner repository and just use Synaptic to select and install VMware Server.</p>
<p>For the others in the audience that are installing on Ubuntu 8.04 or another Linux system that doesn&#8217;t have packages, you should have a working VMware Server install with web interface and a client console by the bottom of the page.<span id="more-33"></span></p>
<h3>Downloads</h3>
<p>There are a few things you will need from VMware&#8217;s site before we kick off. Download these to your server machine.</p>
<p><a href="http://download3.vmware.com/software/vmserver/VMware-server-1.0.6-91891.tar.gz" target="_blank">VMware Server 1.06</a> is the latest version of the free product, released in late May 2008.</p>
<p>The web based Management User Interface (MUI) onto your VMware Server install. The files for VMware Server 1.06 are available <a href="http://register.vmware.com/content/download-106.html" target="_blank">here</a>.</p>
<h3>System Extras</h3>
<p>Your Linux (in this case Ubuntu 8.04) system will require some extra libraries and bits if you haven&#8217;t already done so. Run the following on both the server and the client (if you&#8217;re installing the VMware console too).</p>
<pre>sudo apt-get install build-essential linux-headers-`uname -r` xinetd</pre>
<p>As you progress through the install you may find that your system has extra requirements. It all depends on the setup and libraries already installed on each machine. So you have the option of installing these ones on your server now or just keep going and come back if needed.</p>
<pre>sudo apt-get install libx11-6 libx11-dev libxtst6 libICE6 libxt6 libxrender1 libxi6 xfsprogs</pre>
<h3>Install</h3>
<p>Extract both the tarballs you&#8217;ve download,</p>
<pre><code>tar -xvzf VMware-server-1.0.6-*.tar.gz
tar -xvzf VMware-mui-1.0.6-*.tar.gz</code></pre>
<p>switch to the Server install folder,</p>
<pre>cd <code>vmware-server-distrib</code></pre>
<p>and run the installation script as root,</p>
<pre>sudo ./vmware-install.pl</pre>
<p>You may see errors during the install. If so, run these two commands to cover for a couple of missing libraries for cairo and gcc (tip courtesy of <a href="http://ubuntu-tutorials.com/">Ubuntu Tutorials</a>)</p>
<pre>sudo ln -sf /usr/lib/gcc/i486-linux-gnu/4.2.3/libgcc_s.so /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1</pre>
<pre>sudo ln -sf /usr/lib/libpng12.so.0 /usr/lib/vmware/lib/libpng12.so.0/libpng12.so.0</pre>
<p>At the end of the install you&#8217;ll be asked for the registration key that you can get from the VMware website. I usually request 10 and copy and paste them to a safe place. Be aware that the Linux and Windows keys are different and can&#8217;t be interchanged.</p>
<p>When the key has been accepted the install tidies up and you should see the VMware Server starting and giving the OK message. To double check, just restart it again with,</p>
<pre>sudo /etc/init.d/vmware restart</pre>
<p>You now have a working VMware Server but no easy way to control it. So we need the MUI and the Console.</p>
<p>Switch folder back to the MUI source folder that you extracted earlier and run the install script,</p>
<pre>sudo ./vmware-install.pl</pre>
<p>Once that&#8217;s completed, you should be able to connect from your client system&#8217;s web browser to https://&lt;server&gt;:8333 as long as you haven&#8217;t changed the port.</p>
<p>Again, depending on the state of your system, you may need to run the following if you have connection problems. I&#8217;ve found this fixes the SSL generation error (&#8220;<em>starting httpd.vmware:-ne failed</em>&#8220;) you may have at the end of the MUI install.</p>
<pre>sudo ln -s -f /bin/bash /bin/sh</pre>
<pre>sudo vmware-config-mui.pl</pre>
<p>Log on to https://&lt;server&gt;:8333 as your server user and you&#8217;ll see you can&#8217;t do too much. No options to create new VMs or change too many options. You need to install the VMWare console on your client machine.</p>
<h3>Client Console Install</h3>
<p>Installing the client console software is pretty easy. If you&#8217;re on a Windows machine just grab the client ZIP file from VMware, extract, double-click and you&#8217;re done.</p>
<p>For the Linux (specifically Ubuntu 8.04) world, use the links on those VMware MUI pages to download the console tarball and extract to a folder on your client machine. Remember that the rest of these instructions should be run on your Linux client and not your server.</p>
<pre>cd vmware-server-console-distrib</pre>
<pre>sudo ./vmware-install.pl</pre>
<p>Just follow the instructions through and accept the defaults. Look out for any ominous error messages, but you shouldn&#8217;t see any.</p>
<p>Test things out by starting the console with,</p>
<pre>/usr/bin/vmware-server-console</pre>
<p>and log on as your server username and password. You can now create a VMware guest and start it up &#8211; as long as you&#8217;ve used a registration key. If you receive errors when starting your guest system via the console, make sure you&#8217;ve installed the libraries noted in the System Extras section. If you still have problems, run the following on the server to see if you have anything specific missing,</p>
<pre>ldd /usr/lib/vmware/bin/vmware-vmx</pre>
<p>Hopefully by now you&#8217;ve got a smile on your face and if not, keep plugging away and feel free to ask any questions in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2008/06/07/installing-vmware-server-on-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
