You need to root it and to unlock bootloader to install any custom OS. You can omit the bootloader unlock part if you find OS which will support the locked one, but you will miss the potential custom kernel features, because it will need to use the stock one. To do the actual unlocking, refer to this guide by Sony: http://developer.sonymobile.com/unlockbootloader/unlock-yourboot-loader/. Beware, though, you'll probably cause bootloop when you unlock BL, so you'll need to flash ftf to boot into the device again (refer to 1)). Also, as far as I remember, you won't be able to download official software updates until you re-lock BL again.
Regarding Ubuntu, there doesn't seem to be an Ubuntu build available for Xperia SP, so you need to build it yourself. According to the Ubuntu site, that shouldn't be hard considering there is a working Cyanogenmod build, but it's not something I'd consider 'basic'. Because I think it falls out of scope for this community (correct me if I'm wrong), I won't go into details, but I'll leave this here if you'd like to know about the process: https://developer.ubuntu.com/en/start/ubuntu-for-devices/porting-new-device/. You can find many (if not all) needed sources by following links on XDA forums here. For example, CM12.1 sources (unofficial, could be slightly unstable) are here.
1) Yes, you can download flashtool and flash appropriate ftf file. This will erase all data on phone (SD card excluded) and leave you with factory version of OS with unlocked bootloader
2) Not as far as I know
P. S. Android is based on Linux, just like Ubuntu, it's just that factory versions have some limitations so regular users don't destroy their devices. If you'd just like to unlock 'full potential', you can grab a custom ROM from XDA and enable root. They usually have nice additions, including themes, tethering, terminal emulator and much more other customization options (depending on the selected ROM).