Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Feb 2012
Write script to automate multiple installations
I am partially new to Linux. I've only used Desktop versions of Linux, very limited in terminal. But now, I've decided to start a shared hosting business. Obviously, Linux is way cheaper and feasible to do this.
I am about to deploy a few CentOS servers. I will need to do a few things on the servers. First off, the main server (that hosts the websites) I will need it to download and install cPanel. Is there anyway to automate this process? cpanel is fairly simple to install. However, I also need to install mono, clamav, and so on. Basically, when I expand - I would like to run a simple script that will download, configure, and install cpanel, clamav, mono, all in one shot.
I am deploying a couple of e-mail servers+dns servers. So I'd like to write the scripts down, and deploy it all at once.
I am a programmer: C# mainly, SQL, etc. So pointing me in the right direction would be fine. I've my fair share of batch scripts for windows so far.
- Join Date
- Apr 2005
- Clinton Township, MI
Try a kickstart installation and see if that is useful to you
CentOS offers "Kick Start" installations. Read Chapter 28 of the manual and see if this is what you want; it may be.
Yes, kickstart is very extensible, and you can do what you're describing with it. IMO, it's only worth it if the scaling will earn back the time you have to put into it. You'd probably need to write, test, rewrite, test, iterate that another couple of times and you've put a lot of time into automating one-off installations that you could do manually in the time of one write/test iteration.
For learning purposes, it could be quite worthwhile, however.
- Join Date
- Feb 2012
Thanks, I will look into it. Looks useful. What about writing something similar to batch script? I'm not really going to be doing this all the time, as a server is generally a one-time thing. It doesn't matter if I have to login and execute a script file or something.
Imho, you underestimate the project.
If it was mine, I would first create an infrastructure to support the easy deploy of those hosting machines.
- choose *one* tier 1 hardware vendor
- have SLAs in place for the hardware
- network devices
- (http) repositories
With that, you should already be able to kickstart a basic machine.
But the second line of infrastructure is also important:
- central logging
- central config management
Tools for quick provisioning are e.g.
Spacewalk <-- this is essentially what redhat uses as their RedHatNetwork
Tbh, in my workplace, we tried and ditched all of them and implemented the kickstarting from scratch with just the essential tools.
The basic idea is:
A (new) machine or vm is completely stateless in the beginning.
It will be PXE booted, and our kickstart is smart enough to accomodate differences in harddisc layouts.
The result of the unattended kickstart is a minimal install of centos, with the hostname set and a puppet agent installed.
This is where puppet takes over.
Puppet will then assign a role to that box via its predefined, central configuraion.
It will also take care about possible changes or additional roles.
Hence: It is a tool for maintenance and updates.
I kind of disagree with the view, that the work is over once the machine is installed.
As you can probably tell right now:
I would write puppet manifests and not batch/shell scripts.
As a developer you even might find this approach much more desireable than scripting
just my 2cYou must always face the curtain with a bow.
- Join Date
- Feb 2012
Your 2c is awesome, more like 20 dollars! haha.
The good thing is I have two VPS right now, although not high spec, they are perfect for testing. So I can deploy anything. If I want to start over, I just delete it and start over.
So with SpaceWalk, I can install it in one central location and it can manage my other servers? Right now, I am aiming towards having one main hosting machine and several hosting machines that are for email and DNS only. Once I know my "shared" hosting environment will work, I will deploy more dedicated servers.
This is all very interesting, since I ran a Windows 2003, 2008, and 2008R2 server (still do) for many, many years now. I'm liking SSH, simply because I can type a command faster then screw around through remote desktop. I was really amazed about cPanel's ability to act as a mapped network drive, that's REALLY awesome.
- offers inventory of your machines
- helps with kickstarting, you can e.g. manage kickstart files
- can manage rpm packages in channels
- machines can then be subscribed to channels (or not)
- gives you errata reports. What has been fixed by the latest updates?
- gives you an overview if the machines are up-to-date. If they are not, then it shows how many updates are missing.
As I said, we tried and used it for a few months.
For us, it turned out to be a pita. We are a team of 12 sysadmins and we know how to update and handle machines. Spacewalk consistently "got in the way" and simple tasks like pushing updates took too long for our taste.
It is also an unholy mix of shell/perl/python/java/oracle and whatnot.
I am not saying, the tool is useless. Obviously RedHat uses it in production. So try it and see for yourself.
One of our datacenters happens to be in dublin, I am in munich.
Connecting to one windows box via a ts rdp gateway takes 2min at least.
Connecting to a unix box via an http proxy (dont ask, ugly story) is instant.
So yes, ssh does take less resources and as unix servers tend to be better maintained via commandline anyway, this is fully sufficient.
But imho the focus shifts away from doing stuff manually.
Tools like puppet, cfengine, chef, etc are the way to go.
If you manually change s/th on a box, it is already an error.
Because you will create uniq boxes, that noone dares to touch after a while.
However, if all changes are done via revisoncontrol and in e.g. puppet manifests,
then every box is redeployable at any time.
This might not be an issue for 2-10 machines.
But for every number above that my suggestion is definitely to invest time in systemconfig management.You must always face the curtain with a bow.