Take note of the ip address given to the VM
If you wish to use a custom domain, obtain your VM ip address from the Azure Portal and create an A record that points @ to the ip of the VM
apt-get update
apt-get install apache2
apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Open port 80 in the Network Security Group for your VM
Test by visiting the VM in a browser, you should see default Apache Config
SCP to obtain wordpress content form original server
Backup site contents:
mkdir [backupsitedirectory]
cp -R [originalsitedirectory] [backupsitedirectory]
tar -czvf [backupname].tar.gz -C [backupsitedirectory] .
THEN Copy to VM
scp [backupname].tar.gz [user]@[VirtualMachine]:~/[backupname].tar.gz
NEXT Extract to Proper Location and set Proper Permissions for Apache on VM
sudo mkdir /var/www/vhosts
tar -C /var/www/vhosts -xzvf ~/[backupname].tar.gz
sudo chown www-data:www-data -R /var/www/vhosts/
NEXT Configure Apache
Create a config for the new site
sudo vi /etc/apache2/sites-available/[sitename.TLD].conf
Paste in configuration details (this may be available in the original apache config file on the original machine)
<VirtualHost *:80>
ServerAdmin webmaster@[sitename.TLD]
DocumentRoot /var/www/vhosts/[sitename.TLD]
ServerName [sitename.TLD]
ServerAlias www.[sitename.TLD]
ErrorLog /var/log/apache2/[sitename.TLD]-error_log
CustomLog /var/log/apache2/[sitename.TLD]-access_log common
</VirtualHost>
Enable mod-rewrite
sudo a2enmod rewrite
Enable the site
sudo a2ensite [sitename.TLD].conf
Reload Apache
service apache2 reload
Revisit Site (Ctrl+F5 to ensure proper Refresh)
Note: Error establishing a database connection
Check wp-config.php to ensure you have a proper user / pass for database connection
Dump the original Database & all Users
-
mysqldump -u root -p --flush-privileges --routines --all-databases > [dumpfilename.sql]
OR for a specific Database:
-
mysqldump -u root -p --routines [database_name] > [dumpfilename.sql]
THEN Copy to VM
scp ~/[dumpfilename.sql] [user]@[VirtualMachine]:~/[dumpfilename.sql]
NEXT Import
mysql -u root -p < [dumpfilename.sql]
Revisit Site (Ctrl+F5 to ensure proper Refresh)
Everything should be working!