LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to create a custom automated install with specific list of packages? (https://www.linuxquestions.org/questions/debian-26/how-to-create-a-custom-automated-install-with-specific-list-of-packages-4175674750/)

Red Squirrel 05-07-2020 04:42 AM

How to create a custom automated install with specific list of packages?
 
I want to create a custom unattended install so that when I setup a system I can automate all the base install stuff I would normally do on a new system like copy custom utility scripts that I use, set aliases etc and also have specific packages installed by default. So I can add any custom packages, settings and so on. there's a few tutorials such as this one:

https://wiki.debian.org/DebianInstaller/Preseed

and this one:

https://wiki.debian.org/DebianCustom...2C_Binary_Only

That compliment each other.


But one thing I want to be able to do is to specify the list of packages I want to be installed automaticly, none of these tutorials seem to really explain those details or there are weird quircks, like not including packages already installed on the prototype system.

Essentially what I want to do is that whatever packages are on the prototype system, also end up on the custom CD and become part of the install, including dependencies.

So if I later realize I want another package as part of the CD I can go on the prototype system, apt-get install it, then run my script to regenerate the CD.

Also, I would like it to include the updated packages, so if I do apt-get upgrade on the prototype PC it would include the newer versions on the CD.

How would I go about doing that?

I want to upgrade all my servers to a newer OS as they are out of date so I figure before I do that I want to make this custom installer just to streamline everything and also have a more consistent install throughout. I eventually want to make my own custom server distro (basically just Debian or another distro that has my own custom front end on it so nothing crazy) and this knowledge will come in handy for that.

wpeckham 05-08-2020 06:25 AM

I have not used it myself, but it reads to me like you need "respin" or something very like it.

Guttorm 05-08-2020 06:43 AM

Hi

I've done this a bit more "manually", by using dpkg --get-selections and dpkg --set-selections. But it shouldn't be difficult to do in a script.

The list is a simple text file, so you can edit it if you want.

Simple guide here:

https://www.cyberciti.biz/tips/linux...n-restore.html

Red Squirrel 05-08-2020 09:15 PM

That could potentially work, does that command pickup all the dependencies too? I could write a script then have it generate the entries in the preseed file, as I think there is an option in there to specify packages to be installed.

So yeah I'll have to experiment. If apt-move does what I think it does, I should be able to put the physical packages on the image as well. Once I have it all set it should just be the thing of updating the staging OS then rerunning the script to create a new ISO with updated packages.

There's lot of stuff like respin etc but it seems lot of those are obsolete or not being updated anymore so I think I'm better off doing it a bit more manually... and it's a bit of a learning experience at same time to understand a little how the install process works.

andre@home 05-09-2020 01:16 AM

How many extra packages are we talking above the basic install of a Debian server?
Like 5 or 10 or 100?
Then consider how much you gain in whatever you wanna do.
Maybe I'm not correct, please then describe in more detail what yo wanna do.

When I wanna install a new server, I generally save my config files e.g. fstab & for Apache/WebDav, but for the rest I prefer a fresh install to be sure that I get the latest config files / packages whilst there are no remainders old installations that I need maybe to worry about.
Then I compare the new config files with the old one and learn what the improvements are and add that part that is essential to the new one to make at work I was used too in the old one.
When I need to reinstall another Debian server, I exactly know what to do and the installation and setup take very little time. The data disks are automatically mounted via the fstab file info and are coupled as webdav locations in de default-ssl config file under Apache2, so I need to take over that info too.

When I'm ready I make images of all server instillation on spare (boot) disks, so when there is a problem with one of the servers it is on-line in a few minutes again.
My main user is my son, a professional documentary photographer, he knows how to switch off the server, replace the problem boot disk with the backup/spare boot disk ...and switch the server on ... and continue to do his work...
We have 2 identical servers, on 2 different physical locations, both based upon the same Debian version, both have spare imaged boot disk.

I'm now in the phase to do experiments in a Virtual Machine (VM) to test Debian Buster, as this summer Debian 8 Jesse is running out of its LTS.
VM's are great for such experiments.... test installation and configuration files.....

Turbocapitalist 05-09-2020 02:15 AM

It's been more than a few years so things may have changed but when I was doing this kind of thing, I modified the preseed as little as possible and had one main shell script to run instead which managed most of the customization. It was run on first boot, though, if I recall correctly, I might have had another much shorter one which ran during the actual installation.

If you're doing a lot of testing and the LAN is much faster than your Internet connection, be sure to set up Apt-Cacher, Apt-Cacher-NG, or at least Squid (with very large caches) on another local machine and have use of the proxy be part of the preseed customization. You can comment that out later when you put things into production if the situation calls for it, but it has the potential to save lots of time and bandwidth during development and testing.

Red Squirrel 05-10-2020 01:24 AM

There's not lot of packages off the top of my head but every time I do a new install there's always certain packages and things I need to do that come up. For example installing vim and sudo. There's also this weird thing Debian vim does where you can't right click and you need to modify a config file, so I want to get rid of that too. In fact another thing I realize is there may be packages I want to uninstall, as there are weird stuff with networking I have not looked at fully yet, but it seems something keeps overwriting my static IP. Or adding certain aliases by default in skel etc. I want to automate all of those little things as they add up.

Basically all little annoying "first boot" setup things like that I want to just be part of the image. I also want it to be offline since there could potentially be systems I want to install it on that won't be online. Basically once I have this setup, all my machines will be standardized to this same install, just to streamline everything.

andre@home 05-10-2020 12:58 PM

Nowadays I keep track of my bash history, back it up in time... so it tells me exactly what to do, similar purpose just a few things...
Putting it back.. takes a few minutes to do the jobs...
Installation complete?
Using GFL I make an image of my boot disk.
Ready...
A problem... change the boot disk and after a few minutes the server is online again...
Just some thoughts...

Succes!

ondoho 05-11-2020 01:58 AM

Quote:

Originally Posted by Red Squirrel (Post 6121307)
There's not lot of packages off the top of my head but every time I do a new install there's always certain packages and things I need to do that come up. For example installing vim and sudo. There's also this weird thing Debian vim does where you can't right click and you need to modify a config file, so I want to get rid of that too. In fact another thing I realize is there may be packages I want to uninstall, as there are weird stuff with networking I have not looked at fully yet, but it seems something keeps overwriting my static IP. Or adding certain aliases by default in skel etc. I want to automate all of those little things as they add up.

Basically all little annoying "first boot" setup things like that I want to just be part of the image. I also want it to be offline since there could potentially be systems I want to install it on that won't be online. Basically once I have this setup, all my machines will be standardized to this same install, just to streamline everything.

First of all, there's various search phrases to aid you. I went with linux how to automate system set up after installation. Looks like kickstarter is one option.

Then, it's always better to install a system that does not install bloat by default, instead of later removing stuff.
So basically you are looking at creating your own respin (I showed you how to search Linux stuff, I'm sureyou can apply it to this keyword, too).
BTW, if we're talking Debian, various approved spins already exist (although they're hard to find on Debians site) and last time I looked sudo was already set up after install.

But lastly I wonder why you need to install so many clearly personal systems (vim quirks etc.) so often.

Red Squirrel 05-14-2020 01:31 AM

Quote:

Originally Posted by ondoho (Post 6121610)
But lastly I wonder why you need to install so many clearly personal systems (vim quirks etc.) so often.

I'm just trying to save myself work. I'm due to upgrade pretty much all my servers so figured I would streamline all the repetitious tasks.

I also eventually want to make my own software for web hosting (kinda like cpanel) that will automate all the config like mailboxes, virtual hosts dns etc.... and it's easier to just integrate it into a distro than to try to deal with the billion different versions of config file syntax that changes across all distros (ex: apache and such) so eventually will want to apply this knowledge when I make that particular installer which would be basically a preseed install that installs all the prerequisites and then runs my custom script at the end to copy all the appropriate files in their place.

Given there are some spins I'm just surprised this is not info that is more easily obtainable. For example Debian based distros like Ubuntu. How did they go about creating their installs?


All times are GMT -5. The time now is 03:45 AM.