Category Archives: Linux

QNAP TS212 Turbo NAS review

It’s OK folks I’m still alive, here’s a short review of the QNAP TS212 Turbo network attached storage device.

QNAP TS-212

There was an email flying around last month on what to get a friend of mine for his 30th. We decided in the end for a PS3 but his brother suggested a QNAP NAS. I’d never seen any QNAP devices but as my Apple Time Capsule was starting to delete old backups due to disk space I decided to upgrade my backup drive. I went for the TS-212 from Amazon with two 2TB drives.

As always Amazon’s delivery was very prompt and as an extra surprise the NAS had two 1TB drives included. They were 7200rpm so I was tempted to leave them in but decided to throw the 2TB drives in for extra space.

Setup was a breeze using their QFinder utility. I configured the drive with RAID 1 which meant the drives were exact mirrors of each other. All went swimmingly with Samba shares, Bit-torrent downloads and Time Machine working really well. It was running for a few days copying silly amounts of data over to it when I decided to change the IP address of the device. I did this using QFinder rather than the web interface…. The device restart and nada – none of the services restarted. I couldn’t even ssh into it. Somehow the configuration had become corrupt. I tried hardware reset which partially worked as it changed the network configuration back to DHCP so I could now find it but I still couldn’t log in.

I contact their support which who brushed me off with a very quick reply, asking me to try a reset with drives removed and then try and restore the default configuration. This didn’t work, neither did the QNap live CD. Disaster.

I knew all the data was still on the drives so I mounted the data partition of one of the drives on my old desktop using an Ubuntu live CD and was able to copy all backed up data to another drive. I then formatted the 2TB drives and started the whole NAS set up once again. All worked well and is running smoothly now. I’ve yet to restart it but I have the configuration backed up now and I won’t be using QFinder’s network configuration update utility again.

Overall it’s an awesome piece of kit and I would recommend it but I felt a bit put out with support’s brush off. I’ve lost hours trying to get it back to it’s current state.

It’s much better value than an Apple Time Capsule and has buckets more features, my favourite of which are the remote SSH login, Time Machine support and the web interface.

Simple Django install on Amazon EC2

I set up an amazon ec2 instance this weekend and as I knew I’d bedoing it again I noted the steps performed. Hopefully they’ll be of use to someone.

Firstly you need to set up an EC2 account. I’d also recommend downloading ElasticFox(XPIinstaller) which makes it easier to manages instances, volumes andelastic IPs. Also install the EC2API command line tools so you can start and stop instances etc.

The following guide is what I did to set up an Ubuntu 9.10 instance with EBS volume attached and a basic django install running. Bear the following in mind when reading the guide:

  • References to 79.125.24.49 are to my elastic IP address that I set up using Elasticfox so it will be different for you.
  • “philroche” is the username I use so I’d hope you’d be changing that.
  • pk-XXXXXXXXXX.pem is the private key from the x509 certificate that was generated when creating my account
  • cert-XXXXXXXXXX.pem is the certificate file from the x509certificate that was generated when creating my account
  • i-d820f7af is the instance ID assigned to my instance – this will be different for you
  • ec2-79-125-24-49.eu-west-1.compute.amazonaws.com is the public DNS for the instance I created. This will also be different for you.
  • philrocheEC2Europe.pem is the private key for the generated key pair which was generated during account set up
  • The AMI I used (ami-97e4cfe3) has a user “ubuntu” already created that is used for initial login
  • djangoreporting (http://code.google.com/p/django-reporting/)is a simple django app that I used to test the set up.

Seting up Ubuntu 9.10 django install on EC2

  • AMI id = ami-97e4cfe3
  • instance id = i-d820f7af
  • ip address = 79.125.24.49 – I created an elastic IP and assigned it to my instance
  • public dns name =ec2-79-125-24-49.eu-west-1.compute.amazonaws.com
  • login = ssh -i philrocheEC2Europe.pem ubuntu@79.125.24.49 (philrocheEC2Europe.pem is private key generated key pair)
  • enable root user = sudo passwd root
  • change to root user = su
  • add new user = adduser philroche
  • add philroche to sudoers list = visudo
  • add the following to file = philroche ALL=(ALL) NOPASSWD:ALLcheck
  • Disable Password-based Login = nano /etc/ssh/sshd_config
    • check for PasswordAuthentication no
  • check root login is disabled
    • PermitRootLogin no
    • AllowUsers philroche ubuntu
  • restart sshd to take affect = /etc/init.d/ssh restart
  • create .ssh directory for philroche user to store public key =mkdir /home/philroche/.ssh
  • generate key pair LOCALLY in your users’ .ssh directory = ssh-keygen -b 1024 -f philroche -t dsa
  • make temp directory to upload public key = mkdir /home/philroche/tmp
    • chmod 777 /home/philroche/tmp
  • upload public key from LOCAL .ssh directory = scp -i philrocheEC2Europe.pem /home/philroche/.ssh/philroche.pub ubuntu@79.125.24.49:/home/philroche/tmp
  • login again and authorize this key = ssh -i philrocheEC2Europe.pem ubuntu@79.125.24.49
  • authorize the philroche user with uploaded public key = cat/home/philroche/tmp/philroche.pub >> /home/philroche/.ssh/authorized_keys
    • chown philroche:philroche /home/philroche/.ssh
    • chmod 700 /home/philroche/.ssh
    • chown philroche:philroche /home/philroche/.ssh/authorized_keys
    • chmod 600 /home/philroche/.ssh/authorized_keys
  • Delete the tmp directory = rm -rf /home/philroche/tmp
  • Now login as new user (philroche) = ssh philroche@79.125.24.49
  • Install require software = su
    • apt-get update
    • apt-get install apache2 python2.5 mysql-server mysql-client libapache2-mod-wsgi python-mysqldb python-setuptools subversion
    • NOTE – You will be prompted for mysql root password
  • enable the modules
    • a2enmod rewrite
    • a2enmod wsgi
  • make sure wsgi is using python2.5
    • rm /usr/lib/apache2/modules/mod_wsgi.so
    • ln -s /usr/lib/apache2/modules/mod_wsgi.so-2.5 /usr/lib/apache2/modules/mod_wsgi.so
  • add virtual hosts by name support to apache
    • nano /etc/apache2/apache2.conf
    • make sure ‘NameVirtualHost *’ is present
  • install django = easy_install-2.5 django
  • Setting up sample app
    • nano /etc/apache2/sites-available/djangoreporting
    • a2ensite djangoreporting
    • mv /home/philroche/Sites/djangoreporting/reporting /usr/lib/python2.5/site-packages
    • echo ‘/home/philroche/Sites/djangoreporting’ >> /usr/lib/python2.5/site-packages/people_example.pth
    • mysql –user=”root” –password=”%Your root password%”
      • create database djangoreporting;
      • CREATE USER ‘djangoreporting’@’localhost’ IDENTIFIED BY ‘djangoreporting’;
      • GRANT ALL ON djangoreporting.* TO ‘djangoreporting’@’localhost’;
      • exit
  • LOCALLY nano /etc/hosts – add 79.125.24.49 djangoreporting
  • /etc/init.d/apache2 restart python2.5 manage.py syncdb –noinput
  • To manage your instance
    • export EC2_HOME=$HOME/Applications/ec2-api-tools-1.3-46266/
    • export PATH=$PATH:$EC2_HOME/bin
    • export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15/
    • exportEC2_PRIVATE_KEY=/home/philroche/EC2InstanceSetUp/pk-XXXXXXXXXX.pem
    • exportEC2_CERT=/home/philroche/EC2InstanceSetUp/cert-XXXXXXXXXX.pem
    • sh ec2-describe-instances –region eu-west-1
    • sh ec2-stop-instances –region eu-west-1 i-d820f7af
    • sh ec2-start-instances –region eu-west-1 i-d820f7af
    • NOTE – when stoppped and restarted you have to re-associate the IP address

Mapping “djangoreporting” to 79.125.24.49 in my hosts file lets methe test the server by accessing http://djangoreporting/

Links of interest:

Django project dependency management and deployment

I’m not our server admin here at Ticket-Text but the whole issue of project dependency management and deployment does interest me. As such I’ve been looking at ways to help and have compiled the following list of what I have found most useful. I admit I have not read all of these yet but Fabric and virtualenv do definitely seem to be standard now for any django project and they could save alot of work. I’ll let you know how we get on.

Some Djangocon 2009 videos that might be of interest (I have the videos in mp3 format if anybody wants them). The slides are also available @ http://djangocon.pbworks.com/Slides.

If you’re looking for a simpler way to deploy SVN changesets check out my python script SVNArchiveByChangeset which still works a treat for packaging SVN changesets as a zip or tar file.

Ran out space on virtual machine (Virtual Box)

I use VirtualBox OSE for my virtual machines and really love it. I tried to change to the non-free VirtualBox (so I could use USB) but moving from one to the other in Ubuntu was not a simple process and eventually I rolled back (thank Christ for CloneZilla).

I’ve got a Win XP virtual machine with a 10GB hard disk which was getting full so I needed to expand it. The simplest way I found was to use the excellent CloneVDI tool. The tool runs perfectly under wine so I was able to double the size of the disk.

This did not however increase the size of the C drive in Win XP so I installed Partition Magic and resized C to take all available space. Now I’ve got a Win XP virtual machine with tons and tons of space 🙂

Moving to Ubuntu (….kind of)

I’ve signed up for a masters in UCD (Advanced Software Engineering in University College Dublin) starting in December. I’m really looking forward to it and as a treat I bought a new (used) laptop that’ll be just for Uni work. It’s an IBM Thinkpad T43 (Centrino 1.7Ghz and 1GB ram with 40GB HD, Wifi, Bluetooth, PCMCIA, Expresscard and all the other usuals) I bought it on ebay (where else?) for £240 delivered. The build quality is excellent and I’m very happy with it. I’ve got Ubuntu 8.04 running on it and it’s going quite well. I’ve encountered the following problems:

  • I get an “not enough memory” error when I try and hibernate
  • Wireless seems kind of flaky especially with the upgraded NetworkManager, I can’t connect to my Dad’s network and keep getting a 169 IP address but this happens on my Vaio too so I suspect it is the Intel Wireless hardware and my Dad’s DHCP server not playing nice together.
  • I can’t get mobile broadband working (either using the new NetworkManager or UMTSMON)
  • Audio when playing video took a while to get working and had to change from Pulse to the ALSA sound architecture.

Lest not forget that there are millions of positives with Ubuntu, especially the Synaptic package manager and power management.

I’m loving Gnome and I’m trying to find a few cycles to play with MonoDevelop properly. I’ve been trying to get the localising feature in MonoDevelop working with an ASP.NET web application but no joy yet. I can get it working on a command line app though :).

EEEPC – overall thoughts

Overall – I’m really impressed.

Pros

  1. It’s tiny – meaning very portable
  2. It’s light – under one kilo
  3. It’s fast – Celeron 900MHz with 512MB Ram
  4. It runs Linux – Xandros with a very fast window manager by default
  5. Battery life is good considering the size (3-4 hours)
  6. It’s cheap as hell – I paid about 300Euro
  7. It’s got Wifi and webcam – Skype Video on the go
  8. Hibernate works brilliantly with very fast boot times too

Cons

  1. Keyboard is a little small
  2. It’s doesn’t reconnect to wifi when it comes out of hibernate
  3. The WEP WPA software has bugs – you can’t connect to a network with a key that has numbers or spaces in it
  4. The screen is a little too small for constant use – I reckon the planned 10″ models will be alot better

EEEPC in black

Overall I love and I wouln’t hesitate to recommend it considering the price.

Extend Your Browser

Tuesday 6th (the day of my presentation) eventually rolled around. Due to a crazy machine rebuild and re-install fest, I only finished writing the presentation at 1:30pm on the day. It went really well, some very good questions at the end. As I mentioned in my previous entry – the description of the presentation was –

Firefox and the Gecko family of browsers are not simply web browsers, they can be extended to provide custom functionality, and used as platforms for building standalone applications. During the presentation I will discuss the anatomy of the Gecko engine and the Firefox browser, extensions and how to create an extension for the Firefox 2.0 browser using Aggreg8 (http://aggreg8.mozdev.org ) as an example.

Philip is a 2003 Software Engineering graduate of Dublin City University. He has been working at Karova Ltd for two years, on ecommerce and custom web applications, and now holds the position of Senior Developer. Outside the office, he hacks on Firefox extensions and small Python or Perl based open source projects. He loves C#, XSLT, Python, MySQL, WxPython, SVG, XUL, Gecko, Javascript, RSS, CSS, his Labrador puppy, Ubuntu and Mono.

You can now download my preentation-

In MP3 audio format – (no pen clicking this time 🙂 )
ITWalesExtendingYourBrowserPhilipRoche.MP3 [mp3 31 MB – 1 hour 2 minutes]
PDF of my presentation slides
ExtendingYourBrowser-Slides.pdf [pdf 501 KB]
PDF of my presentation slides – including my notes
ExtendingYourBrowser-Notes.pdf [pdf 548 KB]

Enjoy

Geek resolutions

As it’s new year and my motivation is at an all time low, I think a list of TODOs (or new years resultions) is needed. Some of those listed are techy and some are not but all of them are aimed at improving my life.

I will

  • Finish the new design of this site – as you can see, it’s still a work in progress
  • Comment my code
  • Finish projects I have started
  • Document my code properly
  • Use UML – even if it’s just in my head
  • Move to Ubuntu on my home machine
  • Caption all my photos – all 8500 of them
  • Read all the books I bought
  • Read non-techy books too
  • Cook more
  • Eat less
  • Eat healthier
  • Find some way of feeling healthier that I can actually stick to (Gym is a bit too much commitment)
  • Start to budget my outgoings properly
  • Stop calling my dog “the rodent”
  • Learn that Friday does not have to equal “getpissedday”
  • Stop watching soap operas – comedy series like King of Queens and Scrubs will remain on my Sky+ planner though
  • Contribute to an open source project
  • Help fellow developers more
  • Always keep in mind that I know only a fraction of what I think I know
  • Be in a good mood
  • Write another useful Firefox extension that uses a custom XPCOM component
  • Use Patterns in code more
  • Stop driving like an idiot just so I can get home quicker
  • Go to Ireland to see my friends and family more
  • Go to the summer house in Norway
  • Save money
  • And finally – keep this blog up to date

There’s quite a few there so I think it’s more of a two year plan. I have been working on an eight year plan with Gill too, but it’s still a bit up in the air but very exciting – as along as all goes well –

I will also (I thought of some more)

  • Move to IMAP instead of POP email
  • Backup more
  • Learn how to use SVN properly
  • Go to LinuxWorld in London (as long as it’s not on Gill’s birthday like last year)
  • Get a whiteboard at home
  • ……..I’ll add some more as I think of them

Going to the Linux World conference – NOT

I was very interested in going to Linux World this year. There were quite a few speakers and presentations I thought would be very interesting. I had hinted to my boss that I wanted to go but as we are currently a microsoft house, it was not really going to happen.

I figured I could do the whole thing myself for under GBP200 including train and YHA accommodation. I’d researched which YHAs had availability and found the train I was going to take.

There I was, watching TV with Gill, with my iBook on my knee ready to book the train when I called the YHA just to confirm they had a single room. Suddenly, I get a swift kick to the shin, WTF. I ended the call to see Gill giving me evils (a common occurrence I’m afraid), but why this time. I hadn’t got a clue. The day I was planning to go was only her bloody birthday. Doh! Doh! Doh!. So alas there was some apologising, and some postponement of Linux World. Maybe next year.

instLux saved my bacon

instLux, installing linux on a machine with no cd or floppy drive

I was very bored of my toshiba libretto L5 as WinXP was getting crazy slow on it so I never bothered to use it. I wanted to put Ubuntu on it but the live cd or the install would not recognise the PCMCIA cd rom I have.

Then I found instLux which installs a mini Grub onto your windows partition which you boot into. There are 4 versions of instLux, two for Ubuntu and two for OpenSuse. Each distro has a Net install and a CD ROM install version. I tried the CD ROM version first but it couldn’t find the CD rom either.

I booted back into windows and installed the Ubuntu Net install version of instLux. At first attempt, it fried my hard disk after stalling at 6% of install. A quick Win XP reinstall, reboot and retry was successful. I now have Ubuntu 6.06 installed with a very quick gnome theme with all icons turned off. Epiphany is super quick and will be my browser of choice on this machine (I haven’t installed Galeon yet though and Dillo is just minging). I did try to upgrade to Edgy Eft but it failed and after the hassles with the upgrade on my iBook (X wouldn’t start untill I managed to install the ATI drivers again), I’m not going to try again.  It’s a joy to use the machine again.

I’ve had a few freezes and hard reboots but it’s a hell of a lot faster than clunky win XP.