To install software within a virtual machine it is easiest to use the tools Ubuntu installs there (assuming you set it up with Internet access). Here's a list from easiest to hardest:
First Option: Ubuntu Software Center
Located in Menu->Ubuntu Software Center.If you are using Unity, open the dash and type software,then the software center will appear.
Then click on the search box at the top right to search for an application(eg if you type "Ge" -> gedit will show up).
Alternately, click on a category such as Developer Tools and search for the software you want to install.
When you find it,click on the "Install" button at the top right,(or "use source" if you just installed ubuntu), enter your password for verification and wait for the software to install.
Second Option: Installation of .deb files
Since all the apps at ubuntu software center are in fact .deb files,you can search for a .deb file at the internet,download it and then when you choose to open it choose "Open with Ubuntu Sofware Center"
Third Option: Installation of source files (tar.gz,tar.gz2 etc)
That is more like a terminal job rather than easy installation clicks.
1)First of all,after downloading the source file,unzip it with the archive manager and save the unzipped folder of the file somewhere(eg the Desktop)alternatively you can type the command:
$tar -zxvf program.tar.gz
$tar -zjvf program.tar.bz2
2) Run as root by typing
sudo -i , then type your password.
3)Change to the directory of the folder(if you have the folder at the desktop type