-
Export the database using the export functionality from phpmyadmin. Use the default configuration - Quick, Format SQL. Remember to select the database to export before accessing to this operation. How to install phpmyadmin
-
Compress the web page code to send to the new virtual machine. You can do it by the following command:
$ tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
The following packages must be installed (remove the comments):
$ sudo apt-get install vim //vim editor
$ sudo apt-get install a2ensite //apache module to enable sites
$ sudo apt-get install apache2 //apache itself
$ sudo /etc/init.d/apache2 restart //restart apache to aply the changes
$ sudo apt-get install php7.0 //install php - version 7.0 can change concerning your distro (Ubuntu 16.04LTS)
$ sudo apt-get install libapache2-mod-php7.0 //apache module for php. Be aware of the version
$ sudo /etc/init.d/apache2 restart //restart again
$ sudo apt-get install mysql-server //install mysql server, you must define the root password for the master table
$ sudo apt-get install php7.0-mysql //package to run mysql with php
To check if the installation have succeded, you must see the apache default web page if you insert your virtual machine ip in your browser.
Now, we have to configure apache to point to our site. To this end we must configure a virutal host.
-
Go to the sites-available directory from your apache2 installation and configure the respective file.
$ cd /etc/apache2/sites-available $ sudo cp 000-default.conf oursite.conf $ vim oursite.conf
-
Configure the file similar to the following example:
<VirtualHost *:80> ServerAdmin [email protected] ServerName oursite.com ServerAlias www.oursite.com DocumentRoot /var/www/html/index.php <Directory /var/www/html/oursite> Options FollowSymlinks AllowOverride All </Directory> # AllowOverride All to allow the use of .htaccess files ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
-
Enable the site using the a2ensite previously installed:
$ sudo a2ensite oursite.conf //run this command from the sites-availabe directory
-
Restart apache
$ sudo service apache2 restart //restart again
First of all we must configure php to accept larger files to be uploaded. We must then modify the following file:
$ sudo nano /etc/php/7.0/apache2/php.ini
Values to be modified are these three:
upload_max_filesize = 1000M
memory_limit = 1500M
post_max_size = 1500M
Select your suitable values according to the file size of your database to be imported. After configuring thee file, we must restart apache.
Once uploaded your site to the server, we must copy the drupal project to the ubuntu web folder:
$ sudo cp drupal_site /var/www/html/drupal_site
Finally, we must check the drupal site settings to point to the target database using the respective user that has permissions over the imported database. This file is located in drupal_site/sites/default/settings.php.