Skip to content

Instantly share code, notes, and snippets.

@geraldvillorente
Created November 27, 2014 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geraldvillorente/f57d3832e5bd5f4de6c4 to your computer and use it in GitHub Desktop.
Save geraldvillorente/f57d3832e5bd5f4de6c4 to your computer and use it in GitHub Desktop.
Setting up a Drupal Environment in Ubuntu Vagrant
Do these steps inside your Vagrant machine.
1. Web Server
sudo apt-get install apache2
2. PHP5
sudo apt-get install php5 libapache2-mod-php5
3. MySQL
sudo apt-get install mysql-server mysql-client
4. PHP Modules
sudo apt-get install php5-mysql php5-cli php5-gd
5. Drush
sudo apt-get install php-pear
sudo pear channel-discover pear.drush.org
sudo pear install drush/drush
sudo drush
sudo chown $USER ~/.drush/cache
6. Download latest Drupal 7
drush dl drupal --destination=[/PATH/TO/MOUNTED-SHARED/FOLDER]
NOTE: The mounted folder is the first parameter you indicated in your Vagrantfile synced_folder.
config.vm.synced_folder "./htdocs", "/var/www/"
In the above example the mounted folder is the htdocs and the mount
location is /var/www. Please read the inline comment on top of
config.vm.synced_folder for more details.
Using the example above your --destination would be...
drush dl drupal --destination=/var/www/
7. Create Vhost
sudo nano /etc/apache2/sites-available/[FILENAME_YOU_WANT].conf
And put this code...
<VirtualHost *:80>
ServerName [DOMAIN]
DocumentRoot [/PATH/TO/DRUPAL/]
<Directory [/PATH/TO/DRUPAL/]>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Example...
<VirtualHost *:80>
ServerName dev.drupalproject.local
DocumentRoot /var/www/drupal7/
<Directory /var/www/drupal7/>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
8. Then enable the vhost configuration
sudo a2ensite [FILENAME_YOU_MADE_IN_#7].conf
9. Edit the hosts file
sudo nano /etc/hosts
Then put this directive...
127.0.0.1 [DOMAIN]
Example...
127.0.0.1 dev.drupalproject.local
10. Restart Apache
sudo /etc/init.d/apache2 restart
Do these steps in your host machine.
11. On host machine...
sudo nano /etc/hosts
Then put this directive...
[IP_ADDRESS_OF_VAGRANT] [DOMAIN]
Example...
192.168.33.10 dev.drupalproject.local
12. In your browser
http://dev.drupalproject.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment