Git+VirtalBaox+Vagrant创建Linux虚拟机
文章内容来自Udacity课程: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 Linux virtual 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 many 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 with the Git Bash terminal 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 use a terminal program, which presents the shell user interface and lets you log in to your Linux VM.
- Windows: Use the Git Bash program, which is installed with Git (above).
- Mac OS X: Use the Terminal program, located in your Applications/Utilities folder.
- Linux: Use any terminal program (e.g. xterm or gnome-terminal).
3. Install VirtualBox
VirtualBox is the software that actually runs the VM. You can download it from virtualbox.org, here. Install the platform package for 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 it Shell, but whatever name you pick is OK. Keep track of what folder you created it in (for instance, Desktop).
In the Supporting Materials section of this page, below, you'll find a link to the configuration file, called Vagrantfile. 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 command vagrant 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 command vagrant 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
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 using the vagrant program. 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 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 command exit into the shell, or if you type Control-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 command vagrant ssh.
If vagrant ssh doesn'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 lost any work. Just run vagrant up to bring the VM back up, then vagrant ssh to 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 up doesn't work
If you get a message like this:
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
That means that vagrant can'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 ran vagrant ssh in 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.)
Git+VirtalBaox+Vagrant创建Linux虚拟机的更多相关文章
- 如何在VMware workstation上创建Linux虚拟机
由于需要使用Linux虚拟机部署Hadoop集群,故在win10系统上安装了VMware workstation 14,现将介绍如何在VMware workstation上创建Linux虚拟机.下面以 ...
- Linux day01(一) 创建Linux虚拟机,设置虚拟机默认属性,虚拟机和Xhell建立连接
一:创建Linux虚拟机步骤: 1. 二:设置虚拟机默认属性 三:虚拟机和Xhell建立连接
- 使用Azure CLI创建Linux虚拟机
Azure提供了三种方式创建虚拟机,分别是Azure CLI.Azure PowerShell和Azure门户.本文介绍使用Azure CLI来创建Linux虚拟机. 使用Azure CLI创建Lin ...
- 利用Vmware 创建Linux虚拟机的方法
https://blog.csdn.net/qq_34929457/article/details/52663265 使用VMware新建一个Linux系统虚拟机 原创 2016年09月25日 17: ...
- 使用 PowerShell 创建 Linux 虚拟机
Azure PowerShell 模块用于从 PowerShell 命令行或脚本创建和管理 Azure 资源. 本指南详细介绍了如何使用 Azure PowerShell 模块部署运行 Ubuntu ...
- 使用 Azure 门户创建 Linux 虚拟机
可以通过 Azure 门户创建 Azure 虚拟机. 此方法提供一个基于浏览器的用户界面,用于创建和配置虚拟机和所有相关的资源. 本快速入门介绍了如何创建虚拟机并在 VM 上安装 webserver. ...
- 使用 Azure CLI 创建 Linux 虚拟机
Azure CLI 用于从命令行或脚本创建和管理 Azure 资源. 本指南详细介绍了如何使用 Azure CLI 部署运行 Ubuntu 服务器的虚拟机. 服务器部署以后,将创建 SSH 连接,并且 ...
- 如何创建linux虚拟机
一.安装配置linux虚拟机 第1步:运行"Vmware WorkStation",看到主页面. 第2步:创建新的虚拟机,新建虚拟机向导——典型(推荐). 第3步:选择稍后安装操作 ...
- VMware创建Linux虚拟机并安装CentOS(三)
选择“创建自定义布局”手动给Linux指定系统分区.交换分区,鼠标单击“下一步”按钮继续. 首先创建交Swap分区,鼠标单击“创建”按钮,在弹出的“生成存储”对话框中,生成分区选择“标准分区”:鼠标单 ...
随机推荐
- HDU 5120 A Curious Matt(2014北京赛区现场赛A题 简单模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112 解题报告:扫一遍 #include<cstdio> #include<cstr ...
- Fedora 25 Alpha版本今天发布啦
时隔Fedora 24发布后的3个月,Fedora项目团队非常开心的宣布任何感兴趣的用户都能下载和测试即将到来的Fedora 25操作系统的Alpha预发布版本,在Fedora 25 Alpha里程碑 ...
- 加载状态为complete时移除loading效果
一.JS代码: //获取浏览器页面可见高度和宽度 var _PageHeight = document.documentElement.clientHeight, _PageWidth = docum ...
- VirtualBox CentOS安装增强功能与设置共享文件夹
如果安装的是CentOS minimal版无网络的可以看这篇文章. 一.安装依赖环境 依次执行如下命令 yum install update yum install kernel-headers yu ...
- git 教程(10)--添加远程库
现在的情景是,你已经在本地创建了一个Git仓库后,又想在GitHub创建一个Git仓库,并且让这两个仓库进行远程同步,这样,GitHub上的仓库既可以作为备份,又可以让其他人通过该仓库来协作,真是一举 ...
- r-cnn学习系列(三):从r-cnn到faster r-cnn
把r-cnn系列总结下,让整个流程更清晰. 整个系列是从r-cnn至spp-net到fast r-cnn再到faster r-cnn. RCNN 输入图像,使用selective search来构造 ...
- Struts2中关于"There is no Action mapped for namespace / and action name"的总结
今天在调试一个基础的Struts2框架小程序.总是提示"There is no Action mapped for namespace / and action name"的错误. ...
- 一个按比特位拷贝数据的函数copybits
一个按比特位拷贝数据的函数 没有进行特别的优化.其实还可以在拷贝源开始位置和目标开始位置是2的整数倍位置的时候进行优化. 说明 这个函数用于从src数组首地址跳过sbb个字节,又跳过ssb个比特位,拷 ...
- innerHtml innerText textContent兼容性问题
innerHtml,innerText,textContentinnerHtml获取元素带标签的内容:innerText只获取元素的文本:火狐不支持innerText,支持textContent: / ...
- C语言的执行
在ANSIC 的任何一种实现中,有两种不同的环境 翻译环境:将源代码转换为可执行的机器代码 执行环境:用于执行代码 这两种环境可以运行于同一个机器上,也可以运行于不同的机器上 例如交叉编译器:在一台机 ...