http://www.debianadmin.com/upgrade-cisco-ios-on-router-and-switche.html

Setup a TFTP server in the same IP range as the Cisco device to backup the configs, IOS image and also for later to upload the new IOS image.

testrouter# copy startup-config tftp
Address or name of remote host []? 10.10.10.2
Destination filename [startup-config]?
!!
1278 bytes c opied in 0.100 secs

Backup Current IOS Image

testrouter# copy flash: tftp:
Source filename []? xxxxx-xx-xx.121-x.XB
Address or name of remote host []? 10.10.10.2
Destination filename [xxxxx-xx-xx.121-x.XB]?

Now, Load the new IOS image from the TFTP onto the flash

ciscorouter#copy tftp: flash:
Address or name of remote host []? 10.10.10.2
Source filename []? c3560-ipbasek9-mz.122-40.SE.bin
Destination filename [c3560-ipbasek9-mz.122-40.SE.bin]?
Accessing tftp://10.10.10.2/c3560-ipbasek9-mz.122-40.SE.bin…
Loading c3560-ipbasek9-mz.122-40.SE.bin from 10.10.10.2 (via Vlan1): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!
[OK - 8295106 bytes]

8295106 bytes copied in 124.571 secs (66589 bytes/sec)

Now you need to make sure you are booting with the correct version of IOS image for this you need to use the following command to set.

testrouter(config)#boot system flash:/c3560-ipbasek9-mz.122-40.SE.bin

Now you need to reload the Cisco Router

testrouter# reload