arrow_upward

Pages (2):
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Corrected - refer last post] Migrate Your Website to New VPS Host ( Ubuntu/Debian )
#1
Hello Friends, I am new in the linux world. I don’t know much about Linux packages and other applications. I have a blog hosted on my VPS. A few days ago I wanted to migrate to a new VPS. I searched google about the transfer web from one host to a new one. I found some but failed to transfer with those methods. In searching, I found information that we need to export our database and directory and transfer it to a new host. I transferred my website successfully to a new host. I am going to share the method I used to transfer.
First of all, you need to export your website database. You can export it via Phpmyadmin. Actually, I don’t use Phpmyadmin so I export/import database via Terminal.
If you have Phpmyadmin export it. If you don’t, use the following method to export the database.

Database Export via Terminal


mysqldump -u [username] -p [database name] > [database name].sql

The exported file can be downloaded from the root folder or the user folder you are logged in.

First of all, go check if the database is exported or not. After confirmation download it to your PC.

The database backup is completed now. Lets back up the website directory. The directory has a high file size. Downloading it via SFTP client is very difficult so I use a different method. I use Google Drive. I will zip the directory and upload it to google drive. 
We need to install google drive.

First of go to the root directory with the following command


cd ~

Now download the google drive


wget https://docs.google.com/uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE&export=download

 
After the download is completed we will rename the downloaded file. Use the following command to rename the downloaded file.
The downloaded file will have the name “ uc\?id\=0B3X9GlR6EmbnWksyTEtCM0VfaFE “


mv uc\?id\=0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive

We have renamed the file. Let's give the execution permission


chmod +x gdrive

Now we have to install this to our usr directory. Use the following command to install.


sudo install gdrive /usr/local/bin/gdrive

During this installation, we will have to provide our google email. It will also require email confirmation. The terminal will give us a link, we will have to allow the application to access our google drive account.

We are done, the installation of google drive is completed.

Let's compress the website directory.

If you don’t have already installed zip install it first.


zip  -r filename.zip /path/folder


The compressed file is stored in the same directory or the user directory you are logged in. Now we will upload this zip file to our google drive.

Use the command gdrive upload to upload the file.


gdrive upload filename.zip

The file will be uploaded to your google drive account. Now let's restore it to our new host.

Logout of your terminal and login to your new host. 

First of all, we will restore our database. I use the terminal to restore but you can also restore it with Phpmyadmin.

I use the terminal to restore the database.

First of all login to your MySQL and create a new database with the following command.



CREATE DATABASE newdb;

After creating log out of your MySQL with the simple exit command. Now upload the downloaded .sql database file to the root directory using a SFTP client.

Use the following command to restore the database


mysqldump -u [username] -p [database name] < [database name].sql


Database restore is completed now let's restore our website directory.
Download the file we uploaded on google drive and unzip it.
There are two methods to download the file from google drive, you can not directly download from google drive. If you want to download you need to install gdrive on your new host. There is an alternate method, I uses. 
The method I use is to move zip file from google drive to MediaFire is MultCloud. It is very easy to move your files to mediafire from google drive.But it may be risky.So do it on your own risk. Register at MuliCloud and add your google drive and mediafire account to share files. I simply share my .zip file to mediafire account and download it with the simple command


wget https://mediafire.com/example.zip
After downloading move your file to /var/www/ and unzip using the command 


unzip example.zip

We have successfully transferred our website files and database to the new host. Now you just have to edit your website configuration and set its DocumentRoot and enable your site.
Most of the webmaster's know about the Apache site configuration but here is simple information for those who are a newbie.

The website configuration file is stored in " /etc/apache2/sites-available "
So you will have to be in the directory, use

cd /etc/apache2/sites-available

Here you will have to create a new configuration file. Simply use the nano command to create a new .conf file.

nano mysite.conf

and paste the following code, save and exit.
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   ServerName yourdomain.ext
   ServerAlias www.yourdomain.ext
   DocumentRoot /var/www/example    ( Update this to the directory we have downloaded )
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Now we have to enable our website use

a2ensite mysite



If you have any question feel free to ask.

Thanks

regards

Rehan
#2
1)You haven't written on how do you restore the website with Google Drive.
2)Setting up "DocumentRoot" isn't an easy task for newbie while what you've mentioned above can be considered easier than what you've missed.
3)I find the title little misleading when comparing what you've written.
Premium Web Hosting | ShadowCrypt | Manal Shaikh Official Website
If you find my post/thread useful, you're supposed to +rep me. 
#3
It is helpful for people who migrating from a shared hosting or localhost

Vps is harder than normal paneled hosting but you get full root access and control to it
Terminal
humanpuff69@FPAX:~$ Thanks To Shadow Hosting And Post4VPS for VPS 5
#4
you have given it some effort. but clearly you title is misleading.

may be you wont mind doing a revision/update.

best and simplest process would be to from one vps to another using ssh or by putting the zips at document root and wget from new vps or host.
Sincere Thanks to VirMach for my VPS9. Also many thanks to Shadow Hosting and cubedata for the experiences I had with their VPSs.
#5
(08-23-2019, 03:31 PM)rudra Wrote: you have given it some effort. but clearly you title is misleading.

may be you wont mind doing a revision/update.

best and simplest process would be to from one vps to another using ssh or by putting the zips at document root and wget from new vps or host.

Fully agree on this. It's better to put your web file on ZIP then just extract it on newer VPS. This also can be done with panel, just a little tweak should solve the problem very quick.
Thanks to Limitless Hosting and Post4VPS for providing me excellent VPS 13!
#6
(08-24-2019, 02:36 AM)tiwil Wrote: Fully agree on this. It's better to put your web file on ZIP then just extract it on newer VPS. This also can be done with panel, just a little tweak should solve the problem very quick.


Actually, I don't have any panel. The cpanel is paid that's the reason I transfer with this method.

(08-23-2019, 03:31 PM)rudra Wrote: you have given it some effort. but clearly you title is misleading.

may be you wont mind doing a revision/update.

best and simplest process would be to from one vps to another using ssh or by putting the zips at document root and wget from new vps or host.

Whenever i read words  " clearly your title is misleading. " I think deeply but i don't have any answer? what should be the title?
#7
@Rehan

first of all, i'm sorry if that comment made you unhappy.

i just meant, it made me expect a simple yet efficient process that will be easy to follow and understand for new users or may be some innovative way that i didn't know about. instead, it was a convoluted way of doing extra work and also kinda incomplete.


you do not need panel if you do not have one. i never install any panels on my vps. You just zip the necessary file n folders and db backup on your source host. then send that to your web root and make publicly accessible. then wget/download from destination. next just unzip under web root and restore db.

though you need to take proper care so permissions are not all messed up. thats why you use proper user and not do everything as root.

you are done. as simple as that.

I am sorry to say that i am totally at a loss to suggest you a suitable title.

edit. i meant you could try streamlining/simplifying your instructions and not the title. thanks
Sincere Thanks to VirMach for my VPS9. Also many thanks to Shadow Hosting and cubedata for the experiences I had with their VPSs.
#8
@rudra thanks for the explanation. Actually, I have already mentioned that I am a newbie to Linux. I understood everything you said. First, I shall try this myself and will update.
#9
Wow, finally i found a tutorial on how to get backup from gdrive.
I was searching for that much time.
Thanks @Rehan
#10
Great tutorial i also was searching for such a tuto about backups but the question is this only works with google drive ?
any other software would works with it ?
Watch this beauty till the end..

Pages (2):



person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting