## Export the drupal site 1. 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](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-16-04) 2. 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 ## Install Apache in the new machine 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. ## Configure Virtual Host 1. 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 2. Configure the file similar to the following example: ServerAdmin oursite@oursite.com ServerName oursite.com ServerAlias www.oursite.com DocumentRoot /var/www/html/index.php Options FollowSymlinks AllowOverride All # AllowOverride All to allow the use of .htaccess files ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined 3. Enable the site using the a2ensite previously installed: $ sudo a2ensite oursite.conf //run this command from the sites-availabe directory 4. Restart apache $ sudo service apache2 restart //restart again ## Import database using phpmyadmin 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. ## Deploy Drupal Site 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. ### Source - [Install Apache](https://jarroba.com/configurar-un-apache-en-un-servidor-linux-digitalocean-con-dominio-y-subdominios-partei/) - [Howtogeek compress folder](https://www.howtogeek.com/248780/how-to-compress-and-extract-files-using-the-tar-command-on-linux/) - [How to install phpmyadmin](https://www.rosehosting.com/blog/install-phpmyadmin-on-ubuntu-16-04/)