TechnoJunky
Well-Known Member
A major headache when reinstalling your OS is losing all your settings and all your customizations of your desktop. This isn't a headache you have to endure though. If you have a persistent home partition, all your customizations will be retained. If you have an install script, all your favorite apps can be reinstalled with a simple double click.
First I'll start with is how to setup the persistent home partition. We can most easily do this during the initial installation of Linux on our computer. I'll be using Kubuntu 18.10 for this install example. Other distros will have similar steps.
The first screen after bootup is choosing language and whether you want to Try or Install Kubuntu. We're going to Install. Choose keyboard layout, Normal Install and the next screen brings us to Installation Type. Here the default is guided, use entire disk. We're going to change that to Manual. Next screen we see available drives. Ensure you are choosing the desired drive, hard drive, USB, etc. This is irreversible so installing over top of something means it's permenently erased. Select the freespace on the drive, the create partition window pops up. You will need 3 or 4 partitions depending on what you want to do. I'd suggest going with 4. The first partition you need is the EFI, it's required for UEFI. Next you should have a /boot partition. This partition can be skipped if you will never mutliboot with other distros. However, it will future proof your computer to do it and it doesn't take much space. You should have a swap partition equal to the amount of RAM you have. Next partition is /. This partition is where all your apps get installed. So you may need more, but I never come close to using 40. If you will be installing multiple distros you'll need multiple partitions for /. The rest of the space can be assigned to /home.
If you have an older computer that still has BIOS and MBRs, you will be limited to only have 4 primary partitions on a single hard drive. You can have additional Extended (shown as Logical) partitions if you need more. Below I have a mix of Primary and Logical for those who have older computers. Keep in mind, if you are dual booting and have Windows installed, it's using at least 1 of those Primary partitions, so adjust the below as necessary. If you have a newer computer with UEFI and GPT you won't have this limitation and can just make them all Primary. Also, if you have a brand new empty drive, choose GPT instead of MSDOS when faced with which option.
Proceed as follows, after each step click the freespace to enter the next partition's info.
The sizes below are all gigabyte. They are all multiples of 1024. For those who are unaware, 1024 is the basic measuring unit in computers (after bytes). Hard Drives and RAM are measured using this unit of measure. 1 bit is either a 1 or a 0. A byte is 8 bits. A kilobyte is 1024 bytes. A megabyte is 1024 kilobytes. A gigabyte is 1024 megabytes. And so on.
During the initial setup all your partitions below will automatically be formatted. For all future installs use the info in parenthesis.
Primary Partition, 1024, Fat32, mount as /EFI (Don't format)(if dual booting with Windows don't format this, just select it)
Primary Partition, 1024, EXT4, mount as /boot (Don't format)
Primary Partition, 8192 (should equal the amount of RAM you have installed), Swap Area, no mount point (Don't format)
Logical Partition, 40,960 (adjust as necessary), EXT4, mount as / (Always Format)
If you only plan on installing 1 distro at a time, then:
Logical Partition, remaining, EXT4, mount as /home (NEVER EVER format)
If you plan on having multiple distros
multiply 40,960 (40 Gigs) times the number of distos you plan on having
Subtract this number from the total space left on your disk
This number is the size you'll choose for your home partition.
For this partition change the location to End of this space. This will leave the freespace before your home partition, keeping all your root partitions together.
Keeping /home will ensure that your desktop looks the same no matter which distro you choose to try out. All your application settings will be persistent across all Linux installations as well.
Boot Loader - If installing to a USB pen drive, ensure that you select that SD(B?) drive, otherwise your pen drive won't have the boot info when it's inserted and booted to. Default is SDA. For most people that's the correct answer.
If you mess up, you can click the back button to wipe all of your partition setup info you entered or click the wrong line and hit the Delete button to remove the 1 partition at a time that needs to be corrected. When done click the Install Now button and proceed with the install as you normally would.
Next is the install script. You don't need to be an expert scripter to do this. You're basically just compiling a list of commands that will be followed everytime you do a new setup. In your now persistent home drive select a location to create the script. It is just a text file that has executable properties. Open it in your favorite editor.
Next to simplify application installations and ensure you have the same applications installed on all your installations, create a script. You don't need to know a lot about scripting to do this. Create a basic plain test file and set the properites to executable. Use your favorite text editor and add the commands you'd use in terminal (i.e. sudo /usr/bin/apt-get install firefox). Add all your applications on a single line separated by a space (sudo /usr/bin/apt-get install firefox VLC xscreensaver gdebi synaptic). Add in any prerequisite software as well (for apps you install from source). If you have apps downloaded that you want to install add those installations on additional lines. You may want to restore backed up config files as well. I have a hosts file that I want to use so I create it in home then use the script to copy and replace the new one, same thing with Samba and Apache. You can enter your commands for installing an app from source. If you will be installing your apps to multiple distros, you may need multiple scripts. For example Ubuntu uses apt-get but Fedora uses yum. So if you have Ubuntu and Fedora you'll need separate scripts for both or you can remember to modify the 1 for both.
Since you have a persistent home partition, you don't need to redownload the apps, unless they're outdated.
Below is my install script for Ubuntu based OSes.
sudo /usr/bin/apt-get install firefox vlc steam software-properties-common kpat evince wireshark gufw xscreensaver subversion autoconf libtool libgtk2.0-dev libgl1-mesa-dev libavcodec-dev libavformat-dev libswscale-dev liblua5.1-0-dev libcurl4-openssl-dev libxml2-dev libjpeg8-dev libgtop2-dev libboost-dev libboost-filesystem-dev libboost-thread-dev libtinyxml-dev freeglut3-dev glee-dev automake libwxbase3.0-dev python-wxgtk3.0 libwxgtk3.0-dev flam3 apache2 gcc g++ playonlinux htop qdirstat mame nfs-common gdebi synaptic kodi wine-stable virtualbox samba openssh-client openssh-server amarok clamav kate
sudo cp /etc/network/interfaces /etc/network/interfaces.backup
sudo echo dns-nameservers 1.0.0.1 >> /etc/network/interfaces
sudo cp /home/carl/Documents/hosts /etc/
sudo cp /home/carl/Documents/Website/etc/apache2/sites-available/* /etc/apache2/sites-available/
sudo service apache2 restart
sudo cp /home/carl/Documents/Samba/smb.conf /etc/Samba/
sudo systemctl restart smbd
cd ~/Downloads/SoftwareInstalls/electricsheep-master/client_generic/
./autogen.sh
./configure
make
sudo make install
sh /home/carl/Downloads/SoftwareInstalls/VMware-Player-14.1.1-7528167.x86_64.bundle
First I'll start with is how to setup the persistent home partition. We can most easily do this during the initial installation of Linux on our computer. I'll be using Kubuntu 18.10 for this install example. Other distros will have similar steps.
The first screen after bootup is choosing language and whether you want to Try or Install Kubuntu. We're going to Install. Choose keyboard layout, Normal Install and the next screen brings us to Installation Type. Here the default is guided, use entire disk. We're going to change that to Manual. Next screen we see available drives. Ensure you are choosing the desired drive, hard drive, USB, etc. This is irreversible so installing over top of something means it's permenently erased. Select the freespace on the drive, the create partition window pops up. You will need 3 or 4 partitions depending on what you want to do. I'd suggest going with 4. The first partition you need is the EFI, it's required for UEFI. Next you should have a /boot partition. This partition can be skipped if you will never mutliboot with other distros. However, it will future proof your computer to do it and it doesn't take much space. You should have a swap partition equal to the amount of RAM you have. Next partition is /. This partition is where all your apps get installed. So you may need more, but I never come close to using 40. If you will be installing multiple distros you'll need multiple partitions for /. The rest of the space can be assigned to /home.
If you have an older computer that still has BIOS and MBRs, you will be limited to only have 4 primary partitions on a single hard drive. You can have additional Extended (shown as Logical) partitions if you need more. Below I have a mix of Primary and Logical for those who have older computers. Keep in mind, if you are dual booting and have Windows installed, it's using at least 1 of those Primary partitions, so adjust the below as necessary. If you have a newer computer with UEFI and GPT you won't have this limitation and can just make them all Primary. Also, if you have a brand new empty drive, choose GPT instead of MSDOS when faced with which option.
Proceed as follows, after each step click the freespace to enter the next partition's info.
The sizes below are all gigabyte. They are all multiples of 1024. For those who are unaware, 1024 is the basic measuring unit in computers (after bytes). Hard Drives and RAM are measured using this unit of measure. 1 bit is either a 1 or a 0. A byte is 8 bits. A kilobyte is 1024 bytes. A megabyte is 1024 kilobytes. A gigabyte is 1024 megabytes. And so on.
During the initial setup all your partitions below will automatically be formatted. For all future installs use the info in parenthesis.
Primary Partition, 1024, Fat32, mount as /EFI (Don't format)(if dual booting with Windows don't format this, just select it)
Primary Partition, 1024, EXT4, mount as /boot (Don't format)
Primary Partition, 8192 (should equal the amount of RAM you have installed), Swap Area, no mount point (Don't format)
Logical Partition, 40,960 (adjust as necessary), EXT4, mount as / (Always Format)
If you only plan on installing 1 distro at a time, then:
Logical Partition, remaining, EXT4, mount as /home (NEVER EVER format)
If you plan on having multiple distros
multiply 40,960 (40 Gigs) times the number of distos you plan on having
Subtract this number from the total space left on your disk
This number is the size you'll choose for your home partition.
For this partition change the location to End of this space. This will leave the freespace before your home partition, keeping all your root partitions together.
Keeping /home will ensure that your desktop looks the same no matter which distro you choose to try out. All your application settings will be persistent across all Linux installations as well.
Boot Loader - If installing to a USB pen drive, ensure that you select that SD(B?) drive, otherwise your pen drive won't have the boot info when it's inserted and booted to. Default is SDA. For most people that's the correct answer.
If you mess up, you can click the back button to wipe all of your partition setup info you entered or click the wrong line and hit the Delete button to remove the 1 partition at a time that needs to be corrected. When done click the Install Now button and proceed with the install as you normally would.
Next is the install script. You don't need to be an expert scripter to do this. You're basically just compiling a list of commands that will be followed everytime you do a new setup. In your now persistent home drive select a location to create the script. It is just a text file that has executable properties. Open it in your favorite editor.
Next to simplify application installations and ensure you have the same applications installed on all your installations, create a script. You don't need to know a lot about scripting to do this. Create a basic plain test file and set the properites to executable. Use your favorite text editor and add the commands you'd use in terminal (i.e. sudo /usr/bin/apt-get install firefox). Add all your applications on a single line separated by a space (sudo /usr/bin/apt-get install firefox VLC xscreensaver gdebi synaptic). Add in any prerequisite software as well (for apps you install from source). If you have apps downloaded that you want to install add those installations on additional lines. You may want to restore backed up config files as well. I have a hosts file that I want to use so I create it in home then use the script to copy and replace the new one, same thing with Samba and Apache. You can enter your commands for installing an app from source. If you will be installing your apps to multiple distros, you may need multiple scripts. For example Ubuntu uses apt-get but Fedora uses yum. So if you have Ubuntu and Fedora you'll need separate scripts for both or you can remember to modify the 1 for both.
Since you have a persistent home partition, you don't need to redownload the apps, unless they're outdated.
Below is my install script for Ubuntu based OSes.
sudo /usr/bin/apt-get install firefox vlc steam software-properties-common kpat evince wireshark gufw xscreensaver subversion autoconf libtool libgtk2.0-dev libgl1-mesa-dev libavcodec-dev libavformat-dev libswscale-dev liblua5.1-0-dev libcurl4-openssl-dev libxml2-dev libjpeg8-dev libgtop2-dev libboost-dev libboost-filesystem-dev libboost-thread-dev libtinyxml-dev freeglut3-dev glee-dev automake libwxbase3.0-dev python-wxgtk3.0 libwxgtk3.0-dev flam3 apache2 gcc g++ playonlinux htop qdirstat mame nfs-common gdebi synaptic kodi wine-stable virtualbox samba openssh-client openssh-server amarok clamav kate
sudo cp /etc/network/interfaces /etc/network/interfaces.backup
sudo echo dns-nameservers 1.0.0.1 >> /etc/network/interfaces
sudo cp /home/carl/Documents/hosts /etc/
sudo cp /home/carl/Documents/Website/etc/apache2/sites-available/* /etc/apache2/sites-available/
sudo service apache2 restart
sudo cp /home/carl/Documents/Samba/smb.conf /etc/Samba/
sudo systemctl restart smbd
cd ~/Downloads/SoftwareInstalls/electricsheep-master/client_generic/
./autogen.sh
./configure
make
sudo make install
sh /home/carl/Downloads/SoftwareInstalls/VMware-Player-14.1.1-7528167.x86_64.bundle
Last edited by a moderator: