You are here
TransIP is hosting my TurnKey Linux VPSs, and they do a very good job. Unfortunately, they chose to no longer offer TurnKey Linux images for easy install on their VPS platform. Also, they don't enable you to upload your own ISO or raw image. This will likely be the same at most other VPS hosters. In this post I'd like to share how you can work around these limitations, and to install TurnKey Linux on such a VPS. This should work on any VPS provider that is using KVM for virtualization (Xen will likely also work).
What it comes down to is that you create a Linux VPS whose boot disk will be overwritten by the raw TurnKey Linux image that you will create on a second temporary VPS.
Strictly speaking, this temporary VPS is not even necessary, but it'll make the process of transferring (streaming) the raw image go a lot faster and more reliable. And in case of TransIP the temporary VPS will only cost you €5 extra if you cancel it within a month. Here are the steps:
- create a new Linux VPS and install Debian 8 on it (single partition, without Desktop Environment)
- reboot
- while in the Grub boot menu, press 'e' to edit the boot parameters
- add ' S' or ' Single' to the end of the line that starts with 'linux /boot/vmlinuz...'
- press Ctrl-x to boot with your modified boot line
- single user mode will be started, enter your root password to log in
- (if necessary) turn on networking by entering: dhclient eth0
- apt-get install netcat
- killall dhclient
- mount -o ro,remount /
- the root filesystem has been remounted readonly
- netcat -l -p 4000 | dd bs=16M of=/dev/vda
- netcat listens for TCP connections on port 4000, piping any incoming data to dd, which will write everything (in chunks of 16 MiByte) to the boot disk of your VPS!
- Note: /dev/vda is my boot device, it could also be /dev/hda or /dev/sda for example, check fdisk -l to be sure
Now we need to get a raw TurnKey Linux image, and stream it to our Linux VPS. The example below is for the TKL 14.1 Lamp image, but you can use any image from www.turnkeylinux.org, as long as you use the VMDK direct download link.
- create a new Linux VPS (at least 30 GiB big), install Debian 8 on it, and log in as root
- apt-get install netcat qemu
- wget http://mirror.turnkeylinux.org/turnkeylinux/images/vmdk/turnkey-lamp-14....
- replace the above URL by the VMDK download link of the TKL image you want to install
- if you use a different image, then change the directory and file names below accordingly
- unzip turnkey-lamp-14.1-jessie-amd64-vmdk.zip
- cd turnkey-lamp-14.1-jessie-amd64
- qemu-img convert -f vmdk turnkey-lamp-14.1-jessie-amd64.vmdk -O raw turnkey-lamp-14.1-jessie-amd64.raw
- dd bs=16M if=turnkey-lamp-14.1-jessie-amd64.raw | nc 123.123.123.123 4000
- replace 123.123.123.123 by the IP-adress of the VPS that has netcat listening for connections
- now wait and don't touch anything, after a (long) while a summary similar to the one below should show:
- 1280+0 records in
- 1280+0 records out
- 21474836480 bytes (21 GB) copied, 224.587 s, 95.6 MB/s
- once you have seen this summary, cloning is complete
Return to the console of the target machine (that is the VPS that you first installed, the one that is listening for connections):
- press Ctrl-c
- stop and start the VPS
- enjoy TurnKey Linux!
Chances are that your boot disk is bigger than 20 GiB, in that case you may want to increase the swap size from 512 MiB to 4 GiB, and resize the root partition to use all remaining space. Here's one way to achieve that (assuming that /dev/vda is your boot device and the second partition starts at sector 1001953, check fdisk -l to be sure):
- fdisk /dev/vda
- in fdisk, enter the following commands:
- d 2 (meaning: delete partition 2)
- n p 2 1001953 default (meaning: add new primary partition 2, occupying all remaining space, where I wrote 'default' you should just press enter to accept the default)
- t 2 8e (meaning: change back the type of partition 2 to 'Linux LVM')
- w (meaning: write the new partition table to disk)
- reboot to make the kernel use the new partition table
- pvresize /dev/vda2
- lvresize --size 4G turnkey/swap_1
- swapoff -a
- mkswap /dev/turnkey/swap_1
- swapon -a
- lvresize -l +100%FREE turnkey/root
- resize2fs /dev/turnkey/root
Hope this helps!
-- Richard
Awesome, thanks for posting! :)
Also it's interesting to hear that they are no longer providing TurnKey appliances. I'll have to get in touch with them and ask about that. Thanks for the heads up.
Add new comment