I’m coming from a vantagepoint of having full access to my server, so that was something to get used to. But WebFaction, my new host, pretty much lets me do most of what I could do on my own server with a minimal amount of problem–at least so far. The getting set up was a lot easier than I expected, and I expected it to be fairly simple to begin with.
A little background. My server runs cPanel, largely because some of the folks I host aren’t as technically minded as I am, so if they want to make themselves a brand new email address at 4:00 AM, I want to let them. The down side of that, of course, is CPanel likes to get in the way of most skilled sysadmins. I’ve learned to work around it for the most part, and push it out of my way where I can’t, but generally speaking I always hear of it being a fight to accomplish some complex task mostly because the folks at CPanel have a different idea of how things ought to be laid out than, well, most normal people. That said, it’s mostly working around CPanel’s general assumptions that makes migrating to any host in general, and WebFaction in particular, a little bit of a trick. If you’re used to it, then it’s a non-issue in about 5 seconds. If you’re not a sysadmin, then it gets even more fun–but I can probably help you work around that if you’re reading this.
The bulk of the steps will be carried out in your new host’s control panel of choice–WebFaction has a very nice one that takes a bit of getting used to largely on account of they have a different concept of how websites come together than most people are used to, but the basic principles should be relatively translateable. And if you’re considering WebFaction, their support times are trying very hard to compete with mine when I’m awake–no support request I’ve put in has been left longer than an hour.
When I moved May and I over, the steps were almost entirely the same–except, of course, that mine were a bit more involved on account of I’m also running the DNS infrastructure for the server I’m soon to be shutting down. Moving us over went largely like this:
- Create the necessary platforms on the new host:
- For May, that’s a couple domain names, a database, a couple email addresses.
- Me was a couple domain names, a few databases, a few legacy subdomains, and all the necessary pointers to the old server so other people I’m hosting over there don’t break–and also because I haven’t yet migrated my mailing list over yet. Oops.
- So the new host knows of canadianlynx.ca, the-jdh.com and related infrastructure before it even needs to be forced to use it.
- Back up the necessary databases from the CPanel server
- Log in to the CPanel box with SSH, if you have SSH access, and: mysqldump -u username -p database > database.sql
- Where username is the login name you use to access the database (hint: check the relevant config files for, for example, WordPress to find it), and database is the MySQL DB you’re wanting to back up (again, check the relevant configuration files). This puts a copy of the database as it is right now in the root of your home directory–or in whichever directory you’re sitting in, if not that. It will ask you for your database password, at which point again, check your configuration files if you don’t know it.
- FTP (or, preferably, SFTP) the .sql file from old host to new–for this, I use WinSCP, simply because I can connect to both old and new at once and tell the thing to pull from one and push to the other. And, well, since I’m lazy, that’s exactly what I do.
- Depending on the size of your database(s), you’ll have time while they move to go back to your new host’s control panel and create the new databases if you didn’t already do that. You can create the user(s) for them as well, which helps. WebFaction is pretty flexible with DB names, which also means you can probably have the same database name, username and password you had on CPanel, which ought to prevent breakage. I didn’t take that route, but that was for largely OCD reasons.
- Your database transfer should be done now. Taking the info you used to create your databases on your new host, SSH into your server (WebFaction provides you SSH access by default) and then:
- mysql -u username -p database < database.sql
- where username is the username you picked for your new database, and database is of course the new database name. Again, it will ask you for your password–give it the one you set for the new database, not the one from your old host, unless of course they’re exactly the same, or things will break. It’ll take a second or two, but then the contents of database.sql will appear in your new database.
- Note: WebFaction runs its database server on the same server as your web stuff, which is defined by localhost. MySQL uses this by default, so this command will work. If you’re on another host, like for example DreamHost, they let you create a database hostname to reach a separate, shared MySQL server. To import your database into that, you’ll want: mysql -h database.host.name -u username -p database
- We’re at a pause point here, as we can’t migrate any farther until we finish setting our infrastructure up on the new host. Right now, your new host knows your domain name exists, but doesn’t know what you’re planning to do with it.
- On WebFaction, they divide the concept of web hosting into 3 categories–domains, such as the-jdh.com, which let you host your email and generally just point to the server, applications, which are what actually serves up your web content (think WordPress, or your forum software of choice), and websites, which essentially connect applications to domain names–so you can tell, for example, myblog.com to pull its content from the myblog application.
- On other hosts, generally speaking as soon as you create a “website account”, or “web hosting account”, it gives you space on a server and doesn’t much care what you put in that space. WF tries to customize its environment for the application you’re running, if it can get away with it.
- Either way, you’ll want to create that space now. On WF, create a static/CGI/PHP application if you’re running, say, WordPress. You could, if you felt like being creative, just create their standard WordPress application, but WF automaticly hands you a database with it then and generally makes more work for you in the long run, but that’s an option.
- Connect the newly created application to your previously migrated domain name using a website record.
- Now, return to your FTP client. Connect to your old host and download everything in the public_html folder of your account–that’s where CPanel stores pretty much all website data. Optionally, if your client supports it, tell it to upload it to webapps/appname on your new host, where appname is the name of the application you created above–you did create one, didn’t you?
- Depending on how much you have up there, it could take a while–mine took a couple hours overall. Now is a perfect time to double check things, then do some preliminary testing. Some web hosts give you a subdomain you can use to test things before they go live. In WebFaction’s case, you get a subdomain in the form of panelusername.webfactional.com, where panelusername is the username you use to log in to your control panel. Configure the website you created above to accept connections from both your domain name and panelusername.webfactional.com, or your new host’s equivalent if not WebFaction. That way, you can access your web content before you actually switch your domain over.
- Tripple check you’ve created all the email addresses you need while you’re in the panel. Once you change over your name servers, which is the second last step–and last step you’ll actually be able to perform by yourself, any email addresses you’ve neglected to create will stop working on account of they don’t exist on the new server, and you’ve told everyone to forget about the old one.
- Now is the waiting game. depending on how long it takes for your content to be transferred, I’d advise you grab a coffee or several.
- When that’s done, and before doing anything else, pull up your webfactional subdomain in a web browser. Make sure there are no errors or anything of the sort–if there, you’ll need to edit configuration files. Most commonly, the error you’ll see is related to databases. Replace all the database info in the affected configuration files with the info from the database you just created, and those problems should solve themselves.
- Once you have everything working on the webfactional domain name, and are sure everything is set up for when you bring your actual domain name over, it’s time to make the switch. Contact your domain registrar, provided it’s not the same as your old host, and change your nameservers to be the following:
- If your domain registrar is your old host, I’d recommend you transfer it first–I’ve had very good luck with Misk for all things domain. Then make the changes listed above.
- And that’s all you can do on your end. Now, everyone else needs to catch up with you. It should take about 24 hours or so for everyone to realize you’ve moved–so don’t go cancelling anything on your old host just yet. Once the nameserver changes have updated globally, then you’re safe to cancel things. And at that point, you’re hopefully successfully migrated away from CPanel to wherever your new host is hanging.
I had a few more specialised tasks running, such as a Cron job for scraping the various RSS feeds I read, but those I pretty much scattered in amongst the larger tasks that required waiting for. And now, this site and everything that goes with it lives on a shiny new web server I’m not directly maintaining. If you’re hosted on the server I do maintain, you shouldn’t feel a thing.
Switching out really is that simple if you know exactly where to look. And if you’re lost at any point, Google is your friend–and so are the comments. Now, let’s go see if I need to finish breaking anything else on my new host before I get too comfortable.