In past few weeks I found out, that my Linux sysadmin skills are pretty low, so I bought bigger HDD (1.5TB) and started playing with virtual machines. I'm experimenting pretty hard way, so I end up reinstalling a lot. My problem is, I don't really know, what is the best way to do initial setup.
My first idea was to create simple bash script, that would install all necessary packages, compile sources, set up accounts etc. But my problem was, that it usualy got stuck in the middle somewhere, because of some change or problem, so I had to manualy hack it anyway. Also such a script will outdate very fast.
Another idea, which I'm trying now, is to write a checklist with things I need to do, and then manually install everything and check things on the paper. This has advantage of having more generic steps (like install MySQL), however I have to do everything manualy, which isn't very convenient.
Last options is install a whole system manualy, configure it, and then create a image of partition, and restore it eventualy instead of clean instalation. While this seems to me like good solution for installing on say 20 servers at once, it will also be outdated soon, so I'd have to create new, up to date, clean installation and create it's image again.
I know that different situation applies different measures, so there probably isn't one fit all solution.
So my question is.
Do you have any kind of checklist, installation script, or any kind of that thing, when you are installing a new system?
There are really two different areas you want to look at:
Since we are talking about virtual machines, why not use images? For most VM systems, you can have some sort of template that the initial machine uses. So, you could always create a basic system, configure it to your liking as a generic base system, and then just create all your other derivative machines from this base template. How you would accomplish it would depend on the virtualisation technology that you used.
For something like OpenVZ/VServer, templates are used anyway - so just make a custom one. For something like KVM, just copy the harddisk image or you can even use a combination of read-only harddisk images with snapshots. Others have similar capabilities too.
I always go wirh Debian netinstall. This is an absolut minimal system. Then going step by step building up the system with apt-get. You may put the apt-get commands into a file and use this file later to re-build the system, even to a certain point.
I'm very happy to use a cobbler server that centrally handles every machine (bare metal, dom0 and VM) I have.
For this purpose I have created a vmware VM on top of which I installed my cobbler server, than I can use it everywhere I need, simply attaching my laptop on the LAN or to the machine to be installed through a cross cable.
This is very scalable, easy to handle and makes standardization the center of your installations.
You haven't mentioned what flavor of Linux. I'd second the recommendation of cobbler. In addition to doing provisioning, it can do really basic configuration management, though I'd really recommend puppet for configuration management. To boot it will manage and keep synced, a copy of the update repos locally. Cobbler is pretty easy to get installed and running, puppet (and all of the other config management tools) have a bit steeper curve.