|
It's relatively simple to move your Joomla install to a new server. All you need are the files and the database dump. Then, you need a server to move it to (yours locally) and to import the dump into a new or existing database. With this short tutorial you will see how simple this process is. Although there can be issues, these are usually those simple things we tend to overlook for whatever reason.
To get your files you can use your web host's utilities. For example, they may have a front-end script like mine does so you can effect change and manage your account, and files. My host lets me click "backup" and it tars and compresses my root and any databases I want and moves the backups into a backup folder that it saves for 3 days. I can download them at my liesure with an FTP program or wget (uses ftp anyway), or any other way my (your) host allows.
Download your Dump
Whatever your way, go ahead and get the dump. I don't have a unix shell at ICDSoft - they offer one, but I'm OK with what I've got, it's been so long already. I either use wget or ftp. Just depends what I'm doing at the time. You need to know the address of the files on your server if you want to use wget. Like this:
wget -P /your/save/to/directory ftp://uname:
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
/path/to/logs/server-logs.log
I suppose you can fire-up gftp if you want. Or that crazy, teenaged filezilla. ;) But, keep your terminal open.
Move your Joomla files to their new Location
Cake. We have the dump, it's probably a tar.gz file, or similar. Your web host no doubt tars and compresses your backups, too. Download your file backup to your local machine. Then, all you have to do is extract and move those files to your local web root:
In your terminal cd to where you downloaded your site backup file to:
$ cd /vault/sitedumps
Now, extract the files:
$ tar -xvzf dumpname.tar.gz
Now, copy that extracted directory to your web root, don't forget, you need to be root:
# cp -R /vault/sitedumps/oldjoomlasite /var/www/
Now, make sure that those restored files have the right permissions. Locally, apache wants to use www-data on Debian for the user and group, so we do the following:
# chown -R www-data:www-data /var/www/
Make a new Local Database
My host gives me dumps through its backup scheme and not a copy of the /var/lib/mysql/dbase folder structure. If they just tar'd up the folders all I (you) would have to do is simply copy the database folders to a local /var/lib/mysql directory, check permissions and there ya go. Dumps (a file ending in .sql) are no problem, though. We can either import them into new databases at the command line, like all the cool kids do, or use phpmyadmin in your web browser like all the really cool kids do. ;) Again, the terminal is much faster but phpmyadmin is no slouch, either. Let's use the terminal, though, seeing as we already have one open.
Today we'll make a new database and give an existing user permissions on it. No sweat.
machiner@lapbox{~}:mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 308
Server version: 5.0.51a-24 (Debian)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database DBNAME;
Query OK, 1 row affected (0.00 sec)
mysql> grant usage on *.* to UNAME identified by 'PASSWORD';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on DBNAME.* to UNAME; Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Now, import that dump into your new database as the user you just assigned permissions to:
machiner@lapbox{~}:mysql -u UNAME -p DBNAME < documents/projects/debiantutorials/new-site-1.5/pre-update/mysql5/debiantu_debtoots-1515-1234958222.sql
Enter password:
machiner@lapbox{~}:
Change Joomla Configuration to Reflect new Database
Ok -- that was easy, ey? We created a database, gave permissions to an existing user, and then imported the dump into the new database. Now all we have to do is to change some configuration settings in the Joomla configuration.php file. Piece of cake. Again, right from the terminal, again fast. # nano /var/www/debtoots/configuration.php We only have to change the path to the root directory, where the actual files that comprise your Joomla site are, and the database name, host and password. Below are the appropriate indicators to change: $mosConfig_absolute_path = '/home/uname/www/www'; change the bolded path to relect your surrent setup. For example, I change mine to read: /var/www/debtoots.the next line to modify is this one:
$mosConfig_absolute_path = '/home/uname/www/www';
Again, change the cache path to reflect your own.
Change the database name: $mosConfig_db = 'myolddbname';
change the database host: $mosConfig_host = 'localhost:/tmp/mysql5.sock';
Change the "live site": $mosConfig_live_site = 'http://www.debiantutorials.org';
I put debiantutorials.org into maintainence mode prior to dumping, so I have to change the following:
$mosConfig_offline = '1'; to a 0
Change the database password: $mosConfig_password = 'myancientpassword';
Change the database user: $mosConfig_user = 'myolduname';
That's all there is to it. Now you can fire-up your web browser and goto: http://127.0.0.1/restored-old-site and see the site.
Do it in PhpMyAdmin
As I wrote earlier, all this can be done "graphically" in phpmyadmin, too, if you have it installed (# aptitude install phpmyadmin). In your web browser navigate to http://127.0.0.1/phpmyadmin. Login with your root credentials and make a database, either make a new user or give an existing user permissions for the new database, and then import the dump. Then, change your Joomla's configuration.php file to relect the changes and there ya go.
I'll break it down. On the main page after logging into phpmyadmin you will see a box in the center of the page where you can input a new database name: 
To make a new user click the Privileges link also from the main page. You'll goto a page listing all the MySQL users on yout server. You can either click the create new user link, or edit permissions for an existing user by clicking that person/pencil icon at the far right of whatever user you wish to modify permissions for. 
If you click the add new user link, you'll goto a page with the following form on it: 
Simply fill in the uname, hostname (localhost) and password. Beneath that table you are prompted for a database for user - I leave none checked. Beneath that you are asked to assign permissions for the new user - I check none. Now, click the go button on the bottom right of the page. Back at the user overview you can now see a listing for the user you just created. Let's give ol' Waldo permissions on the database we just made. Click that icon I mentioned to the far right of your new user's name. If you are assiging a current user permissions to your new database you'll see something like this: 
If you created a new user for this task then you'll see empty fields. Check off the ones I did in the above image. You need to give the user permissions on a specific database and it's easy to do. Right beneath the check fields allowing permission levels you will see the following: 
Click that dropdown at the box that reads:Use text field: and pick the new database you just made. On the resulting page, choose those permissions you saw in the image above. Then click go again. Now all you have to do is to choose your newly made database in the interface, look at the list on the left, and import your dump into it.  Get here by clicking the database, then the import tab on top of your page.Told you it was cake.
That's all there is to it. If you have trouble we've got a nice quiet forum just for you to poke into, register, ask and get an answer to your questions. Painless.
--machiner 21feb09
|