I am re-writing this how-to, as the original written back in 2007 still gets some visits. People come here looking how to install two Linux distributions on a PC and dual boot them.
That is really easy, the added bonus on this post is that I will also show you, how to share the /home partition so that the user may have access to its documents on both distributions.
Originally this posts was using Debian Etch and Mandriva as examples. I will try to make it more a general tutorial, so it can be used to dual boot, Debian and Ubuntu, Debian and Arch, Ubuntu and Arch or any combinations you may like.
Here are the main considerations you have to take into account:
- Be sure to have the first Linux installing grub or grub 2 on the MBR
- The second installed Linux should install grub on its root partition (Or if you want, do not install grub or grub 2 at all)
- Use the UID and GUID for the users on both Linux distributions
You can also have a Dual boot PC with the same Distro, just to have one for experimenting and the second for your stable work.
There are two ways to do this:
- Have both Linux distributions share /home partition
- Have each distribution with its own /home, and have a third partition to share documents.
The former may have problems with Gnome, KDE or any DE you are using, as they save its configurations files in your home folder. And that may lead to problems. I recommend the latter, but the former may work, specially if you are dual booting two Linux which are very similar, like two Debian versions, or if the two Linux distribution are using different DEs. Test them at your own risk.
Dual boot with two Linux distribution
1. Install the first distribution
When installing the first distribution take care of these points.
- Manually create the partitions
- Do not create your main user just yet (we'll do that later, create a general user like "admin", which you may delete later.
- Leave space on disk for the next Linux distribution
Create partition scheme for dual boot Linux
You can use GParted
First create an extended partition in the whole disk, then create four logical partitions, using this scheme.
- Swap (Maybe 4 Giga bytes read how much swap)
- First Linux distribution (It may be 30% of the disk, disks are really big now, modify according to your needs)
- Second Linux distribution (Same as above)
- Share partition (Rest of the disk, this may be your /home partition, but I recommend you name it /sharing)
Install both Linux distributions
Install the first Linux distribution and let it install grub2 on Mater boot record (MBR), be sure to choose manual creation of partitions when asked, and mount / (root), swap, and /sharing partitions. When asked to create the user create a temporal user, something like (admin).
Now install the second distribution, this time do not install grub at all, and once again choose manually edit the disk, and be sure to mount / (root), swap and /sharing. /sharing and swap are the same /sharing and swap as with the first distribution, but / (root) should be different for both distributions.
Create the common user
We now will create the user or users who will share data between distributions. First think is to create a group in both distributions.
Choose a GID (group ID that is not in use, you can check that by reading the actual group list)
Something like 2000 will be safe.
groupadd sharedusers -g 2000
You will have to be root to run that command. Do the same in both distributions.
To create the users run this, as root:
useradd -m -u 2000 -g sharedusers -s /bin/bash [your_user_here]
Do this also in both distributions, use the same username, and be sure that UID 2000 is not used by doing
cat /etc/passwd, if used, choose another number.
You can then add the group sharedusers to sudo.
Create the shared folder
Now with one of the distributions and as root run this:
mkdir /sharing/documents chown [your_user_name]:sharedusers -R /sharing/documents
That is it. You can now save files in /sharing/documents/ and they will be accessible by your user on both distributions.
To be able to reach the second installed distribution from grub, read here. Enjoy your dual boot Linux machine.