Saturday, 27 April 2013

Linux and the Desktop

Often as I read my Internet news I note that the perennial question of "Is Linux ready for the desktop?" and I started thinking about it. I've also recently been playing with Windows 8 and I said to my co-worker "Is Windows 8 ready for the desktop?" We both laughed. As an outgrowth of this I started to really look at what it would take for me as a consultant with a range of small and medium business clients to move them to Linux. 

Obviously there are a range of applications that are not cross platform - usually either financial (MYOB etc) or industry specific stuff.Wine could potentially take care of this, or even running Windows in a virtual machine - which is common with people needing Windows XP to run specific software and being unable to run it on Windows 7 (and also 8). As for the common applications like word processing, spreadsheets and presentations there are a range of Open Source versions like NeoOffice, or even Google Apps or Office 365.

If you consider application support beyond the specific software noted above, there are plenty of applications available in your Linux of choice for all the stuff you want to do - video / audio / image editing, video / audio play etc. The options are numerous.

Taking into account Linux's robust architecture and resilience against viruses, trojans and malware, then the operating system starts to really look good. It's not uncommon for me to have a Linux desktop with 30 plus days of up time. Updates are easy and encompass the OS as well as apps, all in one reasonably easy to use package (I like Linux Mint personally and it's great for all these things). 

Take Android for example. Prior to it gaining popularity I bet there were a lot of people asking if Android was ready for the mobile market place. Time has certainly shown that it is. The difference between the mobile phone marketplace and the desktop is simply that the competition is so much more fierce. Microsoft's  stranglehold over the desktop, strengthened by their bundled browser Internet Explorer and Windows Media Player and buy in from all the big software firms. 

Chromebooks - Linux on the desktop! Obviously it's ready - it needs the brilliant packaging and design of MacOS X. And probably someone big to push it. Dell have been offering it for some time now and the excellent Ubuntu Windows installer (also available on Mint) gives the new user a chance to play with it. 

Give Linux a try - if only in a virtual machine and make up your own mind:

Saturday, 30 March 2013

Further adventures of XenServer on the HP N40L Microserver

We all know my delight in using the excellent N40L for all sorts of things. Recently a client of mine had issues with their Dell server - a server that had cost them over $20,000 5 years ago. It runs Windows SBS2003 and does a bit of file serving and not much else. I've migrated them to Google Apps for mail/calendar etc so they aren't even using Exchange. Unfortunately this client has fallen on hard times with the GFC so when this huge and expensive server of theirs began to fail, they asked for a low cost option to save their data and have a minimum of downtime.

I had just purchased an N40L for my test lab and as their disks continued to decline was able to get a complete image of the system. What surprised me was they had a 5 year old server with 7 year old disks in it! What the? I acquired some Western Digital Red Drives and installed them and 8 GB of RAM into the N40L. My initial idea was to use Acronis or similar to do a Universal Restore of the data to the N40L, update drivers and software and put the machine back in. After all, this server lives in their main office space - you can imagine what a Dell 2950 Tower server sounds like in your ear day after day.

Unfortunately my imaging project was unsuccessful. Windows SBS 2003 did not want to play the game and so I was left pondering my next move. I could buy a new copy of Windows SBS (2011 in this case) and migrate data across, a time consuming effort and with the Microsoft Tax on Australian software not an inexpensive option. I could do something dodgy and get a.... no no no. Life is too short to pirate software. At any rate, the option of a physical to virtual migration was available. So I installed XenServer 6 on the HP N40L. I installed to one disk and set up the hardware (really software) RAID via the BIOS. I'm not sure if this mirroring will actually work, because XenServer only sees the two disks. I reasoned that if software RAID is running and I install to one disk, then the BIOS level RAID should mirror both the disks.... when I have the leisure I'll test this. At any rate, 15 minutes later XenServer was up and running and ready for stuff to happen.

Because I was in a hurry I slammed a copy of XenCentre on my notebook, connected to the server and configured a Windows 2003 SBS guest with roughly the same parameters (disk, RAM etc) as the original server, imaged it across as if it was a physical server and held my breath. The server booted in the virtual environment successfully! It was running like a bucket of pus, but after installing the Xen drivers it was running better than the previous version - this made my clients very happy. I configured an external USB drive to act as the back up device and kicked a backup off. It failed and has continued to fail - there seems to be some odd conflict with the device.... at any rate, the server is running and now I need to put a small NAS in for backup purposes - one which I will mirror to an offsite location.

So for a relatively short amount of downtime and much less than a new, full sized server they are operational. When it's time for a proper new server, I'll set it up another XenServer - using hardware RAID this time (which will work) and simply migrate. The server isn't forward facing and the firewall allows only file serving with all other services disabled or firewalled off. It makes for minimal disruption for the client and once I manage to convince them to migrate to FreeBSD or GNU/Linux for their file serving the basic platform will be ready to go - I won't even need to buy another server, simply configure an additional VM and away we go.

Friday, 29 March 2013

HP N40L and FreeNAS 8.3.0

My existing HP N40L Microserver is running out of disk space. 2 TB is not enough it turns out. So I thought why not add another N40L to my network? After all, it's been a success with my existing one thus far.... So on to eBay I went, and I found an Australian company selling them for $209 delivered! I'm amazed these are so cheap - after all even low end PCs are more than this. So I ordered one up and it arrived three days later. I put a couple of 2 TB disks into the box, an 8 GB RAM DIMM and an 8 GB usb drive. Half an hour later I had FreeNAS 8.3.0 installed and a 2 TB array set up.

With an NFS share I can access the 2 TB array from my media PC and it all runs brilliantly. I've got space to add in two extra drives, and once I get two more disks I'll install them - running two 2TB mirrors and sharing out data easily. The N40L runs very quietly and efficiently and even running two of them is very quiet in the lounge room. I've used Western Digital Green Disks from 2 TB external USB drives. For $109 each plus the $209 for the N40L means that for $436 I've got a reasonable little NAS here. Another $218 and I've got a 4 TB NAS! It's stable and runs brilliantly. FreeNAS is an excellent platform for this, easy to upgrade and very stable with a wide range of network protocols available for connection to it. I'd heartily suggest using a server like this for a backup server or simple data storage. Add a couple of extra gigabit ethernet ports via the PCI Express card slots and then LAGG them together for greater through put and this simple and inexpensive NAS has even more applications in the business arena. I would strongly recommend 8 GB or more of RAM so pre-caching can be effected - this will improve data delivery.

As I type this I note an update for FreeNAS has become available so I'll grab that and install it!

FreeNAS details here: http://www.freenas.org

HP N40L Microserver details can be found here - HP N40L Microserver (URL truncated because it's awful)

SSD's - a new lease on life for older hardware

Solid State Disks have been on the market for a while now and the prices are coming down per gigabyte which is starting to bring them into the realm of affordability. While recently searching to upgrade the disk in my Dell Inspiron 1102 net book I was offered a 128GB SSD. I didn't really think much of what it would do in the computer until I'd installed it. Once I got the thing imaged and transferred across into the net book I was pleasantly surprised by both the performance boost and also the boost in battery life. I was amazed actually. It was a much better machine than it had ever been, running Windows 7 quite well and most basic Office Apps.

I've procured a second SSD for a venerable Lenovo R500. The specs on this notebook are pretty reasonable, but with a 6 cell battery it's lifespan wasn't great. An upgrade to a 9 cell battery gave it a boost but not a huge one. Installing an SSD made a significant difference. 6 hours of battery life is easily achievable while using the net or office productivity applications. Speed hasn't really been such an issue with this particular laptop but now it's even better.

For high end gaming rigs SSDs are the norm and even in servers now we're seeing them more often. I've changed the set up in my desktop PC - boot from an SSD, with a 2TB SATA disk for data. As the price for SSDs continues to drop they are definitely worth considering for even lower end applications. My two older laptops now are going to be useful for longer and perform better than they ever have before. Consider it for your older SATA capable notebooks!

Friday, 8 February 2013

Traffic Monitoring using Ubuntu Linux, ntop, iftop and bridging

This is an update of an older post, as the utilities change, so has this concept of a cheap network spike - I use it to troubleshoot network issues, usually between a router and the network to understand what traffic is going where. The concept involves a transparent bridge between two network interface cards, and then looking at that traffic with a variety of tools to determine network traffic specifics. Most recently I used one to determine if a 4MB SDSL connection was saturated or not. It turned out the router was incorrectly configured and the connection had a maximum usage under 100Kb/s (!) At $1600 / month it's probably important to get this right - especially when the client was considering upgrading to a faster (and more expensive) link based on their DSL provider's advice.

Hardware requirements:


I'm using an old Dell Vostro desktop PC with a dual gigabit NIC in it - low profile and fits into the box nicely. Added a bit of extra RAM and a decent disk and that's really it. I'm also running this on an old Dell D420 with a gigabit PCMCIA adaptor - useful for the out and about jobs.

Software requirements:


  • Ubuntu 12.04 LTS - I've chosen this for longevity purposes, previously I'd used non-LTS operating systems and the updates naturally ran out. I tried this with FreeBSD 9.1 but had issues with packages and getting traffic across the network bridge effectively (probably more my screw up than FreeBSD's)
  • ntop - network traffic analysis monitor from www.ntop.org. They have version 5 available from the repositories on the site, version 4 is included in Ubuntu 12.04
  • iftop - a neat command line package that shows network usage from a terminal screen. Highly configurable
  • tcpdump or equivalent for deeper packet analysis.

Configuration

Setting up the box and the ethernet bridge
Setting up the box is straight forward - go through the usual Ubuntu installation. Use aptitude or apt-get to install bridge-utils and iftop

We want the network bridge between our ethernet adaptors to come up automatically. To do so edit /etc/rc.local and pop this into it (assuming eth1 and eth2 are the interfaces you want to bridge. I have eth0 configured statically in this instance so I can browse from other machines to it)

/etc/rc.local
brctl addbr br0
ifconfig eth1 0.0.0.0 promisc up
ifconfig eth2 0.0.0.0 promisc up
brctl addif br0 eth1
brctl addif br0 eth2
ip link set br0 up
This will bring the bridge up at boot time.

ntop

After you've added the necessary repositories to your aptitude configuration, install ntop5 using apt-get install ntop5

I run this from the command line - as a service it seems to fail fairly consistently. The command is:

ntop -P /var/lib/ntop -Q /usr/local/share/ntop/spool/ -i br0 -u ntop -m 192.168.0.0/24 -d

-P sets the database file path
-Q sets the spool file path
-i sets the interface (br0 as per /etc/rc.local)
-m sets the local subnet - in this case 192.168.0.0/24 (change to suit)
-d sets it to become a daemon freeing up your terminal
Browse to localhost:3000 to find your ntop installation, or if you have a third network card go to the address on the network e.g. 192.168.0.30:3000 and view your traffic stats.

iftop

To get what I want out of iftop, I run a script that calls it and configure the /etc/iftoprc file. The script is:
bridge_monitor.sh
#!/bin/sh
# customisable settings
LOCALNET="192.168.0.0/24"
IFACE="br0" # the bridged interface
CONF="/etc/iftoprc"
/usr/sbin/iftop -p -n -N -i $IFACE -F $LOCALNET -c $CONF

The contects of /etc/iftoprc are:
dns-resolution: yes
port-resolution: yes
show-bars: yes
promiscuous: no
port-display: source-only
#hide-source: yes
#hide-destination: yes
use-bytes: yes
sort: 2s
#line-display: one-line-both
show-totals: yes

Again customise to suit and start monitoring that network!

Wednesday, 6 February 2013

OTRS Restore Procedure and backup script

As I note in my previous post, I managed to kill my OTRS install and as usual had to trawl around the net to remember how to restore it. In a nutshell:

# mysql -u root -p
msyql> drop database otrs;
mysql> create database otrs;
mysql> ext
# /opt/otrs/scripts/restore.pl -d path_to_backup /opt/otrs

You did back up right?

Nightly I run a script with the following in it:

otrs_backup.sh


#!/bin/bash
# Variables below - change these to suit
NOW=$(date +"%Y-%m-%d_%H-%M") # this gets the correct file name for OTRS backup
LOCAL=/root/backup # a local directory for OTRS to backup to
REMOTE="user@backupserver:~/backup/OTRS/" # remote backup dir - nfs share, ftp or cifs
/opt/otrs/scripts/backup.pl -d $LOCAL # OTRS internal backup (files and DB)
tar -cf $LOCAL/$NOW.tar $LOCAL/$NOW # creates a file from the OTRS backup folder - more efficient to copy over a network
gzip $LOCAL/$NOW.tar
rm -rf $LOCAL/$NOW # tidy up
scp -r $LOCAL/$NOW.tar.gz $REMOTE # scp to remote directory


You may wish to run this from crontab after copying otrs_backup.sh to /usr/local/bin:

0 20 * * * /usr/local/bin/otrs_backup.sh

This will run at 10pm each night - theoretically you could run it more frequently. OTRS databases will a lot of attachments get quite large though so be mindful of that (I have a couple I manage that are 1GB and are only 5 months old)

Enjoy

Upgrading OTRS 3.1 to 3.2.1

After noting that our OTRS (www.otrs.org) was complaining about a major release update pending I took the plunge this morning and set about upgrading it. Initially I ran through the normal upgrade procedure and couldn't log on. Oops. Maybe I need to pay more attention here? Turns out there are quite a few caveats about this upgrade, and I'm hoping that what I note here will assist you - especially the database upgrade stuff. That was a bit of a surprise!

Initially I ran my normal otrs_pre_upgrade.sh script which stops services and backs everything up. That script looks like this:

#!/bin/bash
service cron stop
service apache2 stop
NOW=`date +%F`mkdir /root/backup/$NOW
BDIR=/root/backup/$NOW
cp -R /opt/otrs/Kernel/Config.pm $BDIR
cp -R /opt/otrs/Kernel/Config/GenericAgent.pm $BDIR
cp -R /opt/otrs/Kernel/Config/Files/ZZZAuto.pm $BDIR
cp -R /opt/otrs/var/ $BDIR
/opt/otrs/scripts/backup.pl -d $BDIR

Usually I then ln -s otrs-new otrs and run my upgrade script - but something failed along the way. Here is what I found:

Firstly, there are a lot more PERL modules required in 3.2 - these three caught me out:

  • YAML::XS
  • DBD::ODBC
  • JSON::XS
I added them using aptitude - my OTRS install is on Ubuntu 12.04 LTS (www.ubuntu.com) - easy enough to do and then checked the modules again. If you are following the UPGRADING documentation, you should run:
  • /opt/otrs/bin/otrs.CheckModules.pl
This will tell you what modules you require. I didn't bother with the Oracle or PostgreSQL modules as I'm not using those databases, nor am I interested in the Encode::HanExtra (no Chinese characters). 

Secondly there are database changes to be made. MySQL uses INNODB as the default storage engine. I've never even thought about this before - OTRS had always just run happily without asking me fancy questions about this sort of thing. Now in 9 of the UPGRADING document I had to apply database changes, including changing the default storage engine from INNODB to MyISAM.

Fortunately I stumbled across some nice scripts to do this at Techusers.net - here they are tailored to suit OTRS:

Step 1. Get all the table names from OTRS (you'll have to put in your password and you might have to change root to something more site applicable):
mysql -u root -p -e "SHOW TABLES IN otrs;" | tail -n +2 | xargs -I '{}' echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql

Step 2. Updating all the tables in one go (same as above - password + username update)
perl -p -i -e 's/(search_[a-z_]+ ENGINE=)INNODB/\1MYISAM/g' alter_table.sql 

Step 3. Applying the change to your SQL Database:
mysql -u root -p otrs < alter_table.sql 
Much thanks and kudos to the writers at www.techusers.net - this saved me from doing each table by hand! The search_profile table refused to change from INNODB to MyISAM but when I checked the dbupgrade scripts, this particular table isn't mentioned. It did not seem to affect the overall upgrade.

The rest of the upgrade went fairly smoothly. It's important to note, however, that you must go to Admin -> Packages -> Update Online Repository and then upgrade your packages to get better speed from your OTRS install. I found that after I did this, I restarted the apache service (service apache2 restart) and OTRS began humming along quite nicely. I'm still exploring the new features. Enjoy

Webtop - an impressive remote access tool

 I've been looking for a while for something that allows me to remotely access my home systems. I can't use a VPN, or RDS to connect...