Hi all. In this post, I will do something different and that is to backup the WordPress site with Virtual Machine. I’m planning to create VM inside VirtualBox and install Ubuntu Server 20.04. Then I need to install WordPress on that VM and via plugin clone the complete site from BlueHost to my local VM machine. But why?
I want to create one additional backup that will be stored locally and to in the future have some test server, so that I can try some new themes and try and/or remove some plugins. So, in order to Backup the WordPress site with a Virtual Machine we need to do the next steps:
- Create/Clone VM with Ubuntu Server 20.04
- Connect to VM via ssh connection
- Install WordPress on Ubuntu Server
- Export site via Plugin form Hosted WordPress Site
- Install Plugin on VM WordPress site
- Change Plugin Limit for VM WordPress site
- Import site via Plugin in VM WordPress site
Create/Clone VM with Ubuntu Server 20.04
Let’s create VM and install Ubuntu Server on it. Because I did it already for the YouTube video below, for this post I will just clone that VM and continue from there.
To Clone your VM you need to follow instructions below.
Also, I wanted to set the static IP address for the WordPress site on VM and I did that already in the next video.
Now we have a dedicated VM for our WordPress install with the static IP address for 192.168.0.200. Next, we need to follow instructions from https://ubuntu.com/tutorials/install-and-configure-wordpress#1-overview site. But that would be easier if we can just copy and paste command form instructions to our terminal. But that is not possible with this setup. So, let’s do the next thing. We need to use an ssh connection to our new VM from our Host OS. For this example, I’m using Windows 10 as the host OS and for windows 10 there is an ssh client app called Putty. Install Putty (or any ssh client) in order to connect from host to VM and then we can copy and paste commands to Putty terminal and they will be executed on the VM side.
Connect to VM via ssh connection
The first step is to install Putty on the host side. Go to Putty site and download it. If you are using Linux this step is much simpler because you can connect via Ssh from the terminal.
That is everything that we need to prepare on the host side, and there are requirements from the guest side as well. In order for ssh communication to be secured, we need to generate pair of ssh keys to have encrypted communication. In order to achieve that we need to have the private key on our host and a public key on our guest. But for this use case that is not optimal, because the server is located inside the local network only. So, in order to disable this check, we need to configure file /etc/ssh/sshd_config.
sudo nano /etc/ssh/sshd_config
We need to allow that authentication with only user password is required for connection, so we need to find, uncomment and change next line
Save file. Reset ssh with the command
sudo systemctl reset ssh
And now you should be able to connect with only the user name and password.
In the image below you have Putty window.
Select connection type to SSH and then enter in Host Name (Or IP address)
and in my case that was
Open terminal emulator and simply type the next command:
in my case that is:
After this, you will be prompted to enter the password and you will be in your VM.
Install WordPress on Ubuntu Server
Now we just need to copy and paste instructions from https://ubuntu.com/tutorials/install-and-configure-wordpress#1-overview and do simply 9 steps. We will skip step 8 in which you will create the first post because we want to Backup WordPress Site with Virtual Machine.
Export site via Plugin form Hosted WordPress Site
Login to the WordPress dashboard on the cloud host server. You will need to use the plugin All-In-One WP Migration. Install and Activate this plugin. Go to All-In-One WP Migration Tab and select Export. Then you want to select the export to File option and save the exported file.
Install Plugin on VM WordPress site
Install the same plugin on VM WordPress. Now, go to All-In-One WP Migration tab and now we need to go to Import section. But first, we need to increase file limit for this file.
Change Plugin Limit for VM WordPress site
We need to edit the next file
We need to add these lines, before line </IfModule> in order to increase the file size to 1Gb.
php_value upload_max_filesize 1024M php_value post_max_size 1024M php_value memory_limit 1024M php_value max_execution_time 0 php_value max_input_time 0
After this, we can continue with importing file. This is shown in the images below.
And now we have our WordPress server copied from our cloud host to Virtual Machine.
I’m hoping that you found this post Backup WordPress Site with Virtual Machine useful, as it was for me. I want peace of mind and to have a complete copy of my cloud-hosted WordPress site, and if something happens to the cloud host or I need to try something online. I will be able to do that on VM.
Did you manage to achieve the same result? Please commend down below and check out my other post about screen recording in Linux at https://bln364.com/screen-recording-on-linux-2022/