Installing vBulletin is Easy, but Moving It More Challenging!
vBulletin is one of the most popular discussion forum software packages in use today. Installing it is a breeze, but you may have had a situation come up in which you need to transfer your whole site, including the discussion forum, to a new server or host. Just how exactly do you do that? This article will walk you through the steps and get your forum back up in no time flat!The first thing you’ll want to do is to temporarily turn your forum off via your vBulletin control panel’s vBulletin Options area, so folks aren’t adding new threads or replies while you’re in the middle of the whole process. Then you’ll want to backup all of the files that make up your website. This includes all your images, your PHP or HTML files, the files in your CGI-BIN directory, right down to all the files from your vBulletin forum directory. Some hosts offer departing customers with a complete site backup file that contains everything from your site, all gzipped into a single archive file that you can download. It usually contains a backup of your forum’s MySQL database. If your host doesn’t provide that feature, you will have to download your site’s content via an FTP program (which, if you already installed vBulletin, you already know how to use). Once you’ve done that, you will need to backup your forum’s MySQL database. This can be done two ways–through the PHPMyAdmin GUI interface, or via a command line interface that you will get to via Telnet or SSH.
To use PHPMyAdmin, once you are in the interface, you select the MySQL database you wish to export from the dropdown interface, and once it’s selected, you click the “Export” link below the dropdown. It will take you to the following screen:
In the lower left, you will see a checkbox that allows you to “Save as File”. You simply check that box, click the submit button, and it prompts you with a Download box that enables you to download the exported database file to your local computer. That said, it’s much safer to create the database file via the SSH command line interface, and that’s what we’re going to focus on for the rest of this article.
First you’ll need a Telnet or SSH program, depending on how your host allows you to access your server. Most hosts these days only allow the use of SSH, as it’s more secure than Telnet. You can download a free SSH program called Putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/. To log in, you will need your (old) web host’s SSH server address, your SSH login and SSH password. Simply fill out the login information in your SSH client, and log into your server. Note that when you are typing the password, it will not show up–in fact, it will look like you’re not able to input anything when you type. Just type your password, and hit the enter key and you’ll be in.
Once you’re logged in, you will be using the command line interface to back up your MySQL database to a file in your site’s main directory. If you aren’t there yet, you will need to find out where that directory is, and change to it. To see where you need to be, you’ll simply type “ls” without the quotes. Once you see your site’s directory, you’ll type “cd directory_name”, substituting your site’s directory name for “directory_name”. Now that you’re there, you’ll proceed with the backup of your database. To do that, you’ll need to type the following, as shown in the example below:
mysqldump –opt -Q -h hostname -u username -ppassword databasename > db.sql
Note that in the command line, you will need to change hostname for your MySQL server’s host name, (such as db876.yourserver.com), along with changing username, password and databasename to their appropriate values. Also keep in mind that, unlike the values for hostname, username and databasename, there is no space between the -p and the actual password. You can name the output file anything, but in this instance I have named it db.sql. Once you hit the enter button, after a few seconds (or minutes, depending on the size of your database), you will be returned to the prompt. You can now logout of the SSH server, open your FTP program, go to your (old) site’s main directory, and move the db.sql file over to your local machine. You’ll repeat the process, and FTP the db.sql file over to your new web server/host, where you will put it in the site’s main directory.
Note: At this point, once you have backed up all the files from your old host, have exported the database and have a local copy, it is time to change the DNS settings for your domain name to reflect your new web server/host, so you can access the site via your domain name. At this point we’re ready to move on.
Now, another task: you will need to create an empty MySQL database on your new web server. You usually do that via the CPanel of your web host, or more specifically, via the PHPMyAdmin interface. It will enable you to create a new database, and will provide you with your new database’s name, server, login and password. Now you’re ready to import the contents of the database you just FTPed over to your new web server. Once again, you will need to SSH into your host’s SSH server, just like before, and you will once again move into your site’s main directory. Back to the command prompt!
mysql -h hostname -u username -ppassword database_name < db.sqlAgain, if you’ve done this right, after a few seconds you will be back at the command prompt. You should now be able to go into PHPMyAdmin, look at the data in your new database, and it should be populated by your MySQL databases structure and data.
Now that the data is there, you’ll need to FTP into your new web server, go into the /forums/includes directory, and change the MySQL server info in the file config.php to reflect your new database’s login details, such as servername, username, password, databasename, etc. Upload the saved config.php file to the includes directory, and log into your vBulletin control panel and change your site’s BB URL if need be.
Now for the part that always makes developers nervous–time to go to your forum and see if everything’s working! If all was done correctly, you should be back in business. See you on the forums!