Category Archives: Linux

Creating A Linux USB Boot Drive on Mac OS X

I recently needed to boot a laptop from Linux, but didn’t have any of my Linux boot disks with me. Luckily I had my USB flash drive, so I decided to install a mini-version of Linux. A quick Google searched led me to Recovery is Possible, or RIPLinuX.

Here’s how to install the .iso onto the flash drive:

Open Terminal under Applications → Utilities.

We’ll be using the diskutil command to write the .iso contents to the flash drive. So the first thing to do is determine the block device associated with our flash drive.

Before inserting the drive typediskutil listand hit enter. Insert your drive and run the diskutil list command again.

You should get something like this:

Results of the diskutil list command

As you can see, the flash drive is connected via /disk/dev1, though this may be different on your system. Before you can start writing the data to the flash drive, you need to unmount the drive.

diskutil unmountDisk /dev/disk1

Unmounting the flash drive using diskutil

Now, you’re ready to start writing the data to the drive.

sudo dd if=/path/to/linux.iso of=/dev/disk1 bs=1m

Data has been successfully written to the drive

Once the data has been written to the drive, all that remains is to eject it.diskutil eject /dev/disk1

Eject the flash drive

And you’re done! Remember that in order to boot from the USB drive, the computer that you’re using must support booting from USB devices and that you need to change the boot order in the BIOS.

MyBook World Edition – Time Machine – OSStatus Error 2

If Time Machine is unable to connect to your backup disk with an error message containing “OSStatus Error 2″, then check the permissions on your NAS.

SSH as root into your MBWE and check the permissions for /var and /var/lib.

Use chmod 755 on /var and /var/lib to apply the correct permissions.

Use the Time Machine System Preferences to set your backup disk to your MBWE.

Setting Up Apache, PHP, MySQL – The Easy Way

I’ve been experimenting with Content Management Systems recently, and after some research, I’ve decided to use Joomla for my next couple of projects. The idea is that I don’t need to spend as much time writing code, and I can get a website up and running quickly. In order to get more experience with of Joomla I decided to install it on my MacBook.

In order to use Joomla, you need three things: Apache, PHP and MySQL. Individually, these are easy enough to install, but getting them to work together can be a bit of a headache. Config files need to be edited, file permissions need to be changed, servers need to be started and restarted, and it can be a bit daunting, not to say time consuming.

That’s where MAMP comes in. An acronym for Mac, Apache, MySQL, PHP, it’s a collection of all these programs in one handy installer that does all the work for you. It took a couple of minutes to download and about 30 seconds to install. Once installed you have a full Apache server, MySQL server and PHP 4 and PHP 5 installation. Better still, it doesn’t interfere with any other Apache, MySQL, or PHP installations you may have running, and it’s controllable from a handy Dashboard Widget.

Once MAMP is installed and running, it’s just a matter of downloading the package and installing Joomla. A simple browser-based installer guides you through the setup, and within minutes I was up and running. The only issue I came across was that the permissions of the Joomla folder had to be updated to allow the installation. It was just a matter of selecting the folder, holding Option-I and changing the permissions for “Others”. Done and dusted.

For those of you not on the Mac platform there are also versions for Windows, Linux, and Solaris available, along with a Joomla Standalone Server (Windows based).

CR vs LF vs CRLF

If the above title seems cryptic, it’s supposed to be. It’s representative of a problem that I came across today when I was editing one of the plugins on this site. When I went to check the plugin status, I was shocked to see that instead of the normal options to activate/ deactivate the plugin, all I got was a mish-mash of PHP code.

I couldn’t think why this had happened, then it hit me. I had done the editing on my MacBook. The Mac, just like every other platform has built-in text editors. These editors treat text in much the same way as editors on other platforms, although there is one crucial difference. When you hit the enter key on a Mac, a special character is inserted to signal that a new line should be started. On a Mac, this is called the Carriage Return, or CR, character. On a Windows editor, the enter key inserts a Carriage Return – Line Feed, (CR-LF), character, and on a Linux machine, it’s a Line Feed, (LF), character.

So each of the major platforms treat a new line in a different manner. The upshot is that if you write a text document on a Windows machine, the new line will be interpreted correctly on both a Linux and Mac, as it uses characters common to both. However, if you write a text document on a Mac, then it won’t be interpreted correctly on a Linux machine, and vice versa.

So here was my problem, I had edited the PHP files on my Mac and uploaded the changed files to a Linux server. Using EditPad Lite for Windows, I was able to easily convert the newline characters from CR to CR-LF, and re-upload the file. Problem solved. The only thing that I can’t figure out is that if Linux has a problem with the CR-only newline character, how come the plugin worked OK?