Thursday, July 8, 2010

Domain migration in Linux server steps

Migration of domain from old server to new server
====================================================


1)Verify the Disk usage of particular account

root@host [/home]# du -sh road/
489M road/

2)Then Run pkgacct script:

root@host [/home]# /scripts/pkgacct road/
pkgacct started.
pkgacct version 8.3 - user : road/ - archive version: 3 - running with uid 0
warn [pkgacct] Invalid username to loadcpuserfile.
Unable to find domain name for road/

root@host [/home]# /scripts/pkgacct road
pkgacct started.
pkgacct version 8.3 - user : road - archive version: 3 - running with uid 0
Copying Reseller Config...Done
Copying Suspension Info (if needed)...Done
Copying SSL Certificates, CSRS, and Keys...Done
Copying Domain Keys....Done
Copying Counter Data....Done
Copying Bandwidth Data.......roadtomakkah.com...Done
Copying Dns Zones.......roadtomakkah.com...Done
Copying Mail files....Done
Copying frontpage files....Done
Copying proftpd file....Done
Copying www logs.............
Done
Copy userdata............
Copy custom virtualhost templates............
Done
Copying mailman lists....Done
Copying mailman archives....Done
Copying homedir.............
.........
.........
.........
.........
.........

Then move the particular file to /usr/local/apache/htdocs
mv cpmove-road.tar.gz /usr/local/apache/htdocs/
Change the cpmove-road.tar.gz ownership to nobody user



3)Using wget command download old server account to the new server

wget http://IP/cpmove-road.tar.gz
Move the downloaded file to home directory


4) Extract the downloaded file using restorepkg script
root@neigh [/home]# /scripts/restorepkg cpmove-road.tar.gz
Using cpmove archive
cPanel restorepkg 2
Force Mode: no
Reseller Privs Restore: yes

Searching /home....
Found cpmove-road.tar.gz !
Extracting tarball...................



5)Then we have to move mysql package

du -sh road_main/
76K road_main/
root@host [/var/lib/mysql]#

root@host [/var/lib/mysql]# mysqldump road_main > road_main.sql
mysqldump: Error: 'Table 'INFORMATION_SCHEMA.FILES' doesn't exist' when trying to dump tablespaces



root@host [/var/lib/mysql]# du -sh road_main.sql
8.0K road_main.sql
root@host [/var/lib/mysql]#

6) Then using server copy we are transfering the new dump file to the new server

scp road_main.sql root@IP:/var/lib/mysql


7)Go to new server and Extract the database using the followuing command

mysql road_main < road_main.sql

Compare the disk usage with the new server. ( This is for just verification )

root@neigh [/var/lib/mysql]# du -sh road_main
76K road_main
root@neigh [/var/lib/mysql]#



8)We have to connect mysql and have to give grant all privileges to Databases

Just Take DB, User information from the configuration file like configuration.php or some other files.

Search that information using the following command
grep databasename -lr *

Then Enter in to the corresponding file and take the corresponding information

########## Database Info ##########
$db_server = 'localhost';
$db_name = 'shopno_smf';
$db_user = 'shopno_admin';
$db_passwd = 'admin';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;
http://forums.mysql.com/read.php?11,240976


9) Then go Mysql prompt and select the particular database

Then give the grant all privileges to the user

GRANT ALL privileges ON DATABASE.* TO user@domain IDENTIFIED BY 'password'


10) Then check with domain functionality using temp URL
http://67.45.34.67/~account_name

No comments:

Post a Comment