Sidebar

tutorials:server:migration:ssh_method

Advance Option: Use SSH / SCP / ZIP to Transfer Files

<tip c w>This is NOT a stand-alone tutorial! It is an optional part of the tutorial at Installation Migration.</tip>

This tutorial is a sub-section of the main Installation Migration instructions. You can follow this tutorial as part of Step 1: Moving Files.

<tip c w>Warning: This option is only for advanced users that are familiar with SSH and have SSH access on both the "from" and "to" locations, and ability to use SCP to directly transfer a file from one location to the other. This also means that both locations must be on Linux based servers, since SSH is not available for Windows servers. If you are not sure how to use SSH we recommend to use the option Option 2: Use FTP to move from one folder or server to another instead.</tip>

Only use this method if you are comfortable with using SSH and the command line, and you have SSH access for both the "from" location and the "to" location. Otherwise stick to the standard FTP instructions mentioned in Option 2: Use FTP to move from one folder or server to another.

This is accomplishing the same "end result" as the Option 2: Use FTP to move from one folder or server to another option, you will be copying the files from one location to the other, but "how they get there" is much different1). However if you are able to use SSH on the from and to locations, this option is much faster and more reliable since you only transfer a single large zipped file directly from one location to the other, instead of downloading and uploading the files one by one using FTP.

This is the overall steps you will be following: First, SSH into the "from" location, zip up the entire contents of the folder that the software is installed in. Then while in the "from" location still, use SCP to transfer the zipped file to the other location. Then SSH to the "to" location, move the zip file to the folder that the files should be installed in, and unzip.

Here are the individual steps:

  1. SSH to the "from" location, and use CD to change to the base directory that the software is in. This should be the same folder that has the config.php file for the software, which you can check for using ls. For example, if the Geo software was installed in public_html/classifieds/2), you might use:
cd public_html/classifieds/

<

  1. Zip up entire contents and all sub-folders recursively, using the following command:
    tar -zcvf geodesic_files.tar.gz .

    <

  2. Transfer the new geodesic_files.tar.gz file to the new location using SCP:
    scp geodesic_files.tar.gz username@example.com:/home/username/public_html/

Change username to the SSH username for the "to" location, change example.com to the "to" server domain, and change /home/username/public_html/ to the absolute folder that the software needs to be copied to. When you do that, it will prompt for the password, just enter the SSH password for the "to" location that goes along with the username you used. <

  1. SSH to the "to" location, using:
    ssh username@example.com

    Change username to the SSH username for the "to" location, change example.com to the "to" domain name. You will be prompted for the password, same as before enter the password that goes to the "to username" you used. <

  2. Use cd to change to the directory that you will be putting the software in, this should be the same folder as you used 2 steps up when you SCP the zip file over. For example if you are placing it in /home/username/public_html/ on the "to" location, use:
    cd /home/username/public_html/

    <

  3. Make sure the geodesic_files.tar.gz file exists in the folder. If not you may have transferred it to the wrong folder, in which case figure out where you copied it to, and copy it into the correct folder or re-transfer the file using SCP. Then unzip the file using
    tar -zxvf geodesic_files.tar.gz

    <

  4. Delete the contents of templates_c folder, using
    rm -Rf templates_c/*

    <

  5. Make sure the folders and contents are writable, by chmod 777 on new location
    chmod 0777 geo_templates/ user_images/ _geocache/ templates_c/ -R

    <

  6. You may wish to use FTP to download a copy of the geodesic_files.tar.gz file onto your location computer for backup purposes, and to make it easy to "start over" on the migration if something goes wrong in the steps ahead. Once you have downloaded a copy, be sure to delete the file from both locations using FTP (or SSH), as it could be a security risk to keep it somewhere that can be downloaded from the web. <
  7. That's it! Continue on to the next step Step 2 - Create Database <

All SSH commands

Below are all of the SSH commands to run, these are extracted from the steps above and combined for your easy reference and removal of the explanations. Note that you will need to make adjustments in some cases such as to folder or domains used. If you aren't sure what needs to be changed, stick to following it step by step in the instructions above.

cd public_html/classifieds/
tar -zcvf geodesic_files.tar.gz .
scp geodesic_files.tar.gz username@example.com:/home/username/public_html/
# Enter password when prompted
ssh username@example.com
# Enter password when prompted
cd /home/username/public_html/
tar -zxvf geodesic_files.tar.gz
rm -Rf templates_c/*
chmod 0777 geo_templates/ user_images/ _geocache/ templates_c/ -R
1)
And if you enjoy this sort of thing, much more fun as well!
2)
Just an example! Your files may be somewhere different!
tutorials/server/migration/ssh_method.txt · Last modified: 2014/09/25 16:55 (external edit)