A yummy replacement

14 September 2011 23:14

Had a need to quickly (and easily) replace some yum packages this evening, namely getting mysql5.0 to 5.5 and php5.1 up to 5.3. I wasn’t looking forward to doing this manually as keeping the dependencies in check is a faff at best. A quick Google however led me to the package yum-plugin-replace. This very easily sorts all the plugins out, flips them in out, shakes them all about and quicker than you can say Robert’s your mother’s brother sorts it all out.

Getting it going is easy:

yum install yum-plugin-replace
yum replace mysql --replace-with mysql55

Do the usual confirmations and you’re done! Same goes with php to php53. This does of course assume you’ve already installed the EPEL and IUS channels to get this packages from.

On a side note, if you do mysql don’t forget to run the upgrade script.

mysql_upgrade --password

Filed: Technology // Tagged: , , , // No Comments

Make me a sandwich

8 August 2011 16:05

One for the geeks.

Filed: General // 1 Comment

Ianteresting Info

27 July 2011 14:22

Nothing to do with Ian’s aside from the fact I found them. Also a post more for reference than anything else but a couple of interesting posts I’ve seen recently.

News that Velocity are running an EU conference is also welcome news.

Filed: Technology // Tagged: , // No Comments

Bootable OS X Lion USB Drive

27 July 2011 14:16

This has been done to death on the vast expanse of the interweb, but, I’m blogging it anyway more for my own reference than anything else.

OS X Lion is distributed via the App Store however it’s really easy to make a USB drive that’s bootable which you can use to install Lion from.

  1. Load up Mac App Store, login, purchase and download OS X Lion.
  2. Once downloaded, open Finder and go to the Applications and locate the “Install Max OS X Lion” file
  3. Right click on the downloaded file and select “Show Package Contents”.
  4. Go to “Contents”, then inside the “SharedSupport” folder and you’ll find a file titled “InstallESD.dmg”. Copy this over to the desktop. Make sure you copy and paste rather than drag & drop this file.
  5. Plugin the USB drive you want to use. 4GB is enough, but, I’d do it on an 8GB one. I used one of these with Amazon’s frustration free packaging, which rocks!.
  6. Open up “Disk Utility” and drag InstallESD.dmg from wherever you copied it to in to the left-hand sidebar. Select the attached USB from left side and click on “Partition” tab.
  7. Select “1 Partition” from the Volume Scheme dropdown menu. Choose “Mac OS Extended (Journaled)” from the left.
  8. Now click on “Option” at the bottom. Select “GUID Partition Table” and press OK. Now click on Apply at the bottom right. Be warned this is will erase all data on your USB flash drive.
  9. Once it’s done formatting click on “Restore” (it’s right next to where you clicked on “Partition” in Step 6).
  10. Choose the USB drive you plugged-in in Step 5 as “Destination” with the InstallESD.dmg file as “Source”.
  11. Click Restore and type in your password. This will create the Lion bootable USB flash drive.
After it’s done, you’re pretty much set. You can either carry on and install Lion or you can reboot with your USB drive plugged in and whilst holding down the “Option” key select it and boot up to the installer.

Also, if you don’t back up your machine and loose everything, don’t blame me. Good article on backing up and more specifically cloning can be found over on Craig Grannell’s site.

Thanks to articles on Mashable, Information Week and Redmond Pie.

Filed: Technology // Tagged: , , , // No Comments

CentOS and Dropbox

16 May 2011 22:21

Just because I can really I setup Dropbox syncing on one of my CentOS 5 servers. It’s a little bit of a faff, but, not that hard. The official guide is online, but, this is a shorten version and might not cover everything but it worked on my headless VM just fine.

First up su to whichever user you want to install Dropbox as. You’ll need two terminal’s open so fire them both up now. You’ll also need lynx, gcc and python installed so if you don’t have, sort that out with yum.

In your home directory grab the correct binary for you (x86 or x86_64).

wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86
wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86_64

Now unpack it and start it up in your first terminal window.

tar xvfz dropbox.tar.gz

Now in your second terminal go to http://dropbox.com using lynx (lynx http://dropbox.com) and login, then using the key shortcut “g” paste in the URL that your first window should now be prompted you to go to. This is to register the machine with your Dropbox account. You’ll need to scroll down the page to re-enter your password. Once done the first window should say hello to you and it’ll quit.

Next up sort out the init.d script. Put the following in /etc/init.d/dropbox and chown 755 it when you’re done.

# chkconfig: 345 85 15
# description: Startup script for dropbox daemon
# processname: dropboxd
# pidfile: /var/run/dropbox.pid
# config: /etc/sysconfig/dropbox

# Provides: dropboxd
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start up the Dropbox file syncing daemon
# Description:       Dropbox is a filesyncing sevice provided by dropbox.com
#                    This service starts up the dropbox daemon.

# Source function library.
. /etc/rc.d/init.d/functions

# To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox
# Probably should use a dropbox group in /etc/groups instead.

[ -f /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox

start() {
    echo -n $"Starting $prog"
    if [ -z $DROPBOX_USERS ] ; then
        echo -n ": unconfigured: $config"
        rm -f ${lockfile} ${pidfile}
        return $RETVAL
    for dbuser in $DROPBOX_USERS; do
        daemon --user $dbuser /bin/sh -c "/home/$dbuser/.dropbox-dist/dropboxd&"
    [ $RETVAL = 0 ] && touch ${lockfile}
    return $RETVAL

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox | grep -v grep`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
            echo "dropboxd for USER $dbuser: running (pid $dbpid)"

stop() {
    echo -n $"Stopping $prog"
    for dbuser in $DROPBOX_USERS; do
        killproc /home/$dbuser/.dropbox-dist/dropbox
    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

# See how we were called.
case "$1" in
        echo $"Usage: $prog {start|status|stop|restart}"
exit $RETVAL

Edit /etc/sysconfig/dropbox and add the following line to match your linux account where you’ve installed Dropbox.


Make sure it starts on boot.

chkconfig dropbox on.

That’s it. Enjoy.

Filed: Technology // Tagged: , , // 9 Comments

CentOS/Redhat YUM repositories

23 January 2011 21:05

There’s a bunch of stuff that you can’t always find in the standard CentOS/Redhat repositories. The main repositories I’ve used are EPEL, IUS, REMI and in a specific case Cloudera’s. I used the Cloudera one for flume, but, it’s a quick way to get it installed and the various Hadoop odd’s and end’s. The IUS one is good for MySQL 5.1 and Percona builds, also Git 1.7. The EPEL repo has stuff like Redis and also other newer versions.

If you don’t want to use one you can alias commands to use repos, so, for instance if you have a CentOS build with all the above install you’d get output from yum repolist something like this:

addons        CentOS-5 - Addons
base          CentOS-5 - Base
cloudera-cdh3 Cloudera's Distribution for Hadoop, Version 3
epel          Extra Packages for Enterprise Linux 5 - i386
extras        CentOS-5 - Extras
ius           IUS Community Packages for Enterprise Linux 5 - i38 enabled
updates       CentOS-5 - Updates

If you want to install/search from a specific repo you can either disable them all in the /etc/yum.repos.d/*.repo files and then enable them when you run yum, or, you can leave them all enabled and disable them one by one. Something like this:

alias yum-ius='yum --disablerepo=addons,base,epel,extras,updates,cloudera-cdh3'
alias yum-cloudera='yum --disablerepo=addons,base,epel,extras,updates,ius'
alias yum-epel='yum --disablerepo=addons,base,extras,updates,ius,cloudera-cdh3'

Filed: Technology // Tagged: , , , // 1 Comment

VirtualBox & CentOS

23 January 2011 20:56

If you’ve installed CentOS 5.x using Oracle (Sun) VirtualBox then you’ll have probably had fun getting the guest additions to work. After doing this a few times, each time forgetting which commands I need I’m going to blog it if for nothing but refence!

sudo yum -y install gcc kernel-devel kernel-headers

After you’ve rebooted you should be good to go, again. If you don’t have the right kernel it will moan about OpenGL support, but, you don’t need it.

Filed: Technology // Tagged: , , // No Comments

Repair broken /etc/passwd on QNAP TS-409

7 December 2010 23:10

So, I was messing around with PS1 prompts on my QNAP TS-409 Pro and decided to add it into the .bash_profile. The shell wasn’t BASH so I edited the /etc/passwd to change it, however in my haste I hit save and quit with the shell being /etc/bas – missing an h.

The result is you cannot login via SSH. As only the admin user can login remotely this is a bit of an issue.

A lot of frantic Googling led me to a post on the QNAP forum with a guide on how to fix it. I’m going to repeat these steps here as well with my modifications. I have a 4 disk RAID5 and what I noticed was that when I hot plugged all 4 drives back in the array rebuilt itself and basically kicked me off again.

— Shutdown the system and remove all drives
— Boot, login using telnet to port 13131 (ensure you enable this via the web ui before shutdown)
— Hot plug 3 of the 4 drives (assuming RAID5)
— Assemble the system RAID partition:

# mdadm -A /dev/md9 /dev/sda1 /dev/sdb1 /dev/sdc1 --run
# mkdir /mnt/HDA_ROOT
# mount /dev/md9 /mnt/HDA_ROOT
# cd /mnt/HDA_ROOT/.config

— edit the passwd file and correct any mistakes

# halt (shuts the unit down)

— plug in 4th drive
— power up

Turns out I hadn’t noticed the .profile file which I could have changed and saved a world of pain!

Filed: Technology // Tagged: , , , // 3 Comments

Log response headers in apache

18 November 2010 13:44

I’ve been working on tweaking some apache logging on a few servers and one of the things I needed to log was a response header. The response header in question is an identifier with information about where the request was served from.

A quick look through the apache log docs doesn’t give any clue on how to do this. I details request header logging but not response. A google search also didn’t really come up with anything that useful until I stumbled on an article over on the  apache week site.

A quick modification of the httpd.conf to duplicate the “common” log entry left me with this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{HEADER_NAME}o\"" common2

The key element is the “o”, if you have %{HEADER_NAME}i you’ll get the request header, if you have %{HEADER_NAME}o you’ll get the response header.

This results in the following entry in the log file: - - [18/Nov/2010:13:37:39 +0000] "GET / HTTP/1.1" 200 31006 "HEADER_VALUE"

Filed: Technology // Tagged: , , , // 3 Comments

MAC apachectl ulimit error with 10.6.5

18 November 2010 13:23

If you’ve upgraded to the latest MAC release of Snow Leopard, 10.6.5, and you use apache you may have noticed a bug when you try to control apache with apachectl.

[[email protected] ~]$ sudo apachectl -t
/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument

The release notes detail that apache has been upgraded to 2.2.15 to fix some security holes, however by doing so causes this bug.

The fix is pretty easy and requires you to edit the /usr/sbin/apachectl file. The line you’re looking for is this:

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"

All you need to do is simply remove the actual ulimit command and leave this in place:


Try apachectl again and it’ll work. In my case the offending line was in fact 64, not 82.

Filed: Technology // Tagged: , , // No Comments

Twitter   •   About   •   Contact
©2017 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset