Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been tasked with migrating a bunch (20-or so) websites, some with SSL certificates, some with databases, from an old server to a new server.

The servers in question are dedicated hosted linux boxes (old one is RedHat, new one is CentOS), and both only have Webmin installed.

I want to try and remove the tediousness from the task of a) migrating the sites and b) setting up new sites or changing settings. I'm wondering if it would be worthwhile setting up cPanel or similar to help abstract the work away from the shell (less manual...), or perhaps another tool...

The business in question doesn't resell hosting to Joe Public, more just for hosting websites created and managed by them, so the site owner doesn't necessarily need access to change settings etc...

Thoughts, suggestions?

share|improve this question

closed as primarily opinion-based by HopelessN00b Dec 5 '14 at 12:04

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

This sounds like it's asking for a script. I'm very shell-script-centric, but perl would probably be much handier for parsing out the relevant virtual host configs (I'm assuming here that you're using virtual host configurations). I don't know of an automated tool, but I suggest that when you migrate them to the new site, that you concentrate on making them much more accessible.

If you're running that many virtual sites, it would pay you to encapsulate each config in its own subdirectory under the httpd.conf, perhaps /etc/httpd.d/sites/siteA, siteB, etc etc. In these subdirectories you can also store any relevant certs and the like. With a similarly named subdirectory under /var/www/sites/, this would become significantly easier to use in the future.

share|improve this answer

It's only 20 websites. Doing it manually is the most time-effective solution, assuming you don't have to do the migration regularly.

share|improve this answer
Its not just 'doing' it manually, its more the idea of editing config files by hand, etc etc etc - I know there is better ways to do it, its just finding the right way that suits us... – Matthew Savage May 28 '09 at 7:42

To avoid both...

  1. management-overhead
  2. and human-error

...Why don't you look at cfengine

Many would argue that this may be an overkill, but if you think about it, you don't want to implement your sever management framework after your network is complex enough to warrant it. Start now while it's simple, and as your needs grow (for example more web server, addition of other services in general), you don't have to make drastic changes and will already be familiar and experienced with the management tool.

cfengine is not the only tool, there are others (e.g. puppet).

share|improve this answer
This would be more suited to using several servers, but if its just 'one' server then is it really worth it? I'm more thinking about sites, not entire servers... – Matthew Savage May 28 '09 at 7:42

I am of course assuming your new server is a dedicated virtual one, where you have root access to install anything you like.

Instead of paying for Plesk or cPanel, I usually install Virtualmin, because the install script takes care of virtualmin, webmin, mysql, apache, postfix, and everything else you need.

Now, Virtualmin isn't perfect; the default installation drops all virtual hosts into the apache configuration file, whereas I'd prefer it to create separate .conf files in a "virtualhosts" folder -- but it's great for managing virtualhosts and db accounts and all that tedious stuff.

You can also manage cron jobs, processes that start on boot, etc. using Webmin.

ADDITION: Though as an aside, you'll probably still have to do a lot of manual copying and editing to get everything working again, since you're presumably changing OSes, software versions, and directory structures. But I don't think there's anything around that.

share|improve this answer

You need a configuration management system. Two good choices are Chef and Puppet. Both are written in Ruby, both use declarative syntax for defining resources, and both are great for managing Apache servers and web sites.

The Chef configuration language is a pure Ruby DSL, and Puppet uses its own custom DSL.

Opscode provides a variety of Chef cookbooks, including Apache. The Apache cookbook can be used to set up static vhost files for specific sites and php/rails/django web applications.

Puppet has some Apache2 recipes, but I haven't looked at them in some time.

share|improve this answer