====== Advance Option: Use SSH / SCP / ZIP to Transfer Files ====== This is NOT a stand-alone tutorial! It is an optional part of the tutorial at [[tutorials:server:migration:start]]. This tutorial is a sub-section of the main [[tutorials:server:migration:start]] instructions. You can follow this tutorial as part of **Step 1: Moving Files**. **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 [[tutorials:server:migration:start#Option 2: Use FTP to move from one folder or server to another]] instead. 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 [[tutorials:server:migration:start#Option 2: Use FTP to move from one folder or server to another]]. This is accomplishing the same "end result" as the [[tutorials:server:migration:start#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 different((And if you enjoy this sort of thing, much more fun as well!)). 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:** - 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/**((Just an example! Your files may be somewhere different!)), you might use: cd public_html/classifieds/ < - Zip up entire contents and all sub-folders recursively, using the following command: tar -zcvf geodesic_files.tar.gz . < - 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. < - SSH to the "to" location, using: ssh username@example.comChange **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. < - 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/ < - 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 usingtar -zxvf geodesic_files.tar.gz< - Delete the contents of templates_c folder, using rm -Rf templates_c/* < - Make sure the folders and contents are writable, by chmod 777 on new location chmod 0777 geo_templates/ user_images/ _geocache/ templates_c/ -R < - 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. < - That's it! Continue on to the next step [[tutorials:server:migration:start#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