General transfer Magento website procedure in Linux

My general transfer Magento website on Linux procedure

1. Export MySQL database to SQL dump to file using phpMyAdmin or mysql command-line:
mysqldump -h localhost -u db_user -p db_name > ./db_name.sql
…or any other utility.
MySQL database host, name, user and password can be found in file ./app/etc/local.xml

Example section with db settings:
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>

2. If you transfer Magento from one domain ( to another ( replace all matches in SQL dump file using vim:




or using Perl, sed or any other utility.
I am prefering to make SHA1 checksum using command:
sha1sum -b ./db_name.sql
and archive it after each replace:
tar cpjf ./db_name.sql-N.tar.bz2 ./db_name.sql
for each saved sql file version.
Do not forget to replace both www. and without www. domain name versions.

3. Make all files backup.
For example:
cd /var/www/vhosts/
tar cpjf /var/www/vhosts/ ./ –exclude ./var/cache –exclude ./var/reports

4. Copy backup to new server using scp (ssh secure copy):
scp /var/www/vhosts/
or lftp (via plain ftp):
lftp -e ‘put -a -O / /var/www/vhosts/; bye;’ -u domain2,ftp_password
or any other FTP client.

5. Restore files from backup:
cd /home/user2/public_html/
tar xjf /home/user2/ ./
mkidr -pv ./var/cache
mkidr -pv ./var/reports
Make both ./var/cache and ./var/reports writable for web server user e.g. apache or nobody using chmod.

6. Restore MySQL database from file:
mysql -h localhost -u db_user -p db_name < ./db_name.sql 7. Change Magento settings in file ./app/etc/local.xml suitable for new server. 8. Do not forget to check all custom .htaccess rules (custom php_value, rewrite rules, password protection, etc.) to match paths and server configuration at new server. 9. If you go from dev to production do not forget to check ./robots.txt file: User-agent: * Disallow: / --->
User-agent: *
Allow: /
and vise versa.

Do you have any thoughts about this subject?