Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a way to replicate certain aspects of a server configuration in an automated fashion ? For example:
Let's say I have a server designated as a WWW machine, and after a fresh OS install, I want the following things configured on it:
- Postfix
- QPopper
- Apache
Now, let's say I have a server designated as a DB machine, and after a fresh OS install, I just want the following configured on it:
- Postgres
So, as I add WWW machines, I could install the OS on the machine, then run some "magically little script", and have all the configuration on that box done... ie: all the programs I want installed on the box, all the Users setup... etc
Right now, I have a huuuuuuuuuge checklist of things I did when I installed all the software on my box and setup the proper users, but would "love" to automate this process somehow.
I'm assuming this is a job for a shell script ? Orrrrr.... ?
Thanks for helpin' a newb out
If for a given case the src & tgt systems are the same, inc HDD type, then dd may be what you are looking for.
RH offers a network install from a src system, others (inc) BSD may do the same.
Also, take a look at this: http://www.linuxplanet.com/linuxplanet/tutorials/986/1/
What I have understand from your first post.. that you want to automate the application installation (Postfix,Apache and QPopper) and their configuration.
If so, then you will need to write a Shell script and need that to put on CD along with above packages and their config files (which you want to be set on new systems default).
After installing OS, you can execute your shell script which will install packages and copy configurations to their paths on new system.
kirtimaan_bkn offers a possible solution. "dd" (or rsync) is more for mirroring entire systems, which may not be what you want.
Creating a script to add users automatically isn't to difficult.
Just write a few "useradd" commands and check their return code to see if they were successful or not.
Similarly, to configure Postfix, you simply need to have the Postfix configuration files and package and then follow the following sequence in the script:
-install package (on RH, this would be something like "rpm -i postfix-...". I don't know much about Debian, so I can't help you with that.
-maybe you'll need to get some updates for the postfix package
-then simply "cp" the config files to their right location (as root)
-(re)start the postfix daemon via:
/sbin/service postfix start (or restart)
For Apache, you'll need to copy all the websites (dd may help you with that) and the Apache config files (certainly httpd.conf).
Installing Apache can be a little trickier (you'll need to have all the modules and stuff).
But, if you have, as you said, done this all before, then you should be able to retrace your steps.
Another useful trick maybe this:
-enlarge your command history (set $HISTSIZE to a large value)
-then do the install once, manually executing all the commands
-then type "history > my_install_script" and you can edit that file. It'll contain all the commands you've entered. Then all you need to do is verify those commands and maybe build in some checks to see if they worked or not and report that back to you (ie via e-mail).
Any editing of files will need to be replaced by copying of the files (with the correct settings, so after the editing) to the right path.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.