New install setup

Hello,
I’m new to the forum. Thanks for having me.

I’m primarily a windows user but have dabbled with Linux over the years. I want to (on my laptop) move to Linux more permanently. My main rig is used for gaming so will hold off for a while longer there. Until I’m forced to move to Win11 most likely.

Anyway, when I re-install windows (drive failure, issues, etc.) I have a PowerShell script that installs software and does a lot of the setup for me. I’m aware almost anything can be done through the terminal in Linux so is a similar setup script possible. Install Linux, run script to install apps and do configuration for appearance etc.? I know someone is bound to say you don’t have to re-install Linux, but humor me please…

This Would be something I would be happy to invest time into if possible.

Thanks in advance…

Hey Dude, I’m not sure it’s something that would be worthwhile for “me”, but if it’s something you want to do there are certainly Linux tools for it. Consider however;

  • Software installation is via a package manager, say “apt” on Ubuntu … so installing your custom list of software is as simple as “apt install [… list of package names]”.
  • User customisation is typically via configuration files held in the user’s filesystem, typically beginning with a “.”

So, if you maintain a copy of your home folder and a list of the names of the packages you have installed, installing a new system could be as easy as restoring your home folder and “apt install …” … assuming I’ve understood what it is you’re looking for?

MP

Hi, thanks for the speedy response…

All config for appearance options etc being stored in the home folder… that’s handy.

So if I have a list of apt install blah blah in a file. Is there a way to execute that list so it just installs the lot?

Thanks

Heh, probably more ways to do that than I care to imagine :slight_smile: … easiest mechanism that springs to mind;

vi packages
# enter names of packages, hit return after each one
# :wq to quit editor
apt install `cat packages`

So “cat packages” is “copy-at-terminal”, or just output the contents. The “ticks” around cat packages are actually “backticks”, which mean evaluate the contained command … so apt install followed by an evaluation of “cat packages” would equate to “apt install package1 package2 …” or whatever names you entered into “packages” … if that makes sense?
(a long and distant memory is telling me that “cat” is the Linux equivalent of the DOS “type” command, but I could be wrong)

MP

Thanks, that makes sense…

Not to be a pain but “:wq to quit editor” do I literally put the last line as :wq to close when its done?

Also, is there a filename you can save as to run the script (like .bat. or .ps1)

Thanks for the time, appreciate it.

Ok, so if you’re not familiar with “vim”, you might want to try “nano”, which is reminiscent of the old editor from wayback when (CP/M?) which gives some on-screen help. VIM operates in two modes, edit and command. By default you can edit and just type in the lines you want … to quit you need to enter command mode, which is a colon (“:”), then “w” is for write and “q” is for quit.

Alternatively;

$ cat - > packages
package1
package2
package3  
^C
$ cat packages
package1
package2
package3

Where ^C means hold down control and press “C”
:slight_smile:
(copy-at-terminal “-” means take input from keyboard, “>packages” means output to a file called packages)

Thanks for the explanation. Appreciated, I will give it a go

Hi Delorean Dude
I’m not sure if this is any use to you but I wrote a script a while ago to automatically install packages on a new install I didn’t completely finish it, but it works for the most part, it’s a simple script and quite easy to follow which you may be able to adapt for your own needs

#!/bin/bash

# This script will install favourite programs & restore configs

clear
echo -e "This script will install favourite programs & restore configs"
echo -e "Do you wish to continue ? \nYes (y) \nNo (n)"

read op
if [ $op == y ]; then
clear
echo -e "Please select from the following options \n \nInstall Software (i) \nRestore config files (this should only be done after installation) (r)" 

read op1
if [ $op1 == i ]; then
clear
echo -e "The following software will be installed \n"
echo -e "Libre Office \n Shotwell \n Clementine \n Gramps \n"
echo -e "Continue (c) \n Exit (x)"

read op2
if [ $op2 == c ]; then
sudo apt-get update
clear
echo Installing Software
fi

echo -e "Timeshift requires a PPA do you wish to continue ? \n Yes \n No"
read op3
if [ $op3 == y ]; then
echo installing Timeshift PPA
else
echo -e "ASound requires a PPA do you wish to continue ? \n Yes \n No"
fi


read op4
if [ $op4 == y ]; then
echo installing ASound PPA
else
echo -e "SMPlayer requires a PPA do you wish to continue ? \n Yes \n No"
fi

read op5
if [ $op5 == y ]; then
echo installing ASound PPA
else
echo -e "Your software has been installed \n \n Do you want to restore config files ? \n Yes (y) \n No  (n)"
fi

fi
elif [ $op == n ]; then
echo Script Aborted
else 
echo Incorrect Option
fi

Good luck
Graeme