Updates:

Similar topics mod installed, currently shown at the end of a topic

New install setup

Started by Delorean_dude, July 27, 2022, 01:11:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Delorean_dude

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..

Mad Penguin

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
https://twitter.com/garethbult
https://gareth.bult.co.uk


Delorean_dude

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

Mad Penguin

Heh, probably more ways to do that than I care to imagine :) .. 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
https://twitter.com/garethbult
https://gareth.bult.co.uk

Delorean_dude

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.


Mad Penguin

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"
:-)
(copy-at-terminal "-" means take input from keyboard, ">packages" means output to a file called packages)
https://twitter.com/garethbult
https://gareth.bult.co.uk

Delorean_dude

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