The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to do complete restore from .tar.gz file?

Discussion in 'General Discussion' started by SuperBaby, Nov 18, 2009.

  1. SuperBaby

    SuperBaby Well-Known Member

    Joined:
    Nov 27, 2003
    Messages:
    331
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Thailand
    cPanel Access Level:
    Website Owner
    Twitter:
    I have an old backup file (xxx.tar.gz) for the domain abc.com in a remote server. This backup file was created by the WHM daily/monthly backup. This account has been terminated. How do I do a complete restore including webpages, MySQL, chmod values etc? The old username and domain name will be used?

    Do I simply do a decompression OR do I create a new cPanel account and restore from there? In either method, how exactly?

    Thanks.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,451
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    A full account backup may be restored and at the same time the account can be created; this may be performed using the following script via root SSH access; running the script without any CLI switches or options will show help and usage information:
    Code:
    # /scripts/restorepkg
    To restore a specific backup archive, simply enter the same command followed by the location to the full cPanel account backup archive as seen in the following example (where "/path/to/filename.tar.gz" should be replaced by the full file system path to the backup archive):
    Code:
    # /scripts/restorepkg /path/to/filename.tar.gz
    The same restore task may also be accomplished using WHM via the following menu path:
    WHM: Main >> Backup >> Restore a Full Backup/cpmove file
    Documentation: Restore a Full Backup/cpmove File
     
  4. SuperBaby

    SuperBaby Well-Known Member

    Joined:
    Nov 27, 2003
    Messages:
    331
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Thailand
    cPanel Access Level:
    Website Owner
    Twitter:
    Thank you for such a good instruction. It clears all my doubts. BTW, does it retain all the chmod values? Thanks again.
     
  5. impload

    impload Member

    Joined:
    Nov 2, 2009
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi this is a great question. I wanted to add onto it.
    If we have a cpanel already and want to restore a daily/weekly backup for it, do we need to delete that account first and then do the restore?
     
  6. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    If the account is going to be on another server then rsync the backup file to that server and move it to the /home directory.
    If it is on the same server, then move the file to the /home directory.

    Assuming that the tar.gz file is now available in the /home directory on the server where it will be restored, run the following command as root :
    Code:
     /scripts/restorepkg username --force
    Replace username with the actual username(old account)

    This will automatically create the account and restore all your webfiles, databases,emails etc.

    If you want to modify the username then once the restoration is complete, do the following :

    Code:
     vi /var/cpanel/users/username 
    Change the USER here and run :

    Code:
     /scripts/updateuserdomains 
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Forcefully restoring a full account backup and changing an account username

    Note: The CLI switch "--force" (for the script "restorepkg") is only necessary if needing to forcefully overwrite an existing account that is already setup or in-place (e.g., with the same username and primary domain as what's in the backup).

    Cautionary Warning: The two-step process shown above (quoted in "CODE" blocks) is not a safe method to change an account username. There is more that must be done including, but not limited to, tasks such as renaming databases and database users, and updating cPanel userdata and related cPanel configuration files.

    To properly change an account username and related cPanel configuration files for the account the following feature should be utilized from WHM, via either "root" access or via reseller access if granted sufficient privileges by root:

    Menu path, WHM: Main >> Account Functions >> Modify an Account
    Documentation: ModifyanAccount < AllDocumentation/WHMDocs < TWiki
     
Loading...

Share This Page