Hi
So I wrote a little guide for myself, I though I would be good to share it.
I'm not english so expect typos. This is not finished yet but works.
Regards.
(V)irtual (W)eb (D)evelopment (S)tack for (W)indows
VWDSW is powered by Debian, Drupal 7, Omega 4 and many free open sources softwares.
What is this ?
This is a guide for Windows users (beginners or advanced users) who wants to build a virtual web development stack, quickly and without all the hassle.
Software Requirement
- Windows XP/7/8*
- VirtualBox or any virtualization software
- Debian** or any Unix/Linux distro
Download link : http://cdimage.debian.org/debian-cd/7.1.0/amd64/iso-cd/debian-7.1.0-amd6...
* For best performance, it is recommanded to use x64 bits version with at least 4Gb of RAM and a processor with Intel (VT-x) or AMD (AMD-V).
** Debian Network install from a minimal CD (debian-7.1.0-amd64-netinst.iso) is used in this tutorial, you may need to edit some steps if you choose another Debian version or another Unix/Linux distro.
Knowledge Requirement
- Using a Unix/Linux Terminal
- Drupal 7
- HTML/CSS
Terminology & Documentations
# Debian : Operating System
Website : http://www.debian.org
Documentaton : http://www.debian.org/doc/
# GNOME : a desktop environment used by default on Debian
GNOME include many programs, as a web developer you are interested in :
- GNOME Terminal (terminal emulator)
- gedit (text editor), you could always install another text editor
- Iceweasel (web browser), it's a fork of Firefox
Website : http://www.gnome.org/
Documentaton : https://help.gnome.org/
# LAMP (Linux, Apache, MySQL and PHP) : combination of free, open source softwares.
Documentation : http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29
# MySQL : Database server
Website : http://www.mysql.com/
Documentation : http://dev.mysql.com/doc/
# Apache2 : HTTP server
Website : http://httpd.apache.org/
Documentation : http://httpd.apache.org/docs/
# PHP : A scripting language
Website : http://www.php.net/
Documentation : http://www.php.net/docs.php
# phpMyAdmin : Administration of MySQL over the Web
Website : http://www.phpmyadmin.net/home_page/
Documentation : http://www.phpmyadmin.net/home_page/docs.php
# PECL uploadprogress : A PHP An extension to track progress of a file upload
Website : http://pecl.php.net/package/uploadprogress
# cURL : Command line tool for getting or sending files using URL syntax.
Website : http://curl.haxx.se/
Documentation : http://curl.haxx.se/docs/
# RVM : Command line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
Website : https://rvm.io/
# Ruby : A dynamic programming language
Website : http://www.ruby-lang.org/
Documentation : http://www.ruby-lang.org/en/documentation/
# Drush : Command line shell and scripting interface for Drupal
Website : https://github.com/drush-ops/drush/
Documentation : http://www.drush.org/
# Drupal : Open-source content management framework
Website : https://drupal.org/
Documentation : https://drupal.org/documentation
Documentation : https://drupal.org/glossary
# Omega : Base Theme Framework
Website : https://drupal.org/project/omega/
Documentation : ?????
# Compass : CSS Authoring Framework
Website : http://compass-style.org/
Documentation : http://compass-style.org/reference/compass/
# Sass : Extension of CSS3
Website : http://sass-lang.com/
Documentation : http://sass-lang.com/docs.html
# Susy : Responsive grids for Compass
Website : http://susy.oddbird.net/
Documentation : http://susy.oddbird.net/guides/reference/
# Guard LiveReload : Automatically reload your browser when 'view' files are modified.
Website : https://github.com/guard/guard-livereload
Documentation : https://github.com/guard/guard#IMPORTANT
# Clean URL : URLs that do not contain a query string
Documentation : http://en.wikipedia.org/wiki/Clean_URL
Installation
1) Create a Virtual Machine
## Configuration
Type : Linux
Version : Debian (64 bit)
RAM : at least 512 Mb, 1024 Mb should be optimal
HDD type : VDI, use Fixed Size for better performance
HDD space : 8 Gb or more
## Before starting, check the following options and enable them if possible
System > Acceleration > Hardware virtualization : Enable VT-x/AMD-V *
Display > Video : Enable 3D acceleration **
Network > Mode : NAT
* If your processor support it, enable for better performance
** GNOME 3 require 3D acceleration for a full experience. If not enabled, it will run in fallback mode (see : https://help.gnome.org/users/gnome-help/3.3/fallback-mode.html.en).
2) Install Debian
## Start the virtual machine
## Choose and mount debian-7.1.0-amd64-netinst.iso
## Now it should boot to debian-7.1.0-amd64-netinst.iso, choose "Install" or "Graphical Install" then follow instructions.
## Login to Debian.
#################### IMPORTANT ####################
#################### IMPORTANT ####################
Be careful, you MUST always install packages as a root user.
#################### IMPORTANT ####################
#################### IMPORTANT ####################
3) Update your system
aptitude update && aptitude upgrade
4) Install MySQL
aptitude install mysql-server mysql-client -y
5) Install Apache2
aptitude install apache2 apache2-doc -y
## Apache2 should display "It works!" at http://localhost
## to test, type "iceweasel localhost"
6) Install PHP5
aptitude install php5 php5-mysql libapache2-mod-php5 -y
7) Install phpMyAdmin
aptitude install phpmyadmin -y
## choose apache2 when asked
## configure passwords
## phpMyAdmin will be available at http://localhost/phpmyadmin
## to test, type "iceweasel localhost/phpmyadmin"
8) Install PECL uploadprogress
## install dependencies
aptitude install make php5-dev php-pear -y
## install uploadprogress
pecl install uploadprogress -y
## add "extension=uploadprogress.so" to php.ini
echo "extension=uploadprogress.so" >> /etc/php5/apache2/php.ini
## restart apache2
/etc/init.d/apache2 reload
9) Install cURL
aptitude install curl -y
10) Integrating RVM with GNOME Terminal (see : http://rvm.io/integration/gnome-terminal)
## go to Edit > Profile Preferences > Title and Command
## check "Run command as a login shell"
## close Terminal
## open a new Terminal
11) Install RVM with latest Ruby stable release
\curl -L https://get.rvm.io | bash -s stable --ruby
## load RVM
source /usr/local/rvm/scripts/rvm
12) Install Ruby 1.9.3
rvm install 1.9.3
## check current rvm version, it should return "ruby-2.0.0-p247" or higher
rvm current
## set ruby 1.9.3 as default
rvm use 1.9.3 --default
## close Terminal
## open a new Terminal
13) Install Drush
aptitude install drush -y
14) Install Drupal
## create a database with phpMyAdmin, UTF-8 encoding (exemple : utf8_general_ci)
iceweasel localhost/phpmyadmin
## go to Apache2 folder
cd /var/www
## download Drupal
drush dl drupal
## renaming Drupal folder
mv /var/www/drupal-* /var/www/drupal
## creating "settings.php" configuration file
cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php
## make "settings.php" writeable
chmod 666 /var/www/drupal/sites/default/settings.php
## creating "files" and "private" folders
mkdir /var/www/drupal/sites/default/files
mkdir /var/www/drupal/sites/default/files/private
## add permissions to "files" and "private" folders
chown -R www-data /var/www/drupal/sites/default/files
chmod -R 0700 /var/www/drupal/sites/default/files
## run the installation script (see : https://drupal.org/documentation/install/run-script)
iceweasel localhost/drupal
## after installation, change "settings.php" permissions
chmod 644 /var/www/drupal/sites/default/settings.php
15) Install Omega
cd /var/www/drupal
drush dl omega
16) Create an Omega subtheme
cd /var/www/drupal
## clear cache, so omega drush commands will works
drush cc all
## launch a wizard for generating a subtheme, for this guide my subtheme name will be "mysupertheme"
drush owiz
17) install "mysupertheme" dependencies
cd /var/www/drupal/sites/all/themes/mysupertheme
bundle install
# If "bundle install" command is not found, you will need to load RVM "source /usr/local/rvm/scripts/rvm".
# You will need to run "bundle install" for each new subtheme, if any.
How to use Omega
#################### IMPORTANT ####################
#################### IMPORTANT ####################
- Next commands will only works AFTER "bundle install" and IN the related subtheme.
- Be careful, you must use a root terminal to run "compass" or "drush ogrd" commands.
- If you want to use your user account, you must change permissions to your subtheme (NEVER do that on a production server).
exemple : chmod -R 777 /var/www/drupal/sites/all/themes/mysupertheme
- If a command is not found, you will need to load RVM "source /usr/local/rvm/scripts/rvm". It should now always works as a user, but you must load it after each reboot for root user (should we/how to fix it ??????)
#################### IMPORTANT ####################
#################### IMPORTANT ####################
## Method 1 (basic) : Compile Sass stylesheets to CSS (one time)
cd /var/www/drupal/sites/all/themes/mysupertheme
compass compile
## Method 2 (better) : Compile Sass stylesheets to CSS when they change (always in "real time")
cd /var/www/drupal/sites/all/themes/mysupertheme
compass compile
## Method 3 (best) : Guard (???????????????????????????)
cd /var/www/drupal
drush ogrd
## Open a text editor and be creative !
gedit -b /var/www/drupal/sites/all/themes/mysupertheme/sass/mysupertheme.styles.scss
Logins & Passwords
## this is a template
## account_type : account_name / account_password
Debian root : root / debian
Debian user : omega / omega
MySQL : root / mysql
Drupal : admin / admin
Drush Commands
drush status : Provides a birds-eye view of the current Drupal installation, if any.
drush help : Drush provides an extensive help system that describes both drush commands and topics of general interest.
drush dl : Download projects from drupal.org or other sources (exemple : drush dl omega).
drush en : Enable one or more extensions (exemple : drush en omega).
drush dis : Disable one or more extensions (exemple : drush dis omega).
drush pml : Show a list of available extensions (modules and themes). If you only want to list core modules use "drush pml --no-core".
drush pmi : Show detailed info for one or more extensions (modules or themes).
drush upc : Update Drupal core and contrib projects.
drush updb : Apply any database updates required.
drush up : Update Drupal core and contrib projects and apply any pending database updates.
drush cc all : Clear all drupal caches (drush, theme-registry, menu, css-js, block, module-list, theme-list, registry).
drush sa : Print site alias records for all known site aliases and local sites.
drush upwd : (Re)Set the password for the user account with the specified name (exemple, admin account password will be reset to "foo" : drush upwd admin --password=foo)
drush oexp : Exports the theme settings of a given theme from the database to the .info file.
drush ogrd : Runs guard for the given theme including Compass and LiveReload by default.
drush orev : Reverts the theme settings of a given theme by deleting them from the database.
drush owiz : Guides you through a wizard for generating a subtheme.
Comments
Comment #1
fubhy CreditAttribution: fubhy commentedOh nice... Why did I miss this earlier? We definitely need to put some more work into this but then it's absolutely worth moving it into the handbooks! Awesome job. Thanks
Comment #2
akumajo CreditAttribution: akumajo commentedAh, this is old. Here my latest revision.
Comment #3
therobyouknow CreditAttribution: therobyouknow commentedHow does it perform? Is it reasonably responsive (in terms of speed)?
I'm using Vagrant to provision a VM on Windows and compared with the same Vagrant setup on MacOS, it is noticably slower on Windows.
Comment #4
fubhy CreditAttribution: fubhy commentedWindows is the worst possible environment for web development. Anything you will end up with on Windows is going to be slower compared to Mac or Linux, etc. VMs are slow, always. They are full blown kernels. Bottom-line: If you work in a VM, it's always going to be slower than working on the host environment directly. But it's still better to work in a VM than working in windows.
Comment #5
serg2 CreditAttribution: serg2 commentedIt is great to see all those steps in one place. A few months back when I followed the guides they were split over many pages and sites and it took an age to properly sort. The only errors that I spotted in the first version have been corrected in the second.
Comment #6
leolandotan CreditAttribution: leolandotan as a volunteer commentedHi, in this documentation it's installing rvm and other dev tools inside the VM. I came across fubhy's video on Omega 4.x Theme and he said there that his setup would be all dev tools would be on the host machine.
I commented here because I'm trying to do the same setup but livereload isn't working at all. For my OS I'm using Linux Mint 17 64bit with Vagrant and Virtualbox. I tried also using the latest stable VDD box to date but still no success.
So I made sure livereload in theme settings is enabled and using the default values and when I run bundle exec guard the output is just this:
Then I would do a vagrant up with the ff. output:
And of course in my /etc/hosts file:
Any thoughts on this configuration for a Linux host?
Thanks.