{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Mining the Social Web, 2nd Edition\n", "\n", "##Appendix A: Virtual Machine Experience\n", "\n", "This IPython Notebook provides a brief overview of how to install and configure the book's virtual machine for maximal enjoyment in following along with the numbered examples from [_Mining the Social Web (2nd Edition)_](http://bit.ly/135dHfs). You are very strongly encouraged to install the virtual machine as a development environment instead of using your existing Python installation because there are some non-trivial configuration management issues that are involved in installing IPython Notebook and its dependencies along with various 3rd party Python packages that are used throughout the book, and the need to support users across multiple platforms only exacerbates the complexity. In short, the virtual machine experience is intended to provide all readers and consumers of this book's source code with the best possible experience. Even if you are an expert in working with Python developer tools, you will still likely save some time by taking advantage of the book's virtual machine experience on your first pass through the book, so give it a try.\n", "\n", "The remainder of this notebook provides a brief overview of how to install the virtual machine along with a few important notes to keep in mind each step of the way.\n", "\n", "In the somewhat unlikely event that you've somehow stumbled across this notebook outside of its context on GitHub, [you can find the full source code repository here](http://bit.ly/16kGNyb)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Screencast Overview\n", "\n", "The following screencast is less than 3 minutes and illustrates the step-by-step instructions below for installing the _Mining the Social Web_ virtual machine.

\n", "\n", "
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Quick Start Instructions\n", "\n", "In order to start the Vagrant-based virtual machine for _Mining the Social Web_, there are just a few easy steps to follow:\n", "\n", "1. Download and install the latest copy of [VirtualBox](https://www.virtualbox.org/) for your operating system\n", " * Although additional working knowledge of VirtualBox could be helpful, just accomplishing an installation is sufficient. However, see an important note below for Windows and Linux users that may require you to adjust your computer's BIOS settings for virtualization\n", " * The version of VirtualBox used as of this writing is 4.2.x. Type \"VirtualBox --help\" in a terminal to get version information if you already have it installed.\n", "2. Download and install [Vagrant](http://www.vagrantup.com/) for your operating system\n", " * It _is_ highly recommended that you take a moment to read Vagrant's excellent \"Getting Started\" guide as a matter of initial familiarization\n", " * If you already have Vagrant installed, be sure that it's running version 1.2 or higher by typing \"vagrant -v\" in a terminal\n", " * The creator of Vagrant has written a book about it entitled [Vagrant: Up and Running](http://oreil.ly/160VQcv)\n", "3. Checkout this book's source code from [its GitHub repository](http://bit.ly/16kGNyb) to your machine using [Git](http://git-scm.com/downloads) or with the download links at the top of the main GitHub page.\n", " * Windows users should install [Git for Windows](http://msysgit.github.io/) as it comes bundled with an SSH client that might come in handy later if you'd like to easily login to your virtual machine guest with Vagrant. (See screenshots and notes below. It is critical that you _choose the option that includes an SSH client._)\n", " * Although you could opt to download the latest version of the source code from GitHub as a [zip file](https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition/archive/master.zip), basic familiarization with Git is likely to serve you well in your programming endeavors and is encouraged\n", " * In a terminal, navigate to the top level directory of the source code checkout that contains _Vagrantfile_.\n", " * On a Windows system, look for a [Command Prompt](http://www.bleepingcomputer.com/tutorials/windows-command-prompt-introduction/) program that's likely somewhere under your \"Accessories\" menu.\n", "4. Run the following command from within the top level directory that contains your _Vagrantfile_: vagrant up\n", " * The first time you run this command, Vagrant will prompt you to download a base image for your virtual machine called _precise64_, which is an Ubuntu 12 Linux image. It may take anywhere between 10 and 30 minutes to download the base image and install the necessary updates and 3rd party packages depending on your connection speed.\n", " * In the event that you are running a 32-bit system, you'll need to change \"precise64\" to \"precise32\" in your _Vagrantfile_.\n", " * You should disable any settings which may allow your system to go into a sleep or hybernation mode while your virtual machine initially bootstraps." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "## What Happens Next\n", "\n", "* What should happen at this point is that Vagrant will use the Vagrantfile and [Chef-based configuration management](http://docs.opscode.com/) directives to download a Virtualbox base image and configure it. The first time you vagrant up, it takes ~20 minutes on average to download the ~323MB base image and then download/install critical updates and 3rd party packages. This time is largely dependent upon your Internet connection speed and hardware.\n", "* When all of the dependencies are installed, Vagrant will start the [IPython Notebook](http://ipython.org/notebook.html) server automatically on the virtual machine, map a shared directory onto your host machine, and configure the necessary ports for you to use your web browser to experience IPython Notebook.\n", "* When Vagrant finishes configuring your virtual machine, your terminal will return you back to a prompt. The final lines of its output should read something like the following:\n", "\n", "\n", "[2013-07-27T01:45:27+00:00] INFO: runit_service[ipython] enabled\n", "[2013-07-27T01:45:27+00:00] INFO: Chef Run complete in 1553.918395 seconds\n", "[2013-07-27T01:45:27+00:00] DEBUG: Cleaning the checksum cache\n", "[2013-07-27T01:45:27+00:00] INFO: Running report handlers\n", "[2013-07-27T01:45:27+00:00] INFO: Report handlers complete\n", "[2013-07-27T01:45:27+00:00] DEBUG: Exiting\n", "\n", "\n", "* At this point, an IPython Notebook server is running on your virtual machine, and you can access it from the web browser that you normally use on your host machine. Navigate to http://localhost:8888 and read the instructions in the \"Chapter 0 - Preface\" notebook to get started!\n", " * There is nothing else to do with the virtual machine aside from a shutting it down when you'd like to stop working and recover the memory on your guest machine. (See the \"Vagrant Cheat Sheet\" below.) \n", " * The virtual machine does not provide you with a desktop or graphical user interface. It runs an IPython Notebook server that you can connect to with your guest machine. The fundamental value proposition is that the virtual machine makes it possible to isolate and automate all of the configuration management for all example code in _Mining the Social Web_ so that you don't have to do any of it yourself.\n", " * Although not absolutely necessary, it still would be a worthwhile endeavor to learn how to vagrant ssh into the virtual machine and get more comfortable working with developer tools in a terminal environment. Take it one step at a time." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Vagrant Cheat Sheet\n", "\n", "You are strongly encouraged to peruse [Vagrant's documentation online](http://docs.vagrantup.com/v2/getting-started/teardown.html) to get a basic understanding of how it works. Once you have a general working knowledge, the following commands are likely to be the primary ones that you'll want to know how to use. Anytime you run these commands, it needs to be in the top level source code directory in which your _Vagrantfile_ is located. Your _Vagrantfile_ provides the basis for which the commands operate.\n", "\n", "### Essential Commands\n", "\n", "* vagrant up - Starts your virtual machine.\n", "* vagrant status - Tells you if your virtual machine is running.\n", "* vagrant suspend - Saves the state of your virtual machine. (Similar to putting it to sleep.)\n", "* vagrant resume - Restores a suspended virtual machine. (Similar to waking it up from sleep.)\n", " * After your first vagrant up, a suspend/resume operation only takes a few seconds.\n", " * Destroying your virtual machine means that you'll need to wait through the ~20 minute boostrap process the next time that you vagrant up.\n", "\n", "### Commands for Advanced Users\n", "\n", "* vagrant halt - Shuts down your virtual machine.\n", " * After your first bootstrap, a vagrant up only takes about one minute to complete.\n", "* vagrant destroy - Destroys your virtual machine to the state of its base image.\n", " * After you destroy a virtual machine, a vagrant up takes the full ~20 minutes to complete.\n", "* vagrant ssh - Logs you into your virtual machine over SSH and provides a terminal." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## Troubleshooting\n", "\n", "* Linux/Windows users running on non-Apple hardware may experience problems running Vagrant that are related to BIOS settings\n", " * If you are running on non-Apple hardware such as a Dell laptop or any other system running Windows or Linux, you may very well need to review and adjust your machine's [BIOS](https://en.wikipedia.org/wiki/BIOS) settings in order to enable virtualization, which is likely disabled by default. If you're not familiar with \"BIOS settings\", think of it as a special control panel that allows you to adjust some very specialized hardware specific settings. When you reboot your system, you will usually see a message that explains how to enter into your system's BIOS settings and it usually involves pressing a particular key within a few seconds from the time it displays.\n", " * In the BIOS settings for a Dell system, look for \"Virtualization\" options that may be embedded into options or menus related to \"POST Behavior.\" The settings should provide binary options for \"Off\" and \"Enabled\" with a description to the effect of \"This field specifies whether a Virtual Machine Manager (VMM) can utilize the additional hardware capabilities provided by Intel(R) Virtualization Technology. It is likely the case that the VMM technology is disabled by default, so you would want to adjust this setting to enable the VMM technology.\n", " * If in the course of trying to use Vagrant to startup your Virtualbox you encounter an error to the effect of \"No VT-x or AMD-V CPU extension found. Reason VERR_VMX_MSR_LOCKED_OR_DISABLED\", it is almost definitely the case that your BIOS settings will need to be adjusted.\n", "* Windows users should check to see that Git, Vagrant, SSH and other software packages are properly installed by typing \"git\", \"vagrant\", and \"ssh\" in a command prompt. If it is not installed, you'll get back a error message indicating that no such command could be found. If it is installed, you'll get back a message from the program indicating how to use it.\n", "* If you experience troubles of any kind that you can't handle yourself, reach out on Twitter, Facebook, or better yet, file an issue at GitHub to request help\n", "* Advanced users (who despite all attempts at convincing to use the virtual machine still prefer to run with their own installation) may benefit from reviewing the Chef-based configuration management in the [deploy](https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition/blob/master/deploy) folder that encapsulates the steps required to get a good environment working with a minimal Linux base image. It's the exact set of steps that are used by Vagrant during configuration to bootstrap the virtual machine.\n", "\n", "Consult (or contribute to) the [Virtual Machine Installation Page](https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition/wiki/Virtual-Machine-Installation) on the [wiki](https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition/wiki) or [open a ticket](https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition/issues) if you experience any problems." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Git and GitHub\n", "\n", "In the event that you've never used a version control system such as Git to obtain or manage source code, be assured that it's well worth the investment to learn Git fundamentals. The first two chapters of http://gitscm.com/ are particularly worth the 15 or so minutes that it takes to complete, and you'll also find that Stack Overflow also contains a plethora of answers to common Git questions and best practice guidelines.\n", "\n", "The absolute minimum Git skills that you'll want to know for consuming the source code of this book include:\n", "\n", "* git clone - With git, you _clone_ a repository to get its source code, and you'll need to git clone git@github.com:ptwobrussell/Mining-the-Social-Web-2nd-Edition.git to get source code for this repository. (The repository URL is provided in the right margin of https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition if you missed it.) \n", "* git status - You can check the _status_ of your repository by typing git status in the source code directory that you cloned. A common reason that you'll use git status is to determine if there are updates in the _remote_ repository that you can _pull_ down.\n", "* git pull - Whenever the maintainer of a repository makes an update, you can _pull_ the update by simply typing git pull in the source code directory that you cloned.\n", "* git checkout - You can use git checkout to _checkout_ a file you may have modified to restore it to its previous state.\n", "\n", "As you become more comfortable with Git, you may want to _fork_ a Git repository, _commit_ changes to it, and _push_ your changes to the master branch on GitHub. Consult http://gitscm.com/ for more information on how to do these things when you are ready to make that additional leap.\n", "\n", "You are certainly able to download a zip archive of a GitHub repository's source code (look for the \"Download ZIP\" button in the right margin), but doing so would be a bit ironic. This book is all about the social web, and you'd be avoiding the premier social coding platform that hosts its project code. GitHub is inherently social, and there are benefits to participating that you can't gain any other way besides plugging in, being part of the community, and applying some Git fundamentals to contribute from time to time. Forking code, opening pull requests, and otherwise contributing within the boundaries of the GitHub platform tooling is much easier than you might initially think because GitHub delivers such a tremendous user experience. Take a few extra minutes to checkout the source code from GitHub instead of downloading a zip archive. You'll be glad that you took those steps." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## \"Git for Windows\" Installation Screenshots\n", "\n", "The following screenshots may be helpful as references for Windows users who are installing Git for Windows.\n", "\n", "
\n", "_Windows users should opt to install the developer tools while installing Git for Windows in order to get SSH, which allows Vagrant's \"vagrant ssh\" command to seamlessly work._
\n", "\n", "
\n", "_Logging into your virtual machine (should you need or desire to do so for advanced troubleshooting) is as easy as \"vagrant ssh\" so long as you have an SSH client in your path_
\n", "\n", "
\n", "_Once you have run \"vagrant up\" and your virtual machine is up and running, you essentially operate as though the virtual machine is just a piece of software running like any other. For example, you'll operate in your web browser just like normal to access IPython Notebook, which is where you'll spend all of your time. The nice thing about the virtual machine experience is that it allows you to use your host operating system as usual, although it encapsulates all of the messy configuration management details to a well-known and highly controlled environment._
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Thank You!\n", "\n", "Please file tickets here on GitHub if you experience any troubles whatsoever, and thanks again for your interest in _Mining the Social Web (2nd Edition)_. The goal in providing you with a completely turn-key machine experience is so that you can get the most out of the book and its source code -- not to divert your attention into unnecessary system configuration issues. Feedback on ways to improve this experience is always welcome, and _pull requests are especially appreciated._" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Copyright and Licensing\n", "\n", "You are free to use or adapt this notebook for any purpose you'd like. However, please respect the [Simplified BSD License](https://github.com/ptwobrussell/Mining-the-Social-Web-2nd-Edition/blob/master/LICENSE.txt) that governs its use." ] } ], "metadata": {} } ] }