Git + VirtalBaox + Vagrant create a Linux Virtual Machine and virtualbaoxvagrant

Source: Internet
Author: User

Git + VirtalBaox + Vagrant create a Linux Virtual Machine and virtualbaoxvagrant

This article is from the Udacity Course: Linux Command Line Basics -- Getting Started with the Shell

Your own Linux box

To learn the Linux shell, you need a Linux machine to run it on. but we can't really ship a new Linux computer to every one of you. so instead you will set up a LinuxVirtual machine(VM) on your own computer.

You'll be using the VirtualBox application to run the virtual machine, and the vagrant software to configure it.

This virtual-machine setup is very similar to the ones you will use in later Udacity courses on the Linux platform. so when you get to those courses, you will not need to re-install this software.

Setting the virtual machine up is not complicated, but it will take some time when your computer downloads the Linux OS. Follow the instructions below to set it up before proceeding on in this course.

What's a virtual machine?

A virtual machine is a program that runs on your Windows or Mac computer, and that can run a different operating system inside it. in this case, you'll be running an Ubuntu Linux server system.

1. Install Git

You can skip this step if you are not running Windows, but your other courses use Git, so you may want to install it now.

Download Git from git-scm.com. Install the version for your operating system.

On Windows, Git will provide you withGit BashTerminal program, which you will use to run and connect to your Linux VM.

2. Find your terminal program

To take this course you will need to useTerminal program, Which presents the shell user interface and lets you log in to your Linux VM.

  • Windows: UseGit BashProgram, which is installed with Git (above ).
  • Mac OS X: UseTerminalProgram, located in yourApplications/UtilitiesFolder.
  • Linux: Use any terminal program (e.g.XtermOrGnome-terminal).
3. Install VirtualBox

VirtualBox is the software that actually runs the VM. You can download it from virtualbox.org, here. InstallPlatform packageFor your operating system. You do not need the extension pack or the SDK. You do not need to launch VirtualBox after installing it.

Ubuntu 14.04 Note:If you are running Ubuntu 14.04, install VirtualBox using the Ubuntu Software Center, not the virtualbox.org web site. Due to a reported bug, installing VirtualBox from the site may uninstall other software you need.

4. Install Vagrant

Vagrant is the software that configures the VM and lets you share files between your host computer and the VM's filesystem. You can download it from vagrantup.com. Install the version for your operating system.

Windows Note:The Installer may ask you to grant network permissions to Vagrant or make a firewall exception. Be sure to allow this.

5. Download the VM configuration file

Make a new folder to keep your workspace for this course. You might call itShell, But whatever name you pick is OK. Keep track of what folder you created it in (for instance,Desktop).

InSupporting MaterialsSection of this page, below, you'll find a link to the configuration file, calledVagrantfile. Download this file into the new folder you just created.

6. Run the virtual machine!

Open your terminal program. Type this shell command and press Enter:

cd Desktop/Shell

(If your new folder is called something other than "Shell", or is located somewhere other than "Desktop", change those .)

Then start the VM by running the commandvagrant up.

This will make your system download the Linux OS and start up the virtual machine. unfortunately, this will take a long time on most network connections. fortunately, you only have to do it once, and the same Linux OS image will work for later Udacity courses too.

Once it is done, run the commandvagrant ssh.

And you will be logged in to the virtual machine and ready to do the course exercises!

The Udacity VM is the official shell for this class, but if your computer already has a Unix * shell you can use it if you prefer.

Caveat:Your computer's own shell may differ from the VM in unanticipated ways, and may not have all the programs installed which the VM provides. The recommended environment is the VM.

* If you're running Linux or Mac OS X for instance

Supporting Materials

Vagrantfile

 

In the VM or out of the VM?

We 've set this course's exercises up to work in the virtual machine (VM) that you set up usingVagrantProgram. if you get logged out of the VM, you may end up typing shell commands in to your regular operating system instead of to the Linux system that we 've ve set up for the course. some commands won't work, and some files probably won't be where the course expects them to be.

Getting logged out

If you type the commandExitInto the shell, or if you typeControl-D, You will see a message like this:

logout  Connection to 127.0.0.1 closed.

This just means that you got logged out. After logging out, you won't be in the VM any more.

To get back into the VM, use the commandvagrant ssh.

If vagrant sshDoesn' t work

If you get a message like this:

VM must be running to open SSH connection. Run `vagrant up`to start the virtual machine.

This means that the VM program is not running, for instance because you rebooted your computer. This is just fine and it doesn't mean you 've ve lost any work. Just runvagrant upTo bring the VM back up, thenvagrant sshTo log in.

This will not take as long as the first time you ran it, because it won't need to download the Linux OS.

If vagrant upDoesn' t work

If you get a message like this:

A Vagrant environment or target machine is required to run thiscommand. Run `vagrant init` to create a new Vagrant environment. Or,get an ID of a target machine from `vagrant global-status` to runthis command on. A final option is to change to a directory with aVagrantfile and to try again.

That means thatVagrantCan't find the configuration file you downloaded. Go back to the instructions, check to be sure that you did step 5, and then do step 6 again.

Multiple terminals

If you open up more than one terminal window, only the one (s) that you ranvagrant sshIn will be connected to your Linux OS for this course. The others will be connected to your regular OS.

(It's actually really normal for Linux users to have to carefully keep track of which terminal windows are connected to which machines. don't panic. just look for whether "vagrant" appears on the command line .)

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.