✓ I'm available for hire! Check out my open source work on Github or drop me an email

Douglas F Shearer

Posts Tagged with linux

There are 10 matching posts.

September 16th 2011

1 comment

Arch Arm Linux on PogoPlug - Keeping Time

I recently procured a PogoPlug V2 from Ebay, hoping to use it as a small linux server for various tasks. A PogoPlug is a small internet-enabled device that allows attached external hard drives to be accessed from anywhere, whether on the local network or on the wider internet, with minimal hassle.

It’s architecture is open, and a flick of a checkbox allows you to SSH in. I decided to install Arch Linux for Arm, and found this to be pretty easy to do following their installation guide.

Unfortunately the PogoPlug does not have a hardware clock, and will consistently think it is 1st of January 1970 after reboots. Not very handy, especially as I was planning to use it to report measurements to external services, and this was time-sensitive.

So, to set the time on each reboot, I installed and enabled the Network Time Protocol client, ntp. Here’s how to do that, and how to set your timezone correctly.

First up, update the package manager to have the latest packages available. You may be asked if you want to update pacman itself, and a bunch of other stuff. In my case it grabbed the latest linux kernel version, and took a fair amount of time. Run this command a few times to make sure everything is the latest it can be.

pacman -Syu

Next up, install ntp.

pacman -S ntp

To enable ntp on startup, edit /edit/rc.conf, adding ntpd to the DAEMONS array, and removing hwclock.

# before: DAEMONS=(hwclock syslog-ng network netfs crond sshd)
DAEMONS=(syslog-ng network netfs crond sshd ntpd)

Next you should configure ntp by editing /etc/ntp.conf. A list of local ntp servers can be found at http://www.pool.ntp.org/. I chose to use the UK servers.

Comment out any existing lines that begin with ‘server’, and add in those you want to use. Append iburst to the end, this specifies how the servers are polled.

server 0.uk.pool.ntp.org iburst
server 1.uk.pool.ntp.org iburst
server 2.uk.pool.ntp.org iburst
server 3.uk.pool.ntp.org iburst

Next, set your timezone. A complete list of zones can be found in /usr/share/zoneinfo. I went with Europe/London. Edit the TIMEZONE variable in /etc/rc.conf, changing it to your chosen zone.

TIMEZONE="Europe/London"

Now restart.

reboot

That’s it! You should now have the correct time and timezone.

# date
Fri Sep 16 19:58:09 BST 2011
 
 

Installing RMagick on Ubuntu Dapper

Having played around with the latest version of the popular Ubuntu distribution in the last week or so, I thought I’d give a quick guide to installing RMagick. Unlike Breezy, Dapper doesn’t seem to work to well with the RMagick Gem (Norman Timmier has some great advice on installing RMagick under Breezy). Instead, use the following apt-get package command (It’s all one line) to get you up and running…

$ sudo apt-get install imagemagick libmagick9 librmagick-ruby-doc librmagick-ruby1.8

That should see you good. Now if you have the irb package you can test that RMagick is indeed loaded. If you don’t have irb installed, install it as so…

$ sudo apt-get install irb

Now you can test RMagick, remembering that the capitalisation is important here…


$ irb
> require 'RMagick'
=> true
> exit

Updated: If it returns true as in the above example, all is good. If you don’t get the true result, something has gone wrong with the installation, best try again it might still be ok, see Tim Hunter’s comment below to see why, thanks Tim.

I hope this guide makes the installation slightly easier for someone, it took me a while when I transitioned to Dapper, I was still used to using the gem like I do on the Mac.

Did you like my Ruby on Rails related article? Then why not recommend me on Working with Rails?

 
 

Search Back Up

Thanks to Jens Kraemer for sending me a copy of the ferret_ext file I was requiring to get my search working. Maybe upgrading from Ubuntu Breezy to Dapper causes a few problems I hadn’t come across before. I’ll need to try a fresh install of Dapper, and see if compiling Ferret works on that. I’m now running Capistrano, a very clever set of Rake deployment scripts for rails. Being able to commit a revision to the live server, and revert to the previous version if it all goes wrong is brilliant.
 
 

Finally Online

After 3 days of torment attempting to get my new Rails app online, it is now up!

My server is now running Ubuntu Dapper with Lighttpd and FastGGI serving my blog. I ran into two problems getting this to work:

  1. First up Ferret does not install properly, and the file ferret_ext appears not to be compiled, and thus unavailable to the app. As soon as I started the server it would crash, citing the missing file. For this reason search is disabled, but will hopefully be reinstated as soon as I have solved my problems with this.
  2. The RMagick Gem wouldn’t work, and was again cited as missing by the server. I uninstalled the RMagick gem, and installed the ruby library available in the Ubuntu packages. I’ll put instructions for this in another Blog post.
Hope you like the new design, I certainly feel it was worth all the effort it took, though I’m slightly disappointed that my search isn’t working for the moment.
 
 

YAND - Yet Another New Design

Yep, my blog now has a new design! It has been over a year since the last one, and I really wanted to try out a design I’ve had on my sketchpad for ages. I can’t remember where I saw this style of blog (dark, light, dark, stuff at bottom etc), but if it does come to me, or I see it again, I’ll put a nod in the right direction, or change it completely if I find it is too similar (This is why using a random sketch isn’t so great, you forget sources, and it looks like plagarism).

Design

  • My navigation is now at the top, but has now been joined by the search box.
  • On the bottom I now keep a short bit about me (which will soon link to the about page), some other links to RSS feeds and the like, and a sampler of gallery pictures (also to be implemented)
    *Tag clouds now appear at the bottom of most pages when there is no comments or older posts to display.

Site Layout

  • The front page of the site now displays the latest blog post, as well as some of the more recent ones.
  • The Weblog page is now where the archives reside, and all my old posts can be found there.
  • On each post’s dedicated page, there is short summary of the post up top, just so people coming straight into the site know where they are.
  • There is a dedicated Tag Cloud page, making it easy to see what subjects I blog most often (bike is currently miles in the lead).
  • These is now a comment feed for the whole site, individual comment feeds for each post, and feeds for each of the tags. I’ll link to the last of those soon so you can try them out.

Architecture

  • Ruby on Rails! Yep, my new site is the result of about two weeks of work with RoR. No more PHP for this blog!
  • Now with tagging. One of my main reasons for changing languages was that I could add new features such as tagging without having to work with old stale code, plus it let me learn something new.

Operating System

Installing mod_fastcgi on Fedora Core 5 was a bit of a nightmare, so I decided to change linux distributions. As I write this I’m currently running Ubuntu Breezy under Parallels desktop on my Macbook. Dapper doesn’t run under parallels for some strange reason, and the Edgy beta is also having problems, so I’ll stick with Breezy for these initial tests. If it doesn’t work out, I’ll also be trying out Solaris 10 and FreeBSD.

Currently the site is served using… Lighttpd under Ubuntu Dapper.

Still to Come

As with all my new releases, it’s a little rough around the edges. The backend is still pretty much a Rails scaffold affair, and I still have features to add such as…

  • Gallery, might simply be Flickr, Zoomr, or Smugmug integration, I’m undecided as yet.
  • About, Bike, Contact, Design, and Links pages.

Side Effects

Obviously all these changes mean that some URLs have changed.

  • All the old blog post addresses will still work, but redirect to their new equivalents.
  • The RSS feed for blog posts has also now moved to feed://douglasfshearer.dyndns.org/feeds/blog, so make sure you update your RSS readers.

See anything wrong?

If you see anything wrong, please don’t hesitate to get in touch: dougal.s@gmail.com

 
 

Share Your iTunes Library to Linux

Some of you may remember my attempts to access or stream my iTunes music library to a linux box. I didn’t get much further with the project, especially as I didn’t really have the time.

Now a Linux project, Amarok has produced a solution. Amarok is a music player for linux that attempts to organise your library in a similar way to iTunes. A new feature in the latest version is Rendezvous sharing, which allows it to hook up to iTunes on another machine, and access the library. Problem solved.

 
 

More Mac to Linux Streaming

Ok, after putting a post up on MacOSXHints I was pointed in the direction of Rogue Amoeba Software. The do a great little app called Nicecast which can take the audio output of a single app, and stream it out as an mp3 stream. After the initial setup (and opening port 8000 on my router), I was able to download a .m3u file, allowing me to listen to the stream on my linux box.

Problem solved? Eh, no! Nicecast comes in at $40, and I’m not really up for paying that much for lots of extra functionality that I’ll never use. I think I may have to look at making my own iTunes plugin. I smell a summer development project…

 
 

Mac to Linux Streaming iTunes Using Skype

Since there isn’t a Linux version of Apple iTunes, I’ve been looking into other methods of streaming music to my workstation.

I basically want a system that works similar to what the Airport Express does. I want to control the music from my iBook, and simply stream it to my workstation over LAN. The workstation is connected to my speakers in another room, and would simply decode the stream.

After giving up the search, I was looking for something else, when I came across this Engadget how-to covering a method of accessing your itunes music library on your mobile phone.

I took the basic idea, and came up with this for streaming iTunes to my Linux workstation:

  1. Install Cycling 74’s SoundFlower onto your system (Mac OS X Only). Make sure you restart after the install. It’s a small system plugin that appears as a sound device in the sound pane of System Preferences. Set both the input and output device in this pane to ‘Soundflower (2ch)’. In this way the Mac is fooled into using whatever sound would usually come out of the speakers as an input instead of the microphone.
  2. Now install Skype on both your Mac, and your receiving system (This can be any OS that accepts Skype). Make sure you are signed in with two different Skype accounts.
  3. Dial one machine from the other, what way round doesn’t matter.
  4. Start iTunes or any other audio producing app on your Mac. Now any sound that you play on your Mac will be played on the speakers attached to your other system.

I tried this out with my iBook running OS X 10.4, and my workstation running Fedora Core 5 Linux. The sound quality isn’t the best, not as good as it could be, but bearable. Perhaps a LAN only audio streaming app would be better, as this would have a higher bitrate codec. Any suggestions?

Update

I thought I might be able to use VLC to stream the audio over my LAN, but turns out UDP unicast from a device isn’t supported under the OS X version. Would work fine from Windows → Linux etc, but not Mac → Linux. The search is still on…

Update 2

I’ve now tried Darwin Streaming Server, the open source version of the Apple Quicktime Streaming Server. This turned out to be way too bloated and complex, and would only let me point to files that the client could stream, rather than pushing a stream taken from a device (In our case the Soundflower ‘device’).

 
 

Downtime

My webserver was down for about 20 hours last night and today, this was while I updated it to Fedora Core 5. The update was successful and everything is back online.

I did have a few difficulties though; MySQL wasn’t liking one of the queries I use on my blog, i figured it must be something to do with the new version not dealing with lower and uppercase named columns in the same way. I re-wrote the query and now it works fine. Secondly, every time I logged into this site, it logged me straight back out again! I soon discovered that this was due to the server not being able to save PHP Sessions, as the folder pointed to by the session path didn’t exist! After creating the folder and setting the correct permissions, everything worked fine.

While I was at it, I took the liberty of naming my iBook, my workstation and my server, so as I can log into them without having to remember their individual IP addresses.

Update

For some reason YUM isn’t playing nice with me, so I don’t have GD image resize support at the moment. If any images are missing on any of my pages, it is because of this. I’m working to fix the problem now.

Update 2

Found a workaround for the problem (For those interested, the $releasever variable was returning Null to the .repos files, causing Yum to return errors. Solution was to replace every instance of the variable with a 5 in the repos), which has now allowed me to install GD. All running fine and dandy now.

 
 

New Workstation

People who know my opinions on computer hardware will probably be quite surprised to see the logo to the right, but yes, I do now have a Xeon workstation!

With two Xeon 1.7Ghx Processors onboard, and 768MB of RAM, it should buzz through the 3D work I have planned fairly quickly. As I demand more from the system, it will likely get a pair of 2.8Ghz or thereabouts processors, and more RAM. I currently have Fedora Core 5 Linux running from a 10GB hard drive I had lying around, but the plan is to buy a pair of 18.2GB 15,000rpm SCSI drives, and create a raid array of them.

When I first ran the machine, I was surprised at just how much noise it made when idle. I don’t mean it was just humming, it was competing with the tumble dryer in the next room! When I tried running two instances of Prime95 to stress test it, I was getting system errors reporting overheating on processor 0. Oh dear I thought, then I remembered that on inspection, one of the CPU heatsink clips had appeared to be broken. A quick modification of the broken clip, and a clean of the CPU and heatsink surfaces, and the machine now runs with no errors, and at an acceptable noise level even at full bore!

Update

I had a lot of trouble getting the Nvidia drivers to work on my machine due to troubles with the earlier Fedora Core 5 kernels. If anyone else is having trouble, or is just wanting instructions on the driver installation, check this thread for full instructions.