Comment Terminator Terminal - 02/10/09

I’ve been using a terminal called Terminator for the last few months instead of the terminal that’s bundled with Ubuntu.  The main reason for this was to take advantage of easy split window creation to enable multiple terminals on the same screen.  This is provided along with tabbed windows, but there also a number of other notable features.  I struggled to find a set of shortcut keys for Terminator initially, so there are a few below along with some explanation of the feature:

 Bash |  copy |? 
CTRL+SHIFT+e
– Split terminal horizontally
 Bash |  copy |? 
CTRL+SHIFT+o 
- Split terminal vertically
 Bash |  copy |? 
CTRL+SHIFT+T
– Open a new tab
 Bash |  copy |? 
CTRL+Tab
– Switch terminals
 Bash |  copy |? 
CTRL+SHIFT+w
– Close currently selected terminal window
 Bash |  copy |? 
CTRL+SHIFT+q
– Close all terminals
 Bash |  copy |? 
CTRL+SHIFT+z
– Maximize currently selected terminal window
 Bash |  copy |? 
CTRL+SHIFT+Left Arrow
– Move split (dragbar) to the left
 Bash |  copy |? 
CTRL+SHIFT+Right Arrow
– Move split (dragbar) to the right
 Bash |  copy |? 
CTRL+SHIFT+Up Arrow
– Move split (dragbar) up
 Bash |  copy |? 
CTRL+SHIFT+Down Arrow
– Move split (dragbar) down
 Bash |  copy |? 
CTRL+SHIFT++
– Increase text size in the terminal
 Bash |  copy |? 
CTRL+SHIFT+-
– Decrease text size in the terminal
 Bash |  copy |? 
CTRL+SHIFT+0
– Restore text size in the terminal
 Bash |  copy |? 
CTRL+Right Click
– moves a window, release the CTRL key to finalise the window position.
 Bash |  copy |? 
F11
– Fullscreen view

You can also get these using to look at all possible options for terminator. Overall it’s a good replacement for the bog standard terminal with some added features.

Comment Postfix and Aliases - 02/3/09

Just a quite post on a simple Postfix installation and some steps that tripped me up a little recently.

I installed a basic version of Postfix on Debian and didn’t want to go through the hassles of configuring a MySQL database for managing users etc… I decided to just use the simple aliases file to manage users. To do this I needed to specify the following in my main.cf file:

 Bash |  copy |? 
myhostname = example.co.uk
mydomain = example.co.uk
myorigin = example.co.uk
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, $mydomain, localhost.$mydomain, mail.example.co.uk

and this in my /etc/aliases file:

 Bash |  copy |? 
postmaster: root
root: example@gmail.com
example: example@gmail.com

I also ran into two more issues with the aliases file:

1. Dictionary issue with /etc/aliases

 Bash |  copy |? 
postfix/smtpd[19065]: fatal: open dictionary: expecting "type:name" form instead of...

The issue here was that Postfix couldn’t read the aliases file. It just needed to convert the /etc/aliases file into the /etc/aliases.db file. The question was how, the answer, like this:

 Bash |  copy |? 
sudo newaliases; sudo postfix reload 


2. Aliases database out of sync

 Bash |  copy |? 
database /etc/aliases.db is older than source file /etc/aliases

The aliases database was not up to date with the aliases file. To fix this I ran the commands above.

Comment Lynx and Persistent Cookies - 01/21/09

Just a quick write up here on persistent cookies and lynx. I was having an issue where lynx was prompting me to accept cookies from Google, Gmail etc… all of the time. I solved this by enabling persistent cookies for lynx 1.8.5.

To do this, you can put the following in lynx.cfg file which resides in your user home directory:

 Bash |  copy |? 
SET_COOKIES:TRUE
ACCEPT_ALL_COOKIES:TRUE
PERSISTENT_COOKIES:TRUE
COOKIE_FILE:~/.lynx_cookies
COOKIE_SAVE_FILE:~/.lynx_cookies

This will store cookies in the .lynx_cookies file. It will also accept all cookies (you may want to omit this and enable cookies for specific domains which is also possible). For more information on the lynx configuration file and the various options see the link below:

One more note, this doesn’t have to go in the lynx.cfg file, you can also put it in a .lynxrc file, but you then may have to alias lynx to read from that file, possibly in .bashrc or .bash_profile, up to you:

 Bash |  copy |? 
alias lynx="lynx -cfg=$HOME/.lynxrc"

And that’s about it.

1 Comment Slicehost Rocks - 11/7/08

I’ve been with Slicehost for over a month now and first impressions of the service are very very good. I’ve been impressed with the overall up-time of the service, I’ve had no downtime issues with the websites I host there.  They also provide a few other value added services:

  • Rails based web management console;
  • Wide choice of distro’s (Debian Etch, Ubuntu, Gentoo, Fedora, Arch – as of Nov 2008);
  • Lots of how-to docs and tutorials;
  • Community features such as a campfire chatroom, irc, wiki etc…

The community side of things is particularly impressive.  It’s always got someone who can help with any issues you encounter and the guys there really know their stuff.  I can’t recommend this side of the service enough.

At present I pay $38 a month for a slice with 512MB ram, 10GB storage and 100GB bandwidth.  They provide a paid for backup service and I also backup the server via a set of rsync scripts which helps to avoid issues that I’ve encountered in the past.

They were recently acquired by Rackspace, along with JungleDisk in a strategic move to compete with Amazon it would seem.  I sincerely hope this doesn’t change the way the company operates or the service it provides.

Slicehost can be found here: http://www.slicehost.com/

Comment Lighttpd Setup and the octet/application stream issue - 10/25/08

Lighttpd is a pretty nifty web server and a lot more lightweight than the likes of Apache, incorporating a number of similar features (webdav, rewrite, vhost, alias,compress) etc…

I just wanted to write a quick post on this as I didn’t find a satisfactory answer on the internet.  I had a small issue setting up lighttpd on debian.  One of the issues was that php pages were served up in Firefox as octet/application streams.  This was because the mime types were configured incorrectly in lighttpd.conf.  In order to fix this you have to define the mime types as follows:

http://redmine.lighttpd.net/wiki/lighttpd/Mimetype.assignDetails

It would seem that the config file provided with lighttpd is a cut down version, that then needs a lot of further work to get php based applications up and running.  Don’t get me wrong, this is a good thing because it teaches you the intracacies of web server configuration.

Essentially serving up php applications via Lighttpd requires fastcgi to be installed.

General Lighttpd Install
The following steps were required under Debian to install the latest version of Lighttpd from source:

  1. Install the Perl compatbile runtime expressions (pcre).  I got the latest version from: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.tar.gz
  2. Install php5-cgi, php5-cli, php5-common, php5-mysql packages using apt-get
  3. Install ruby-fcgi, I got this from
    http://www.moonwolf.com/ruby/archive/ruby-fcgi-0.8.7.tar.gz
  4. Install lighttpd from:
    http://www.lighttpd.net/download
  5. Configure and install using ./configure; make; make install

That’s about it, from there you need a simple startup script and some entries in the config file in /etc.

A word of advice, if you are migrating from Apache or similar web server then you can set Lighttpd on port 81 to test the installation and gradually move your applications over from there.

12 Comments VPSVille – When hosting goes wrong - 10/13/08

I have a funny story regarding a VPS hosting company called VPSVille, actually it’s not a funny story… it’s pretty annoying.

I changed my hosting provider when I moved over to Canada to a company called VPSVille:

www.vpsville.ca

I was originally with a great little company called Bytemark in the UK:

www.bytemark.co.uk

but wanted to move because I wanted to a VPS this side of the “pond”.  VPSVille looked to be good from what I saw of their website and reviews about them.  This is what VPSVille have on their front page:
“Welcome to VPSVille, one of the most advanced VPS service providers on the internet. Virtual Private Servers (VPS) are the future of web hosting. A VPS performs and executes exactly like a stand-alone server; Your VPS can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files. This website is being hosted on one of our VPS’s.”

I was a little concerned about the lack of automated backups – in particular seeing as I’d previously had a backup server with Bytemark.  The VPSVille FAQ stated though:

“We perform regular backups of all our servers and also allow for all users to make their own backups from our custom control panel. You can choose when to backup your server and when to restore it.”

So all good, First impressions were pretty good, cheap, lots of bandwidth for what I wanted, full root access and an installation of Debian Etch, Centos, Fedora whichever I wanted.  I migrated all my websites over along with my MySQL database onto a fresh new Centos install.  I hosted Subversion and Mercurial there, used it to backup my thesis etc…

Gargh
This was back in May, all was good for the next six months or so… until two days ago (Tuesday 7th October to be exact).

All my websites went down that evening…
I figured it was a glitch…
They didn’t come back up the next morning…

I figured something was drastically wrong so I posted a support ticket.  No reply, in fact an hour later the entire support portal was removed from their website along with the user forum.  I decided to have a look to see if anybody else was having similar problem finding this thread on webhostingtalk.com:

http://www.webhostingtalk.com/showthread.php?t=727603

I was in the same position as a lot of other people.  It would appear that VPSVille had pulled the plug on their customers.

VPSVille Announcement

A while later the following announcement appeared on their website, not on the front page I might add, and in very broken English without the use of a spell checker:
“On October the 7th we exeprienced what looks like total failure of some storage devices. This has resulted in data loss for many customers that have been migrated to these new systems. Data recovery is not possible, and we are unable to allocate space for these customers on other nodes. This is a terrible situation and if we could salvage the data in some way we would, but unfortunately its not possible. This data is lost permanently. We also lack the capacity to move affected customers to other nodes.

We are working hard to add more capacity but it will be some time until its online. We are therefore forced to cancel these accounts and starting next week will be refunding all affected customers. We have also suspended all new sign-ups until this situation is resolved and VPSVille returns to normal operations.

Due to the volume of support requests we are unable to respond to affected users individually at this time. We will be in contact with you in the future. Your patience in this regard is appreciated”

so in short we were all pretty screwed and very very annoyed.

The Response
A while later vpsville posted an entry on the forum:

“Hello, we have an announcement on our site now explaining our predicament.

Unfortunately, the data that was lost is permanently gone, and we can’t recover it. We will be canceling all affected accounts and refunding users.

The reason for the outage isn’t power related as we at first thought, it turns out there was a malicious attack on our servers aided by an internal leak. We won’t be accepting new customers until we rebuild all of our servers and templates to ensure they were not tampered with.

This was devastating blow to our business and we understand that our valuable customers are also victims.

When we begin accepting new customers again, rest assured we will be better than ever, and more focused than ever on providing good value hosting for the Canadian market.”

It doesn’t really make things any better does it?  As well as admitting that you didn’t have a sufficient redundant setup in place you’re now telling us that you don’t have the required security measures in place.  In short I lost six websites I’d been working on for two years, a whole Subversion repository (which contained months worth of my thesis work) and lots of other important documents – thanks vpsville!

Moral of the Story
I would advise a number of things here when choosing a Virtual Private Server (VPS) Hosting Company:

1. Research your VPS hosting provider before you invest money, time and effort.  Look at reviews on the internet.  Look for well written reviews from people who clearly explain the issues they had with the hosting provider and what they did about them.

2. Choose an established company not amateurs who have purchased a dedicated server and are looking to divide it up in order to make some quick money.

3. Always, always, always backup your server – even if your VPS provider claims to do this.  You can look at rsync as the simplest method, but there is also rsnapshot or rdiff-backup.

4. Never ever host with VPSVille, full bloody stop.

Update From VPSville (Thanksgiving – ironically)
I had a fairly decent update from VPSville, after a week and a half:

“We here at VPSVille have had a few days of frantic phone calls, hair-pulling, yelling, crying, screaming, sector-recovery tools and angry accusations. We’ve also looked closely at our logs and have pieced together what happened with our recent data loss incident.

Initially we thought it might be a case of gross negligence and some harsh words and harsher threats were exchanged, but we now believe it was just an honest, stupid mistake. Inexperience sunk the ship.

One of our new employee’s made some crucial errors regarding security, and this was compounded by one of our techs travelling abroad and requiring some relaxation in our usually
strict access policy. One firewall in front of another and both temporarily disabled = no firewall at all.

This unfortunately resulted in some malicious SOB with no real life to waltz into an almost unprotected segment of the network through a newly installed appliance with a default password
and start deleting things. Several servers actually and a NAS unit assigned to back them up. One of the servers was our control node, which interfaces between the website and the other servers. Even our mail server was affected.

Some servers were running even after their files were deleted, through some strange quirk of Linux buffering that we still don’t fully understand.

Its easy to blame a hacker of course, but we do feel that an unfortunate series of events combined to make their hack particularly easy. Far to easy for a network of this magnitude and importance to so many people.

This looked like a total loss, with no way to recover the data, so we sent out a somewhat panicked email to affected users that their accounts would just be canceled and refunded. Shortly afterwords our outgoing email died.

This resulted in a torrent of email, most of it surprising friendly, and much of it understandably angry and dismayed, telling us they wished to remain customers even if their data was not recovered.

Happily we were able to restore many servers with sector recovery tools. In light of this we have not arbitrarily canceled any accounts.

All affected accounts are re-enabled and have been credited. If we were able to restore your data we have sent you an email about it (hardware nodes rapier, cutlass and spear).

We sincerely express our condolences to affected customers for this unfortunate series of events, nobody should lose data at VPSVille, its an awful thing and we feel your pain.

Things do happen in life, but this won’t happen again.

- Staff”

So, just to add salt to the wound they admitted poor infrastructure, poor security measures, giving junior employees work to do without providing sufficient training and a complete lack of communication on the issue.  They also claimed they sent the server disks away for recovery.  In fact what they did was to attempt to recover the data using their own tools.

The final reply I got from them on their forums stated this:

“We used several tools, including one given to us by adaptec support. None of the tools were able get the files on Katana. The tools let you view the bytes on the drive in various ways. Its quite interesting actually, if you’d like to know how sector recovery works read up on it or try it yourself.

You need to understand that interrogating us will not get your data back. Your data stored on Katana is gone. We tried our best.”

to which I responded:

“You said you sent the drives off for sector recovery – that’s not quite the same as using some tool you found via Google.”

I understand that interrogating will not get my data back…
I was just trying to ascertain exactly what measures you went to in order to recover the data.

I’m still incredibly annoyed about the lack of communication here, the explanations, the complete lack of professionalism you’ve demonstrated.

You’re obviously not willing to go to any further measures to recover the data. I’d like a refund on my complete hosting charges with you, that amounts to $135.00 in total which is nowhere near how much it will cost me to reimburse the clients I have and the data they have lost.”

I didn’t get a reply….

and most recently:

“I noticed you haven’t applied for a refund, yet you seem very angry. I’m angry about losing data too, but I blame the people that deleted it, not the people who spent days trying to recover it, at no charge.  Please submit your transaction details to refunds@vpsville.ca and I’ll expedite the process for you.”

I had sent my refund, but due to their normal unorganized ways they’d obviously missed it – doh.

You have been warned about hosting with VPSVille.

19 Comments Websphere Install On Ubuntu Hardy Heron - 10/12/08

I recently underwent the painful process of installing IBM Websphere 6.1 on Ubuntu Hardy Heron (8.0.4). there was one issue in particular that I wanted to share involving the process of creating a Websphere profile in order to start a server. This involves running the manageprofiles.sh file with something similar to the following:

 Bash |  copy |? 
sudo bash -x manageprofiles.sh -create -profileName
-profilePath /opt/IBM/WebSphere/AppServer/profiles/
-templatePath /opt/IBM/WebSphere/AppServer/profileTemplates/default/

This fails on Ubuntu with the following error message:

 Bash |  copy |? 
INSTCONFFAILED: The profile could not be created.  For more information, consult the
/opt/IBM/WebSphere/AppServer/logs/manageprofiles/AppSrv01_create.log file

Tracing through this logfile yields the following warning:

 Bash |  copy |? 
/opt/IBM/WebSphere/AppServer/profileTemplates/default/action/generateKeysForSingleProfile.ant:25:
wsadmin task failed with return code :-1

which involves running a shell script called wsadmin.sh which in turn calls this Ant script. It’s not immediately obvious, but the reason this fails is because under Ubuntu the default shell is dash rather than bash. There are two solutions to this

1. Unlink /bin/sh

 Bash |  copy |? 
sudo unlink /bin/sh
sudo ln -s /bin/bash /bin/sh

2. Reconfigure via dpkg

 Bash |  copy |? 
sudo dpkg-reconfigure dash

1 Comment Amazon Elastic Compute, EC2 - 10/12/08

I’m sorry, I’m quite confused about Amazon’s new offering – EC2. It sounds great in theory, elastic IP addresses, cool, persistent storage (eventually – cool), availability zones (cool). However, it’s pretty much the same as paying for a virtual server actually – that’s where my problem starts, how is it different? Ok, so you can fire up your new service using a specific distro, Fedora whatever, yada yada and you can add more instances of that service and have failover between them, groovy but I’m pretty sure you can do this with an existing hosting solution, take Bytemark for example (http://www.bytemark.co.uk/) I’ve been with them for about a year now, I pay around 150 GBP ($300) for the solution per year. That buys me a managed Centos installed O/S on a virtual machine that has 150MB RAM, 10GB space, 50GB in traffic, 2GB backup space, some watchdog type services. I have full root access and can redelegate IP addresses to the DNS as I wish, I can setup more virtual machines via Xen if I want. With Amazon I get:

1.7 GB of memory, 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit), 160 GB of instance storage,

Amazon EC2 is a little easier to manage since I can install an O/S on the fly (which is non persistent as present) but have less control over it and ok it’s more powerful, but at what cost – well the basic amount is $0.10 per hour. Before traffic that’s

24 * $0.10 = $2.40 a day
365 * $2.40 a day = $876.00 per year

Traffic on top of this is $0.10 per GB, so matching with Bytemark that’s another 5 dollars on top so it scales pretty well with regards to that. However, $300.00 a year as opposed to nearly $900.00 a year… For $1200 with Bytemark I get my dedicated server, I’m pretty sure this comes in cheaper than this when we look at dedicated servers in North America. It’s confusing as to whether it’s good value for money or not…

Comment Lighttpd, Tomcat, mod_proxy - 10/12/08

Just a quick guide to setting up Lighttpd (http://www.lighttpd.net/) and Tomcat using mod_proxy. there are only two steps involved here:

1. Make sure mod_proxy is enabled in the list of server.modules

server.modules = ("mod_proxy",
...

2. Add a HTTP host block to redirect requests on localhost to port 8080 for Tomcat.
$HTTP["host"] =~ “127.0.0.1|localhost” {
proxy.server = (
“” =>
(”tomcat” => (”host” => “127.0.0.1″, “port” => 8080, “fix-redirects” => 1) )
)}

Comment PHP, Apache, Windows (Grrr) - 10/12/08

Posted under Design and Architecture by admin on Thursday 17 July 2008 at 2:22 pm

Ok just a few quick notes on stupid Apache, PHP and stupid Windows I wanted to share with people. If you ever have to setup Apache and PHP on Windows there are a few caveats you need to be aware of, especially if you require VirtualHost support for multiple domains. The reason I chose to do this is because I host websites at home on a Centos installation but have an archaic Medi@ TV server by Packard Bell that serves media files via a Powerline network. This means I have to boot into Windows to use it, I haven’t tried sorting this out via Wine yet but I don’t fancy my chances of getting it working. Whilst I’m at it, don’t buy one of these Medi@ TV boxes if you have a 64 bit processor, it just won’t work, plain and simple, I’ve got it running on an old AMD Duron proc. I found a need little driver called Ext2 IFS which allows you to map your Linux EXT2 partitions from Windows. Since I host both O/S’s on the same box this was a requirement. It’s straightforward and works out of the box, this means I could have the same DocumentRoot in the same place in Linux and Windows and be able to write to the DocumentRoot from either O/S. Grade. Apache frustrates me under Windows, the install is straightforward, the setup of the Windows service is pretty straightforward but the error reporting is just plain old stupid.

Service install is achieved via:

 PowerShell |  copy |? 
apache -k install

Service uninstall is achieved via:

 PowerShell |  copy |? 
apache -k uninstall

If you ever have problems with old stray Apache services (or indeed any services under Windows) then you might need to hack your registry and delete a few keys specifically from:

 PowerShell |  copy |? 
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services.

Anyways, that was the first issue. Secondly is the setup of php which should be pretty straightforward. In fact, in hindsight make sure you use the Windows installer rather than the zip file and configuration by hand. It adds the following to httpd.conf:

 PowerShell |  copy |? 
PHPIniDir "D:\\php\\" LoadModule php5_module “D:\\php\\php5apache2_2.dll”

However, make sure that you add the relevant entry to DirectoryIndex:

 PowerShell |  copy |? 
DirectoryIndex index.php index.html

to serve php files. Also:

 PowerShell |  copy |? 
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php .php

to handle the php file type, alternatively modify mime.types under conf and add:

 PowerShell |  copy |? 
application/x-httpd-php php application/x-httpd-php-source phps

You might need to modify php.ini to point to your Apache installation and also to point to your DocRoot:

 PowerShell |  copy |? 
doc_root = "r:\www\html" extension_dir =”D:\php\ext”

And you might need to tweak:

 PowerShell |  copy |? 
upload_max_filesize = 2M

if you’re uploading files from forms. PHP all done. Finally back to Apache to sort out my VirtualHosts for my multiple domain names. First configuration of a name based virtual host and default host:

 PowerShell |  copy |? 
NameVirtualHost *:80
DocumentRoot “R:\\www\\html”

and my set of virtual hosts setup per domain:

 PowerShell |  copy |? 
<VirtualHost _default_:80>
DocumentRoot "d:\\workspace\sanctuary7website"
</VirtualHost>

Note that DocumentRoot has to have the \ escaped \\ under Windows. Doh. All done, up and running.