<?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>SysAd Nonsense</title>
	<atom:link href="http://www.tomvernon.co.uk/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tomvernon.co.uk/blog</link>
	<description>Technical scribble.....</description>
	<lastBuildDate>Thu, 08 Sep 2011 16:19:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Some LVM Notes</title>
		<link>http://www.tomvernon.co.uk/blog/2011/09/some-lvm-notes/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/09/some-lvm-notes/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 16:19:13 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[lvm]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=693</guid>
		<description><![CDATA[A few LVM notes to jog the brain A. Steps to create the logical volume.. List the current physical volumes. In this instance, were interested in a blank 20GB SATA &#8211; /dev/sdb. You can extend a logical volume by adding additional phyical volumes later. fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 [...]]]></description>
			<content:encoded><![CDATA[<p>A few LVM notes to jog the brain</p>
<p>A. Steps to create the logical volume..</p>
<p>List the current physical volumes.  In this instance, were interested in a blank 20GB SATA &#8211; /dev/sdb.  You can extend a logical volume by adding additional phyical volumes later.</p>
<p><code>fdisk -l</code><br />
Disk /dev/sda: 21.5 GB, 21474836480 bytes<br />
255 heads, 63 sectors/track, 2610 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x000b5a0f<br />
<span id="more-693"></span><br />
   Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          32      248832   83  Linux<br />
Partition 1 does not end on cylinder boundary.<br />
/dev/sda2              32        2611    20719617    5  Extended<br />
/dev/sda5              32        2611    20719616   8e  Linux LVM</p>
<p>Disk /dev/sdb: 21.5 GB, 21474836480 bytes<br />
255 heads, 63 sectors/track, 2610 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0&#215;00000000</p>
<p>Format the entire disk as an LVM partition<br />
<code>fdisk /dev/sdb</code><br />
n &#8211; new partition<br />
p &#8211; primary<br />
1 &#8211; partition number<br />
Enter &#8211; First cylinder<br />
Enter &#8211; last cylinder<br />
t &#8211; change type<br />
1 &#8211; our partition<br />
8e &#8211; LVM<br />
w &#8211; write</p>
<p>Do the same for any additional disks to be added to the volume group</p>
<p>Prepare the new partitions(s) for LVM:<br />
<code>pvcreate /dev/sdb1</code></p>
<p>Display the new physical volume:<br />
<code>pvdisplay</code></p>
<p>  &#8220;/dev/sdb1&#8243; is a new physical volume of &#8220;19.99 GiB&#8221;<br />
  &#8212; NEW Physical volume &#8212;<br />
  PV Name               /dev/sdb1<br />
  VG Name<br />
  PV Size               19.99 GiB<br />
  Allocatable           NO<br />
  PE Size               0<br />
  Total PE              0<br />
  Free PE               0<br />
  Allocated PE          0<br />
  PV UUID               8dPHo4-Rztw-hOLJ-KW9M-hfjj-XwUJ-g3vyUr</p>
<p>Create a Volume Group<br />
<code>vgcreate wwwfiles /dev/sdb1</code></p>
<p>Display your Volume Group<br />
<code>vgscan</code><br />
or<br />
<code>vgdisplay</code><br />
  &#8212; Volume group &#8212;<br />
  VG Name               wwwfiles<br />
  System ID<br />
  Format                lvm2<br />
  Metadata Areas        1<br />
  Metadata Sequence No  1<br />
  VG Access             read/write<br />
  VG Status             resizable<br />
  MAX LV                0<br />
  Cur LV                0<br />
  Open LV               0<br />
  Max PV                0<br />
  Cur PV                1<br />
  Act PV                1<br />
  VG Size               19.99 GiB<br />
  PE Size               4.00 MiB<br />
  Total PE              5118<br />
  Alloc PE / Size       0 / 0<br />
  Free  PE / Size       5118 / 19.99 GiB<br />
  VG UUID               w6sdJY-9ehv-8XVE-7azw-WIQz-s9yD-XYyspc</p>
<p>Create a Logical Volume or two in the Group<br />
<code>lvcreate --name site1 --size 4G wwwfiles<br />
lvcreate --name site2 --size 4G wwwfiles</code></p>
<p>Display the Logical Volumes<br />
<code>lvscan</code><br />
or<br />
<code>lvdisplay</code><br />
  &#8212; Logical volume &#8212;<br />
  LV Name                /dev/wwwfiles/site1<br />
  VG Name                wwwfiles<br />
  LV UUID                Lh2yxC-GjpH-RRzC-LG6r-m5h5-zK7A-7lvkYE<br />
  LV Write Access        read/write<br />
  LV Status              available<br />
  # open                 0<br />
  LV Size                4.00 GiB<br />
  Current LE             1024<br />
  Segments               1<br />
  Allocation             inherit<br />
  Read ahead sectors     auto<br />
  &#8211; currently set to     256<br />
  Block device           251:3</p>
<p>  &#8212; Logical volume &#8212;<br />
  LV Name                /dev/wwwfiles/site2<br />
  VG Name                wwwfiles<br />
  LV UUID                KVfvbZ-ok5E-IINJ-mjAq-DSoj-7NrS-ojtADK<br />
  LV Write Access        read/write<br />
  LV Status              available<br />
  # open                 0<br />
  LV Size                4.00 GiB<br />
  Current LE             1024<br />
  Segments               1<br />
  Allocation             inherit<br />
  Read ahead sectors     auto<br />
  &#8211; currently set to     256<br />
  Block device           251:4</p>
<p>We now need to add a filesystem to the Logical Volume:<br />
<code>mkfs.ext3 /dev/wwwfiles/site1</code></p>
<p>The Logical Volumes can now be mounted onto the system:<br />
<code>mkdir /var/www/site1<br />
mount /dev/wwwfiles/site1 /var/www/site1</code><br />
check df -h to make sure successful</p>
<p>To make the mount persistent, add a line to /etc/fstab:<br />
<code>/dev/wwwfiles/site1   /var/www/site1     ext3       rw,noatime    0 0</code></p>
<p>B. Enlarge a Logical Volume &#038; filesystem</p>
<p>Unmount it:<br />
<code>umount /var/www/site1</code></p>
<p>Enlarge the Logical Volume:<br />
<code>lvextend -L5G /dev/wwwfiles/site1</code></p>
<p>Check the filesystem:<br />
<code>e2fsck -f /dev/wwwfiles/site1</code></p>
<p>Resize the filesystem:<br />
<code>resize2fs /dev/wwwfiles/site1</code></p>
<p>Remount &#038; check successful:<br />
<code>mount /dev/wwwfiles/site1 /var/www/site1<br />
df -h</code></p>
<p>C. Shrink a Logical Volume &#038; filesystem</p>
<p>Unmount it:<br />
<code>umount /var/www/site1</code></p>
<p>Check the filesystem.  Resizing is specified in blocks, so we need to calculate from this result, how many blocks to give it:<br />
<code>e2fsck -f /dev/wwwfiles/site1</code></p>
<p>Resize the filesystem:<br />
<code>resize2fs /dev/wwwfiles/site1 1048576</code></p>
<p>Shrink the Logical Volume:<br />
<code>lvreduce -L4G /dev/wwwfiles/site1</code></p>
<p>Remount:<br />
<code>mount /dev/wwwfiles/site1 /var/www/site1</code><br />
check df -h to make sure successful</p>
<p>D. Adding another hard disk</p>
<p>Format the entire disk as an LVM partition:<br />
<code>fdisk /dev/sdc</code><br />
n &#8211; new partition<br />
p &#8211; primary<br />
1 &#8211; partition number<br />
Enter &#8211; First cylinder<br />
Enter &#8211; last cylinder<br />
t &#8211; change type<br />
1 &#8211; our partition<br />
8e &#8211; LVM<br />
w &#8211; write</p>
<p>Prepare the new partitions(s) for LVM:<br />
<code>pvcreate /dev/sdc1</code></p>
<p>Add /dev/scc1 to our Volume Group:<br />
<code>vgextend wwwfiles /dev/sdc1</code></p>
<p>Check for the additional space with vgdisplay</p>
<p>E. Remove a disk</p>
<p>Move data off the disk to be removed:<br />
<code>pvmove /dev/sdb1 /dev/sdf1</code></p>
<p>Remove /dev/sdb1 from the Volume Group:<br />
<code>vgreduce wwwfiles /dev/sdb1</code></p>
<p>Verify with vgdisplay</p>
<p>Remove the Physical Volume:<br />
<code>pvremove /dev/sdb1</code></p>
<p>Verify with pvdisplay</p>
<p>*notes*</p>
<p>lvextend can be called in several ways<br />
-L12G = sets to 12GB<br />
-L+2G = adds an additional 2GB<br />
-L+100%FREE = adds all of the remaining free space in the Volume Group</p>
<p>Enlarge a Logical Volume<br />
lvextend -L5G /dev/wwwfiles/site1</p>
<p>Reduce a Logical Volume<br />
lvreduce -L2G /dev/wwwfiles/site1</p>
<p>Delete a Logical Volume<br />
lvremove /dev/wwwfiles/site1</p>
<p>Rename a Logical Volume<br />
lvrename site1 site3</p>
<p>Delete a Volume Group<br />
vgremove wwwfiles</p>
<p>Rename a Volume Group<br />
vgrename wwwfiles files</p>
<p>Remove a physical volume<br />
pvremove /dev/sdb1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/09/some-lvm-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>High Availability Linux Web Server Example</title>
		<link>http://www.tomvernon.co.uk/blog/2011/09/high-availability-linux-web-server-example/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/09/high-availability-linux-web-server-example/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 16:01:31 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[ha]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=688</guid>
		<description><![CDATA[Just a quick example of setting up a Linux HA failover environment for an Apache/MySQL web server. This runs through a Ubuntu installation, however RedHat shouldn&#8217;t vary too much. 2.11.1.24 &#8211; fixed IP of server1 2.11.1.25 &#8211; fixed IP of server2 2.11.1.30 &#8211; apache site1 (virtual IP) 2.11.1.31 &#8211; apache site2 (virtual IP) Make sure [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick example of setting up a Linux HA failover environment for an Apache/MySQL web server.  This runs through a Ubuntu installation, however RedHat shouldn&#8217;t vary too much.</p>
<p>2.11.1.24 &#8211; fixed IP of server1<br />
2.11.1.25 &#8211; fixed IP of server2<br />
2.11.1.30 &#8211; apache site1 (virtual IP)<br />
2.11.1.31 &#8211; apache site2 (virtual IP)</p>
<p>Make sure both servers have a sensible hostname and ensure their hosts files relate to this:</p>
<p>etc/hosts<br />
<code>127.0.0.1	localhost<br />
2.11.1.24	ubuntu-server-1.mydomain.com	ubuntu-server-1<br />
2.11.1.25	ubuntu-server-2.mydomain.com	ubuntu-server-2</code><br />
<span id="more-688"></span><br />
Set up SSH keys so that root can log onto each server.  No passphrase is needed:</p>
<p><code>mkdir /root/.ssh<br />
cd /root/.ssh<br />
ssh-keygen -t rsa<br />
chmod 600 id_rs*<br />
scp id_rs* root@ubuntu-server-2:/root/.ssh<br />
cat id_rsa.pub &gt;&gt; authorized_keys2<br />
ssh root@ubuntu-server-2 "echo \`cat /root/.ssh/id_rsa.pub\` &gt;&gt; ~/.ssh/authorized_keys2"</code></p>
<p>Set up the fixed IP on each server in /etc/network/interfaces:</p>
<p><code># The loopback network interface<br />
auto lo<br />
iface lo inet loopback</code></p>
<p><code> </code></p>
<p><code># The primary network interface<br />
auto eth0<br />
iface eth0 inet static<br />
address 2.11.1.24<br />
netmask 255.0.0.0<br />
gateway 2.3.1.18<br />
broadcast 2.255.255.255<br />
network 2.0.0.0</code></p>
<p>Restart networking and ensure connectivity is working:<br />
<code>/etc/init.d/networking restart</code></p>
<p>Install the HA stuff on both servers:<br />
<code>apt-get install heartbeat pacemaker</code></p>
<p>Install Apache on both servers and disable the startup scripts as pacemaker will be controlling the service:</p>
<p><code>apt-get install apache2<br />
/etc/init.d/apache2 stop<br />
chkconfig apache2 off</code></p>
<p>Add the virtual site IP&#8217;s to the apache configuration on both servers:</p>
<p><code>Listen 2.11.1.30:80<br />
Listen 2.11.1.31:80</code></p>
<p>If you have a line &#8220;Listen 80&#8243; without an IP, you will need to remove this.</p>
<p>Add the relevant virtualhost entries for your sites in /etc/apache2/sites-enabled on both servers<br />
<code><br />
ServerAdmin webmaster@localhost<br />
DocumentRoot /var/www<br />
</code></p>
<p><code> </code></p>
<p><code><br />
ServerAdmin webmaster@localhost<br />
DocumentRoot /var/www2<br />
</code></p>
<p>This might be a good page to start with for testing:</p>
<p><code>&lt;html&gt;&lt;body&gt;&lt;h1&gt;Test&lt;/h1&gt;<br />
&lt;p&gt;This is the default web page for this server.&lt;/p&gt;<br />
&lt;?<br />
$hostname=`/bin/hostname`;<br />
echo "Running on ".$hostname.$_SERVER['SERVER_NAME'];<br />
?&gt;<br />
&lt;/body&gt;&lt;/html&gt;</code></p>
<p>Add something like this to server1 and server2 /etc/heartbeat/ha.cf.  The server its on will ignore its own IP:</p>
<p><code>logfile /var/log/ha-log<br />
logfacility local0<br />
udpport 694<br />
keepalive 2<br />
warntime 15<br />
deadtime 12<br />
initdead 30<br />
ucast eth0 2.11.1.24<br />
ucast eth0 2.11.1.25<br />
node ubuntu-server-1 ubuntu-server-2<br />
auto_failback on<br />
respawn hacluster /usr/lib/heartbeat/ipfail<br />
crm respawn</code></p>
<p>On both servers, edit /etc/ha.d/authkeys, add the following.  Use a strong password/hash.<br />
You can generate some MD5 by <code>echo "lsdknfnlsd;skrwerkorkwprek" | openssl md5</code>:</p>
<p><code>auth 1<br />
1 md5 $1$shRyHw.b$hEMxuYID7wEsK1mvGq8</code></p>
<p><code> </code></p>
<p><code>chmod 600 /etc/ha.d/authkeys</code></p>
<p>Start the heartbeat service on both servers.  Make sure the log exists and check for errors:<br />
<code>/etc/init.d/heartbeat start</code></p>
<p>Install DRBD on both servers:</p>
<p><code>apt-get install drbd8-utils build-essential psmisc<br />
chkconfig drbd off</code></p>
<p>vi /etc/drbd.d/r0.res with something like the following on both servers.  Use a sensible shared key:</p>
<p><code>resource r0 {<br />
protocol C;<br />
syncer {<br />
rate 4M;<br />
}<br />
startup {<br />
wfc-timeout 15;<br />
degr-wfc-timeout 60;<br />
}<br />
net {<br />
cram-hmac-alg sha1;<br />
shared-secret "RUBBERDUCK";<br />
}<br />
on ubuntu-server-1 {<br />
device /dev/drbd0;<br />
disk /dev/sdb;<br />
address 2.11.1.24:7788;<br />
meta-disk internal;<br />
}<br />
on ubuntu-server-2 {<br />
device /dev/drbd0;<br />
disk /dev/sdb;<br />
address 2.11.1.25:7788;<br />
meta-disk internal;<br />
}<br />
}</code></p>
<p>For further filesystems use r1.res r2.res etc. drbd0 becomes drbd1, also the port number must increment. 7788 becomes 7789.  Probably a good idea to use a DRBD filesystem for the web app files, unless they are rarely updated, then rsync etc could be an option.  In this example, I&#8217;m using a plain virtualbox emulated SATA disk.  In reality using LVM might be a good idea.</p>
<p>Blank out the partition to be used for DRBD<br />
<code>dd if=/dev/zero of=/dev/sdb bs=1024k<br />
drbdadm create-md r0</code></p>
<p>Do this again on the second server</p>
<p><code>/etc/init.d/drbd start</code></p>
<p>Run this on the primary server to sync the data (even though its currently empty)<br />
<code>drbdadm -- --overwrite-data-of-peer primary r0</code></p>
<p>It should take a little while, check progress with <code>watch -n1 cat /proc/drbd</code></p>
<p>On the primary server, create an ext3 filesystem on the DRBD disk:</p>
<p><code>drbdadm primary r0<br />
mkfs.ext3 /dev/drbd0</code></p>
<p>On both servers, install mysql</p>
<p><code>apt-get install mysql-server<br />
service mysql stop<br />
chkconfig mysql-server off</code></p>
<p>Mount MySQL data onto the DRBD disk on primary server:</p>
<p><code>mkdir /root/mysql_bak<br />
cp -Ra /var/lib/mysql/* /root/mysql_bak/<br />
rm -rf /var/lib/mysql/*<br />
drbdadm primary r0<br />
mount /dev/drbd0 /var/lib/mysql<br />
cp -Ra /root/mysql_bak/* /var/lib/mysql/<br />
chown mysql:mysql /var/lib/mysql<br />
umount /var/lib/mysql<br />
drbdadm secondary r0<br />
ssh root@ubuntu-server-2 "rm -rf /var/lib/mysql/*"</code></p>
<p>Time to configure the resources:</p>
<p><code>crm configure edit</code></p>
<p>Replace the data with:</p>
<p><code>node $id="05a131a7-7f92-4442-be0f-73fa722f1bb4" ubuntu-server-1 \<br />
attributes standby="off"<br />
node $id="9d31841c-5537-4bc3-b2c2-bfa5021ef880" ubuntu-server-2<br />
primitive apache2 lsb:apache2 \<br />
op monitor interval="5s" \<br />
meta target-role="Started"<br />
primitive drbd_mysql ocf:linbit:drbd \<br />
params drbd_resource="r0" \<br />
op monitor interval="15s"<br />
primitive fs_mysql ocf:heartbeat:Filesystem \<br />
params device="/dev/drbd/by-res/r0" directory="/var/lib/mysql" fstype="ext3" \<br />
op start interval="0" timeout="60" \<br />
op stop interval="0" timeout="120"<br />
primitive ip1 ocf:heartbeat:IPaddr2 \<br />
params ip="2.11.1.30" nic="eth0:0"<br />
primitive ip1arp ocf:heartbeat:SendArp \<br />
params ip="2.11.1.30" nic="eth0:0"<br />
primitive ip2 ocf:heartbeat:IPaddr2 \<br />
params ip="2.11.1.31" nic="eth0:0"<br />
primitive ip2arp ocf:heartbeat:SendArp \<br />
params ip="2.11.1.31" nic="eth0:0"<br />
primitive mysql ocf:heartbeat:mysql \<br />
params binary="/usr/bin/mysqld_safe" config="/etc/mysql/my.cnf" user="mysql" group="mysql" log="/var/log/mysql.log" pid="/var/run/mysqld/mysqld.pid" datadir="/var/lib/mysql" socket="/var/run/mysqld/mysqld.sock" \<br />
op monitor interval="30s" timeout="30s" \<br />
op start interval="0" timeout="120" \<br />
op stop interval="0" timeout="120"<br />
group MySQLDB fs_mysql mysql \<br />
meta target-role="Started"<br />
group WebServices ip1 ip1arp ip2 ip2arp apache2 \<br />
meta target-role="Started"<br />
ms ms_drbd_mysql drbd_mysql \<br />
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"<br />
location cli-prefer-MySQLDB MySQLDB 100: ubuntu-server-1<br />
location cli-prefer-WebServices WebServices 100: ubuntu-server-1<br />
colocation ip_with_arp inf: ip1 ip1arp ip2 ip2arp<br />
colocation mysql_on_drbd inf: MySQLDB ms_drbd_mysql:Master<br />
colocation web_with_ip inf: apache2 ip1 ip2<br />
colocation web_with_mysql inf: apache2 MySQLDB<br />
order arp_after_ip inf: ip1:start ip1arp:start ip2:start ip2arp:start<br />
order fs-mysql-after-drbd inf: ms_drbd_mysql:promote fs_mysql:start<br />
order mysql-after-fs-mysql inf: fs_mysql:start mysql:start<br />
order web_after_ip inf: ip1arp:start ip2arp:start apache2:start<br />
property $id="cib-bootstrap-options" \<br />
dc-version="1.0.9-da7075976b5ff0bee71074385f8fd02f296ec8a3" \<br />
cluster-infrastructure="Heartbeat" \<br />
expected-quorum-votes="1" \<br />
stonith-enabled="false" \<br />
no-quorum-policy="ignore"<br />
rsc_defaults $id="rsc-options" \<br />
resource-stickiness="100"</code></p>
<p>Pay attention to the order.  For example, you will want MySQL to start, after the MySQL filesystem has been mounted<br />
Resource stickiness sets whether the resources should fail back if the primary server comes back online.  0 should fail back, whereas 100 should keep it on the secondary node, ready for a manual failback.<br />
Location sets the preference server for the resource to run on<br />
Colocation sets whether resources should always run on the same server.</p>
<p>Save the changes &#8211; this should automatically replicate to server2.</p>
<p>Things should now be up and running, run <code>crm_mon</code> to check status.  It should look a little like:</p>
<p>============<br />
Last updated: Thu Aug 25 11:38:59 2011<br />
Stack: Heartbeat<br />
Current DC: ubuntu-server-2 (9d31841c-5537-4bc3-b2c2-bfa5021ef880) &#8211; partition with quoru<br />
m<br />
Version: 1.0.9-da7075976b5ff0bee71074385f8fd02f296ec8a3<br />
2 Nodes configured, 1 expected votes<br />
3 Resources configured.<br />
============</p>
<p>Online: [ ubuntu-server-2 ubuntu-server-1 ]</p>
<p>Resource Group: WebServices<br />
ip1        (ocf::heartbeat:IPaddr2):       Started ubuntu-server-1<br />
ip1arp     (ocf::heartbeat:SendArp):       Started ubuntu-server-1<br />
ip2        (ocf::heartbeat:IPaddr2):       Started ubuntu-server-1<br />
ip2arp     (ocf::heartbeat:SendArp):       Started ubuntu-server-1<br />
apache2    (lsb:apache2):  Started ubuntu-server-1<br />
Resource Group: MySQLDB<br />
fs_mysql   (ocf::heartbeat:Filesystem):    Started ubuntu-server-1<br />
mysql      (ocf::heartbeat:mysql): Started ubuntu-server-1<br />
Master/Slave Set: ms_drbd_mysql<br />
Masters: [ ubuntu-server-1 ]<br />
Slaves: [ ubuntu-server-2 ]</p>
<p>You should now see your sites available at http://2.11.1.30 http://2.11.1.31</p>
<p>You should really consider using STONITH to ringfence a dodgy node.  Stonith plugins exist for Dell DRAC / IBM RAS etc thesedays.</p>
<p>Some Useful commands:</p>
<p>crm &#8211; takes you into the crm console.  This tab completes commands so is quite intuitive.<br />
crm_mon &#8211; status monitoring<br />
crm status &#8211; the same<br />
crm configure edit &#8211; edit config<br />
crm configure show &#8211; show config<br />
crm (-F) resource move WebServices ubuntu-server-2 &#8211; force single resource/resourcegroup to another server<br />
crm unmove Webservices &#8211; move resources back to primary</p>
<p>crm node standby ubuntu-server-1 &#8211; take node offline, resources will failover to other server<br />
crm node online ubuntu-server-1 &#8211; bring node online<br />
crm resource restart/start/stop apache2 &#8211; manage a resource (you cant use init scripts anymore!)</p>
<p>References:</p>
<p>http://library.linode.com/linux-ha/ip-failover-heartbeat-pacemaker-drbd-mysql-ubuntu-10.04</p>
<p>http://www.clusterlabs.org/wiki/Documentation#Howtos</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/09/high-availability-linux-web-server-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some NFS Notes</title>
		<link>http://www.tomvernon.co.uk/blog/2011/09/some-nfs-notes/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/09/some-nfs-notes/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 13:17:16 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=686</guid>
		<description><![CDATA[A few notes on configuring NFS on RedHat or Ubuntu The server packages to install are: Ubuntu: apt-get-install nfs-kernel-server nfs-common quota RedHat: yum install nfs-utils nfs-utils-lib quota The client Packages are: Ubuntu: apt-get install nfs-common RedHat: yum install nfs-utils nfs-utils-lib A few things to configure on the server: /etc/hosts.allow Any hosts listed here will be [...]]]></description>
			<content:encoded><![CDATA[<p>A few notes on configuring NFS on RedHat or Ubuntu</p>
<p>The server packages to install are:<br />
Ubuntu:<br />
<code>apt-get-install nfs-kernel-server nfs-common quota</code><br />
RedHat:<br />
<code>yum install nfs-utils nfs-utils-lib quota</code></p>
<p>The client Packages are:<br />
Ubuntu:<br />
<code>apt-get install nfs-common</code><br />
RedHat:<br />
<code>yum install nfs-utils nfs-utils-lib</code></p>
<p>A few things to configure on the server:</p>
<p>/etc/hosts.allow<br />
Any hosts listed here will be granted access to everything i.e<br />
<code>ALL: 2.11.1.2[4-5]<br />
ALL: 192.168.1.*</code><br />
<span id="more-686"></span><br />
or just NFS access:<br />
<code>portmap: 192.168.0.1 , 192.168.0.2<br />
lockd: 192.168.0.1 , 192.168.0.2<br />
rquotad: 192.168.0.1 , 192.168.0.2<br />
mountd: 192.168.0.1 , 192.168.0.2<br />
statd: 192.168.0.1 , 192.168.0.2</code></p>
<p>/etc/hosts.deny<br />
Any hosts here will be denied access i.e<br />
<code>portmap: ALL<br />
lockd:ALL<br />
mountd:ALL<br />
rquotad:ALL<br />
statd:ALL</code><br />
Doing an ALL: ALL would block other services such as SSH. Its a good idea to deny all hosts by default and explicitly list hosts in hosts.allow as any hosts not listed in allow or deny will be automatically allowed.</p>
<p>/etc/exports<br />
Defines what will be shared and to who can be single IP, netgroup, CIDR, wildcard i.e<br />
<code>/home        192.168.0.1(rw) 192.168.0.2(rw)<br />
/files *(rw,all_squash, subtree_check)<br />
/home      192.168.0.0/255.255.255.0(rw)<br />
/files *(rw,sync,no_subtree_check,anonuid=222,anongid=1001)</code></p>
<p>* = share to ALL allowed hosts<br />
ro= read only<br />
rw = read write<br />
root_squash = (default) maps root requests to the anonymous user<br />
no_root_squash = remote root user is root!<br />
all_squash = all remote users become anonymous user<br />
subtree_check / no_subtree_check = When subdirectories of filesystems are exported, the server must check that the tree is in the correct filesystem.  Disabling has mild security implications but can improve performance.</p>
<p>If you make changes to exports later, run rpcinfo quota for NFS to re-read it.</p>
<p>Make sure the right services are running:<br />
RedHat:<br />
<code>/etc/init.d/nfs start<br />
/etc/init.d/portmap start</code></p>
<p>Ubuntu:<br />
<code>/etc/init.d/nfs-kernel-server start<br />
/etc/init.d/portmap start</code></p>
<p>To connect from the client:</p>
<p>Make sure portmap is running:<br />
<code>/etc/init.d/portmap start</code></p>
<p>Add something like so to your /etc/fstab depending on your options<br />
<code>192.168.100.85:/home/myself   /mnt/test  nfs  users,auto,rw   0   0<br />
NAS:/files /files nfs users,auto,rw,sync,rsize=8192,timeo=14,wsize=8192,intr    0       0</code></p>
<p><code>mkdir /files<br />
mount /files</code></p>
<p>Check the files have mounted correctly</p>
<p>*Notes*<br />
NFS isn&#8217;t the most secure of things &#8211; run only over your local network/VPN/somewhere secure.<br />
Firewalls:<br />
Portmap &#8211; 111TCP/UDP<br />
nfsd &#8211; 2049 TCP-UDP</p>
<p>statd,mountd,lockd,rquotad will generally float around the next available port from portmapper.  You can bind to a specific port:</p>
<p>REDHAT<br />
1. Find some free ports<br />
2. Edit /etc/sysconfig/nfs<br />
<code># NFS port numbers<br />
STATD_PORT=10002<br />
STATD_OUTGOING_PORT=10003<br />
MOUNTD_PORT=10004<br />
RQUOTAD_PORT=10005<br />
LOCKD_UDPPORT=30001<br />
LOCKD_TCPPORT=30001</code></p>
<p>UBUNTU<br />
Edit /etc/default/nfs-common and add</p>
<p>    <code>STATDOPTS="--port 32765 --outgoing-port 32766"</code></p>
<p>Edit /etc/default/nfs-kernel-server and add</p>
<p>    <code>RPCMOUNTDOPTS="-p 32767"</code></p>
<p>Edit /etc/default/quota and add</p>
<p>    <code>RPCRQUOTADOPTS="-p 32769"</code></p>
<p>Create /etc/modprobe.d/local.conf with the contents</p>
<p>    <code>options lockd nlm_udpport=32768 nlm_tcpport=32768</code></p>
<p>Update /etc/services </p>
<p><code># NFS ports as per the NFS-HOWTO<br />
# http://www.tldp.org/HOWTO/NFS-HOWTO/security.html#FIREWALLS<br />
# Listing here does not mean they will bind to these ports.<br />
rpc.nfsd        2049/tcp                        # RPC nfsd<br />
rpc.nfsd        2049/udp                        # RPC nfsd<br />
rpc.statd-bc    32765/tcp                       # RPC statd broadcast<br />
rpc.statd-bc    32765/udp                       # RPC statd broadcast<br />
rpc.statd       32766/tcp                       # RPC statd listen<br />
rpc.statd       32766/udp                       # RPC statd listen<br />
rpc.mountd      32767/tcp                       # RPC mountd<br />
rpc.mountd      32767/udp                       # RPC mountd<br />
rcp.lockd       32768/tcp                       # RPC lockd/nlockmgr<br />
rcp.lockd       32768/udp                       # RPC lockd/nlockmgr<br />
rpc.quotad      32769/tcp                       # RPC quotad<br />
rpc.quotad      32769/udp                       # RPC quotad</code></p>
<p>Update your firewall accordingly and restart NFS.  You may find this doesnt work on your distro as some modules may be compiled in the kernel.  rpcinfo -p will list the port numbers being used &#8211; do a google if its not going to plan!</p>
<p>You will probably want to make sure that the owner of the files on the fileserver and the user(s) accessing them exist on all systems and have the same UID&#8217;s.</p>
<p>Random error I had with NFSv4 was mounting with a UID and GID of 4294967294 even though the system UID&#8217;s matched up correctly. If you can live with v3 then just add -o vers=3 to your mount command.  The better fix is:</p>
<p>edit /etc/idmapd.conf and set Domain on server and client to the &#8220;localdomain&#8221;</p>
<p><code>[General]<br />
Domain = localdomain<br />
[Translation]<br />
Method = nsswitch</code><br />
change the /etc/default/nfs-common file (on both your server and client): set <code>NEED_IDMAPD= yes</code></p>
<p>start and enable idmapd service on both servers</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/09/some-nfs-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Example IPTables rules for a webserver</title>
		<link>http://www.tomvernon.co.uk/blog/2011/05/example-iptables-rules-for-a-webserver/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/05/example-iptables-rules-for-a-webserver/#comments</comments>
		<pubDate>Sat, 28 May 2011 13:38:19 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[IPTables]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=683</guid>
		<description><![CDATA[Just a quick and basic example IPTables ruleset to secure a web/mail server: # Allow outgoing traffic and disallow any passthroughs iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD DROP # Allow traffic already established to continue iptables -A INPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT # Allow web services iptables -A [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick and basic example IPTables ruleset to secure a web/mail server:</p>
<p># Allow outgoing traffic and disallow any passthroughs</p>
<p>iptables -P INPUT DROP<br />
iptables -P OUTPUT ACCEPT<br />
iptables -P FORWARD DROP</p>
<p># Allow traffic already established to continue</p>
<p>iptables -A INPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT<br />
<span id="more-683"></span><br />
# Allow  web services</p>
<p>iptables -A INPUT -p tcp &#8211;dport ssh -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport domain -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport ftp -i eth0 -j ACCEPT<br />
iptables -A INPUT -p udp &#8211;dport ftp -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport ftp-data -i eth0 -j ACCEPT<br />
iptables -A INPUT -p udp &#8211;dport ftp-data -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 80 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 443 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 25 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 465 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 110 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 143 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 585 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 993 -i eth0 -j ACCEPT<br />
iptables -A INPUT -p tcp &#8211;dport 995 -i eth0 -j ACCEPT</p>
<p># Allow local loopback services</p>
<p>iptables -A INPUT -i lo -j ACCEPT</p>
<p># Allow pings</p>
<p>iptables -I INPUT -p icmp &#8211;icmp-type destination-unreachable -j ACCEPT<br />
iptables -I INPUT -p icmp &#8211;icmp-type source-quench -j ACCEPT<br />
iptables -I INPUT -p icmp &#8211;icmp-type time-exceeded -j ACCEPT</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/05/example-iptables-rules-for-a-webserver/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t be a Tw@t &#8211; Use At!</title>
		<link>http://www.tomvernon.co.uk/blog/2011/05/dont-be-a-twt-use-at/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/05/dont-be-a-twt-use-at/#comments</comments>
		<pubDate>Sat, 28 May 2011 12:58:02 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=680</guid>
		<description><![CDATA[Sigh today I made a schoolboy error &#8211; making config changes to a live firewall on a remote server without giving myself any kind of safety net! Anyway, this is an example of where you should really use something like the at command to bail you out should anything go wrong: get the current system [...]]]></description>
			<content:encoded><![CDATA[<p>Sigh <img src='http://www.tomvernon.co.uk/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  today I made a schoolboy error &#8211; making config changes to a live firewall on a remote server without giving myself any kind of safety net!  Anyway, this is an example of where you should really use something like the at command to bail you out should anything go wrong:</p>
<p>get the current system time:<br />
<code>date</code></p>
<p>Schedule at to run a command 5 minutes from now:<br />
<code>at -m 13:50<br />
service iptables stop<br />
ctrl-d</code><br />
<span id="more-680"></span><br />
Now, make those firewall changes that you need to, without worrying!</p>
<p>If all goes belly up, at will stop the firewall in 5 mins.</p>
<p>If all goes well, you can cancel the at command:<br />
<code>atq<br />
atrm 2</code></p>
<p>/numptyness</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/05/dont-be-a-twt-use-at/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Apps for a System Administrator</title>
		<link>http://www.tomvernon.co.uk/blog/2011/05/android-apps-for-a-system-administrator/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/05/android-apps-for-a-system-administrator/#comments</comments>
		<pubDate>Fri, 27 May 2011 12:03:43 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=665</guid>
		<description><![CDATA[With phones getting smarter and smarter, its now possible to monitor servers and perform basic administration tasks from your android handset. Here are a few tools I find useful. Connectbot is a great SSH client for the Android. It is fully functional, supporting SSH keys and copy/paste etc. &#160; For Windows RDP connections, I found [...]]]></description>
			<content:encoded><![CDATA[<p>With phones getting smarter and smarter, its now possible to monitor servers and perform basic administration tasks from your android handset.  Here are a few tools I find useful.</p>
<p style="text-align: left;"><code>Connectbot</code> is a great SSH client for the Android.  It is fully functional, supporting SSH keys and copy/paste etc.</p>
<p style="text-align: center;"><a href="http://www.tomvernon.co.uk/blog/wp-content/uploads/connectbot.jpg"><img class="size-thumbnail wp-image-672 aligncenter" title="connectbot" src="http://www.tomvernon.co.uk/blog/wp-content/uploads/connectbot-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p>&nbsp;</p>
<p style="text-align: left;">For Windows RDP connections, I found <code>PocketCloud</code> to be the nicest to use free app, but at the time of writing there was a keyboard bug on Samsung handsets.  <code>Remote RDP Lite</code> does the same thing in a less elegant way.</p>
<p><span id="more-665"></span></p>
<p style="text-align: left;"><a href="http://www.tomvernon.co.uk/blog/wp-content/uploads/pocketcloud.jpg"><img class="size-thumbnail wp-image-674 aligncenter" title="pocketcloud" src="http://www.tomvernon.co.uk/blog/wp-content/uploads/pocketcloud-145x150.jpg" alt="" width="145" height="150" /></a></p>
<p><code>K-9 Mail + APG</code> &#8211; The standard Android mail client isn&#8217;t too impressive.  K-9 mail bring much more functionality and usability, whilst adding APG allows you to manage GPG/PGP encrypted emails.</p>
<p><code>net swiss tools</code> &#8211; A small networking utility suite allowing you to quickly ping, check ports, traceroute etc.</p>
<p><code>andftp</code> &#8211; A pretty decent FTP client that also support SCP, FTPS etc.</p>
<p>Generally I get my nagios monitoring alerts via email, but <code>nagdroid</code> is quite a cool little nagios monitoring app for the android.  It&#8217;s not great looking, but runs as a service and pops up whenever there is an alert.</p>
<p><a href="http://www.tomvernon.co.uk/blog/wp-content/uploads/nagroid.jpg"><img class="size-thumbnail wp-image-673 aligncenter" title="nagroid" src="http://www.tomvernon.co.uk/blog/wp-content/uploads/nagroid-150x150.jpg" alt="" width="150" height="150" /></a><!--more--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/05/android-apps-for-a-system-administrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen &#8211; Can be useful!</title>
		<link>http://www.tomvernon.co.uk/blog/2011/05/screen-can-be-useful/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/05/screen-can-be-useful/#comments</comments>
		<pubDate>Fri, 20 May 2011 11:01:13 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=660</guid>
		<description><![CDATA[Screen is something I&#8217;ve never been interested in using previously, but to be honest, it has many benefits. Screen is basically a window manager that allows you to run many windows from your SSH session. By doing this you don&#8217;t need to initiate several SSH sessions to a box when running complex tasks. Also if [...]]]></description>
			<content:encoded><![CDATA[<p>Screen is something I&#8217;ve never been interested in using previously, but to be honest, it has many benefits.  Screen is basically a window manager that allows you to run many windows from your SSH session.  By doing this you don&#8217;t need to initiate several SSH sessions to a box when running complex tasks.  Also if your connection is terminated in the middle of your task, you can resume your screen session.</p>
<p>Basics:</p>
<p>Start screen:<br />
<code>screen</code></p>
<p>Create new screen window:<br />
<code>CTRL + A + C</code><br />
<span id="more-660"></span><br />
Run a command in a new screen window:<br />
<code>CTRL + A + [command]</code></p>
<p>Flip to the nextscreen:<br />
<code>CTRL + A + N</code></p>
<p>Flip to the previous screen:<br />
<code>CTRL + A + P</code></p>
<p>Detach screen (send screen to the background and return to your shell)<br />
<code>CTRL + A + D</code></p>
<p>Show screen sessions:<br />
<code>screen -ls</code><br />
There is a screen on:<br />
        21970.pts-0.ct-1565     (Detached)</p>
<p>Re-attach to a detatched screen:<br />
<code>screen -r [session]</code><br />
screen -r 21970.pts-0.ct-1565 in this case</p>
<p>If your screen is still attached you must detatch it before being able to re-attach:<br />
<code>screen -d [session]</code></p>
<p>To Exit from screen back to your shell, just:<br />
<code>exit</code><br />
[screen is terminating] will let you know your back.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/05/screen-can-be-useful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Java 1.6 JRE and JDK On CentOS5</title>
		<link>http://www.tomvernon.co.uk/blog/2011/05/install-java-1-6-jre-and-jdk-on-centos5/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/05/install-java-1-6-jre-and-jdk-on-centos5/#comments</comments>
		<pubDate>Mon, 09 May 2011 08:40:36 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=655</guid>
		<description><![CDATA[Very busy right now, so here&#8217;s a quick and dirty writeup for install Java 1.6 on centos5. To install the JDK yum install -y jpackage-utils wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64-rpm.bin?BundledLineItemUUID=KxWJ_hCuwSUAAAEvTWRZB8TT&#038;OrderID=WeuJ_hCuedUAAAEvLGRZB8TT&#038;ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&#038;FileName=/jdk-6u14-linux-x64-rpm.bin chmod +x jdk-6u14-linux-i586-rpm.bin ./jdk-6u14-linux-i586-rpm.bin To install the JRE If you dont have a build environment yet, create one (non-root user!) For example: yum install -y rpm-build gcc gcc-c++ [...]]]></description>
			<content:encoded><![CDATA[<p>Very busy right now, so here&#8217;s a quick and dirty writeup for install Java 1.6 on centos5.</p>
<p>To install the JDK</p>
<p><code>yum install -y jpackage-utils<br />
wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64-rpm.bin?BundledLineItemUUID=KxWJ_hCuwSUAAAEvTWRZB8TT&#038;OrderID=WeuJ_hCuedUAAAEvLGRZB8TT&#038;ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&#038;FileName=/jdk-6u14-linux-x64-rpm.bin<br />
chmod +x jdk-6u14-linux-i586-rpm.bin<br />
./jdk-6u14-linux-i586-rpm.bin</code><br />
<span id="more-655"></span><br />
To install the JRE</p>
<p>If you dont have a build environment yet, create one (non-root user!) For example:</p>
<p><code>yum install -y rpm-build gcc gcc-c++ redhat-rpm-config<br />
useradd builder<br />
su - builder<br />
vi ~/.rpmmacros</code><br />
add the following:<br />
<code>%_topdir /home/<username>/rpmbuild<br />
%_tmppath %{_topdir}/tmp<br />
mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}<br />
cd ~/rpmbuild/SOURCES<br />
Download Sun JDK 1.6 update 14 jdk-6u14-linux-i586.bin or jdk-6u14-linux-x64.bin<br />
wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64.bin?BundledLineItemUUID=cDCJ_hCudtMAAAEvQWRZB8TT&#038;OrderID=WeuJ_hCuedUAAAEvLGRZB8TT&#038;ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&#038;FileName=/jdk-6u14-linux-x64.bin</code></p>
<p><code><br />
cd ~/rpmbuild/</code><br />
Download the nosrc.rpm from jpackage<br />
<code>wget  wget http://mirrors.dotsrc.org/jpackage/6.0/generic/SRPMS.non-free/java-1.6.0-sun-1.6.0.14-1jpp.nosrc.rpm</code></p>
<p>Rebuild the packages:<br />
<code>rpmbuild --rebuild java-1.6.0-sun-1.6.0.14-1jpp.nosrc.rpm</code></p>
<p>exit to root user</p>
<p><code>yum install jpackage-utils</code><br />
Make sure you install the java and devel package, otherwise alternatives wont configure 1.6 properly<br />
<code>yum --nogpgcheck localinstall java-1.6.0-sun-1.6.0.14-1jpp.x86_64.rpm java-1.6.0-sun-devel-1.6.0.14-1jpp.x86_64.rpm</code></p>
<p>Select the new version of java to use:</p>
<p><code>alternatives --config java</code></p>
<p>Confirm that the correct version of java is running:</p>
<p><code>java --version</code></p>
<p>If its wrong, check the symlink for /usr/bin/java<br />
Also check the $JAVA_HOME variable<br />
Restart tomcat or whatever is using Java, to make sure its using the new JVM.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/05/install-java-1-6-jre-and-jdk-on-centos5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roll back RPM packages &#8211; CentOS/RedHat</title>
		<link>http://www.tomvernon.co.uk/blog/2011/03/roll-back-rpm-packages-centosredhat/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/03/roll-back-rpm-packages-centosredhat/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 10:33:25 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[RPM]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=649</guid>
		<description><![CDATA[Wouldn&#8217;t it be useful to be able to easily undo a yum/RPM change that you have just made? Well you can. By default yum/RPM do not save roll back information. This feature can easily be enabled by doing the following, however its not perfect and can use a lot of disk space as its repackaging [...]]]></description>
			<content:encoded><![CDATA[<p>Wouldn&#8217;t it be useful to be able to easily undo a yum/RPM change that you have just made?  Well you can.<br />
By default yum/RPM do not save roll back information.  This feature can easily be enabled by doing the following, however its not perfect and can use a lot of disk space as its repackaging the files whenever you do anything.  Keep an eye on /var/spool/repackage to make sure its not growing too much.</p>
<p>/etc/yum.conf add the line:<br />
<code>tsflags=repackage</code></p>
<p>/etc/rpm/macros add the line:<br />
(create this file if it doesnt exist)<br />
<code>%_repackage_all_erasures 1</code></p>
<p>Once this has been enabled, any install/update/erase you do through yum or RPM will save the roll back information, allowing you to easily roll back the transaction should something bad happen.</p>
<p>Examples:<br />
<code><br />
rpm -Uhv –rollback ’14:00′<br />
rpm -Uhv –rollback ’9 hours ago’<br />
rpm -Uhv –rollback ‘december 12′<br />
rpm -Uhv –rollback ‘yesterday’</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/03/roll-back-rpm-packages-centosredhat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your WordPress.com account, xxx is not authorized to view the stats of this blog.</title>
		<link>http://www.tomvernon.co.uk/blog/2011/03/your-wordpress-com-account-xxx-is-not-authorized-to-view-the-stats-of-this-blog/</link>
		<comments>http://www.tomvernon.co.uk/blog/2011/03/your-wordpress-com-account-xxx-is-not-authorized-to-view-the-stats-of-this-blog/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 10:21:28 +0000</pubDate>
		<dc:creator>Tom Vernon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.tomvernon.co.uk/blog/?p=647</guid>
		<description><![CDATA[So its fair to say that I&#8217;ve been somewhat neglecting this blog &#8211; been far too busy in the world of access control software! Anyway, to start with a simple one, I signed into my wordpress account today and noticed that the site stats weren&#8217;t working with the following error: Your WordPress.com account, xxx is [...]]]></description>
			<content:encoded><![CDATA[<p>So its fair to say that I&#8217;ve been somewhat neglecting this blog &#8211; been far too busy in the world of access control software!</p>
<p>Anyway, to start with a simple one, I signed into my wordpress account today and noticed that the site stats weren&#8217;t working with the following error:</p>
<p>Your WordPress.com account, xxx is not authorized to view the stats of this blog.</p>
<p>Simple fix: wordpress.com stats now seem to be integrated with jetpack.  Disable the stats plugin, then install the jetpack plugin.  You will need a wordpress.com account if you haven&#8217;t got one already.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomvernon.co.uk/blog/2011/03/your-wordpress-com-account-xxx-is-not-authorized-to-view-the-stats-of-this-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

