How to type Malayalam in Ubuntu?
Install ibus first.
sudo apt-get install ibus
or click this.
Install the m17n library which holds the indic fonts (includes good old malayalam).
sudo apt-get install ibus-m17n m17n-contrib
or click this then this.
Go to System ▸ Preferences ▸ Ibus preferences
Take the 'input method' tab.
From the drop down menu Select an input method, choose malayalam ▸ swanalekha and then click on Add.
Open up a text editor, hit CtrlSpace to change the language and type away.
In Ubuntu 16.04 this was what I did. It looks like ibus is already installed, not sure if that is same for all.
Go to System Settings -> Text Entry.
From the input source to use, click on the + button and add your languages. Once you add you can click on the language and choose any specific font you need. Eg: I was going for the recent one Manjari.
To test press the Windows key (Super) + Space (if you have configured different one use that). You can switch to other fonts. Hope that helps someone.