How to script a standard Linux build?

I am going to restore the Linux box again. I need to create multiple user groups, user accounts and install standard packages. So far, I've just used the GUI tools. I was wondering if anyone has any guidelines for writing a script to create users, groups, and install standard packages after a minimal install of my latest Fedora build? I sometimes run Ubuntu, so I would like the script to be somewhat generic.

0


source to share


8 answers


For .deb distributions use FAI . For .rpm distributions use Kickstart . Use cfengine to manage the system after installation .



+2


source


Fedora and Ubuntu use completely different package managers, so you can't easily do this in any general way.



On CentOS (which is a RedHat Enterprise Edition with serial numbers deferred and therefore pretty close to Fedora), we did this using the Kickstart files . These files have a simple syntax that allows you to specify users, groups and packages to install, and even script some custom stuff.

+1


source


While I haven't done this yet, I have a similar problem. I am considering a virtualization host and multiple client OSs (Ubuntu and CentOS are the top 2 candidates) - that way, once I get the client configured the way I want, I can spare it to reboot as needed.

There is no workaround for the problem with the original installation, but it limits the "once again problem of restoring my Linux box".

You might want to consider this.

+1


source


It might be overkill, but you can check Puppet .

On their website:

Puppet is a system for automating system administration tasks.

I'm just starting to look for ways to automate system administration, so I have no experience yet.

+1


source


If all you need to do is create users and groups and install packages, I would suggest you just write two separate scripts.

Perhaps you could share some of the users and groups, but only if all distributions you use have the same policy for creating them (for example, Ubuntu creates a group for each user, while I'm sure some distributions have "users" ").

You can see the useradd and groupadd commands, which should be available everywhere. There is also a friendlier adduser and addgroup for Ubuntu, and I wouldn't be surprised if Fedora has a set of similar commands.

Once the groups are set up, you just need to give the package manager a long list of packages to install. It should be safe to try to install packages that are already installed, so you can install the packages you want on a clean fresh installation and then reset the package list.

So, to summarize, unless you plan to support more than two distributions, I suggest just writing the two scripts separately.

+1


source


Another opportunity to help with the constant rebuilding of the box is Norton Ghost, with a ghost you can take an image and then just redraw the disc as needed. You install it and customize it to your liking, and then shoot the image.

0


source


It will be difficult to create a script generic, but you can use any scripting tool (bash or ruby ​​or whatever) and try to check what the distribution is and then run the appropriate commands to install the software. There are various ways to check that the distribution is working here

Group creation should be the same across all distributions, and you can even opt out of the / etc / passwd and / etc / groups already configured (although I haven't tried this and may not work).

0


source


The answer above, about different distributions using different methods, is dead. It's like trying to use the same part for Chevy and Ford (there is a car analogy for you).

The easiest method I have found is to learn about configuring partitions for different mount points, i.e. /; / Home; / var; / opt are large.

This allows you to preserve your users, groups, and many of your applications during rebuilds. Changing distributions will break a lot of things, but your user accounts should still be there.

0


source







All Articles