Well, incase of Linux you can simply run the distro using live cds but incase you need to install any other OS inside your real operating system you can do that as well like Windows 7 inside XP. There are many softwares and the most widely used are Virtual Box,VMware & Microsoft Virtual PC. Here I will show you how to install a guest OS using virtual box, first of all install the latest version of Virtual Box from the link below for your computer architecture
http://www.virtualbox.org/wiki/Downloads
Once you install the software, open it and follow the screen shots with instructions as shown below
First of all click on the new button
Then click next on the welcome screen
Type the OS name you are going to install & select the appropriate choice from the options as it will help you in future to recognize from multiple virtual OS installations
Select the RAM you would like to assign to the virtual OS
Select the boot hard disk here whether you would like to create a new virtual drive or would be using the existing virtual drives incase you created earlier but as this is the first install select create new hard disk & click next
After clicking next you will see the file type selection screen for the virtual disk, simply click next without changing anything and after that in the hard disk storage type select dynamically expanding storage reason is explained on the screen itself.
Now here select the virtual disk size for the guest OS
Click finish on the summary screen
Now on the left side select the OS just now you configured & click start
Click next on the first run screen
Here select the optical drive for your main OS or if you are installing from an ISO click the yellow icon to locate the file on your computer and click next.
On the new screen click add and select the ISO image you would like to install
Select the ISO name which got listed here
Now click next once we have finalised the installation media
Now click finish on the summary screen.
You have successfully configured your virtual machine now the installation will start once you click finish and you can proceed like you normally do any installation, incase you need to see how to install different OS you can see using below links
Click Here To See XP Installation
Click Here To See Vista Installation
Click Here To See Windows 7 Installation
Click Here To See Linux Installation
You can download Virtual Box for Windows, Linux, Solaris and using above installation posts can install OS in a OS