Read this first: Installing this software can void your warranty and expose you to malware - and if something goes wrong, it could leave your device unusable. If possible, test the procedures on an old, unwanted device first.

Rooting your phone

Turn on USB debugging on your phone (under Settings | Applications | Development) and connect it to your PC with the USB cable. Run SUPERONECLICK.EXE and click “Root”.

If the phone isn’t recognised, install Samsung Kies. The process takes a few minutes: a notification will pop up when it’s done.

Download

From the Galaxy S II page on the CyanogenMod wiki, download both the codeworkx kernel (containing ClockworkMod) and the Heimdall Suite (for installing it) to your PC.

Then scroll down the page to find links to zip files containing the CyanogenMod 7 ROM and the latest version of the Google Apps. Download these to the phone’s internal storage – not the microSD card, if you have one.

Extract and reboot

Extract the Heimdall zip file into a folder on your PC. Then reboot your phone.

While it’s rebooting, hold down the Home and Volume-Down keys until the phone enters download mode.

Now, on your PC, launch ZADIG.EXE (from the Drivers directory in the Heimdall folder) and enable Options | List All Devices. Pick Samsung Android as shown and click Install Driver. Close the tool when this is done.

Open up

Open the codeworkx ClockworkMod archive (use a tool such as the free 7-Zip archiver) and extract ZIMAGE into the Heimdall directory. Reboot the phone, holding down Home and Volume-Down for download mode.

In Windows, open a command prompt, cd to the Heimdall directory and enter: “heimdall flash – kernel zImage”. ClockworkMod will be installed and the phone will reboot.

Backup

From the main ClockworkMod menu you can back up your stock firmware before installing CyanogenMod.

Use the volume buttons to navigate to “backup and restore”, then press the power button to select.

Backups are written to internal storage. When that’s done, go back to the main menu, select “mounts and storage” and format the cache, data and system partitions. Don’t format the SD card though!

Install

Finally, we install the CyanogenMod firmware. Select “install zip from sdcard”, then “choose zip from sdcard”, and you’ll see a directory listing.

Select the CyanogenMod zip file and confirm the installation. Once it’s installed, repeat the process to install the zip file containing the Google Apps.

Return to the main menu and select “reboot system now” to boot your new OS for the first time.