Many distributions have syntax highlighting in vim enabled with their default installation. In Ubuntu as well as other Debian based distributions, this is not the case. By default Ubuntu installs the vim-tiny package which does not support syntax highlighting or many other advanced features.
You can see by following the chain of symlinks that in the default installation vim calls vim.tiny.
$ which vim
/usr/bin/vim
/usr/bin/vim -> /etc/alternatives/vim -> /usr/bin/vim.tiny
If you want additional features including syntax highlighting you need to install the vim package.
$ sudo apt-get install vim
Now vim uses vim.basic which is what we want. This version supports all the advanced features.
/usr/bin/vim -> /etc/alternatives/vim -> /usr/bin/vim.basic
The last step is to actually enable syntax highlighting.
To enable it for a single session go into command mode and enter this command:
:syn on
Make these changes permanent for every vim session by opening or creating the .vimrc configuration file in your home directory.
/home/username/.vimrc
Insert the following lines.
if has ("syntax") syntax on endif