How To's on setting up new Distro like the old, complete with apps

TechnoJunky

Well-Known Member
Joined
Dec 3, 2018
Messages
493
Reaction score
390
Credits
314
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
 
Last edited by a moderator:


atanere

Well-Known Member
Joined
Apr 6, 2017
Messages
2,628
Reaction score
2,775
Credits
41
A lot of info in just a short tutorial... well done! :cool::D

Just a comment that if the user is setting up a brand new empty hard drive, the first step I would suggest is to be sure to set the drive's "partition table" to GPT using Gparted or some other tool. The old school method of MBR (called msdos by Gparted) is what limits you to only 4 primary partitions. GPT is the newer method and supports 128 primary partitions... a much better arrangement when wanting to do multi-multi boot schemes, but there are other benefits as well.

MBR and Legacy BIOS are kind of bound together, and GPT is bound to the newer UEFI firmware. I think that most computers that have Windows 10 pre-installed are configured for GPT/UEFI because of Microsoft's requirement that Secure Boot be enabled, and that is a UEFI feature.

Cheers
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,511
Reaction score
6,354
Credits
26,568
Quite so, in fact that 128 figure is for Windows, Linux can run more but ask me about that elsewhere some time.

I put a like on this the moment I finished reading it, I think it is a great contribution, worthy of being stickied, perhaps with a modification or two.

(Don't panic, Carl ... :), I am going to get rid of these comments before any "stickying" happens)

IMO it is always worth including in a howto or article eg "test or working environment", so if Carl wants to put, say between

Other distros will have similar steps.

and

The first screen after bootup

something about UEFI-MBR (because that is what it is, it seems), then someone later can always add to that eg UEFI-GPT.

I know Brian (@Condobloke ) already likes what he is seeing (& with Stan's Post), but other Staff may have some opinions so I'll ping @ryanvade @Rob @arochester (might be busy in Italy, sightseeing) and @Scotsgeek

Other than that, I can see this getting up and stickied around the weekend. :D

One important question, Carl - are you OK in acting as first contact (here in this Thread) for fielding questions within your knowledge?

Cheers all

Chris
 
OP
TechnoJunky

TechnoJunky

Well-Known Member
Joined
Dec 3, 2018
Messages
493
Reaction score
390
Credits
314
Ok, @wizardfromoz . I'm not 100% sure I understand what you're asking so I did exactly as you asked. Is that what you're looking for?
@atanere , I haven't been keeping up with my hardware changes I guess and didn't know we didn't have those limitations anymore, on newer hardware. I updated the paragraph about it. But I have a question for you. Do you HAVE to go in and set it to GPT or will Linux just do that if you start out with a brand new disk?
 
D

Deleted member 58530

Guest

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,511
Reaction score
6,354
Credits
26,568
Is that what you're looking for?

Close :). The added paragraph covers it well, so I just removed the reference to the test environment, and bolded the new paragraph. That way readers using the two (main) different combinations are covered.

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.



Do you HAVE to go in and set it to GPT or will Linux just do that if you start out with a brand new disk?

Don't have to, at all, it is just a far more flexible environment.

BIOS-MBR

Some times, computer manufacturers/resellers will effectively fill up a computer with up to 4 partitions that are Windows-related, and/or recovery-related. So you have to know if you can blow away a partition or two without bricking your Windows before you can even reclaim space to set up Linux, and then you have got to have one Primary, and then an Extended. All very messy.

This system also allows for a maximum of 15 (1 short of 16) Logical Partitions, which is fine if you do not want to multiboot with, say, more than 12 Linux :)

This system also cannot support a one-partition drive of greater than 2 TiB, nor files larger than 4 GiB (the latter restrictive on Gamers).

That 4 GiB restriction also impacts on how much Persistence you can attach to a Live USB stick, but it can be worked around by replacing the file casper-rw with a folder of the same name, which then allows you all the space you want up to the capacity of the drive.


UEFI-GPT


...allows for what the other does not.

IMO, any manufacturer/reseller who provides a SATA drive of 1 TB or more (931 GiB) who does not format it to GPT before delivery is lazy. On the Solid State front, 256GB or larger drives likewise.

So if you get a new drive, check it before or after. If you have a LInux Live stick or disk, you can use GParted to change it from MBR to GPT.

There are a number of articles on how to convert an MBR drive to GPT (or reverse, although why is beyond me :confused:), without loss of data, on an already in use drive, but I have not tried any so cannot recommend.

Cheers

Wizard
 

atanere

Well-Known Member
Joined
Apr 6, 2017
Messages
2,628
Reaction score
2,775
Credits
41
I haven't been keeping up with my hardware changes I guess

I am falling further and further behind on hardware too. My most recent are a couple of laptops that came with Win 8... upgraded to Win 10 during the free period just so their activation would remain intact, so I can reinstall Windows if needed for troubleshooting or for some special purpose. My early battles putting Linux on UEFI were a nightmare, but many others shared my grief with that. Things are finally improving.

@poorguy and @wizardfromoz have nicely covered your questions now about MBR vs GPT, so I'll bow out again. Life has become very hectic for me this year, and I am not able to be on here much lately. :(

Cheers
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,511
Reaction score
6,354
Credits
26,568
Hi Stan :)

Further to my above, there are also a couple of differences in commands used at Terminal, namely

Code:
fdisk

#and

gdisk

I am thinking I can carve off some of these Posts and save them for an upcoming article on Partitioning.

Broadly speaking, fdisk is for manipulating MBR drives and partitions, and gdisk for GPT. However, fdisk is forward-engineered to recognise some elements of GPT, and gdisk is reverse-engineered to still be able to work with elements of MBR.

Confused? Good-o. Watch this space ;) (well, elsewhere in the Forum, actually)

Wiz
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top