Git+VirtalBaox+Vagrant創建Linux虛擬機

来源:http://www.cnblogs.com/yarightok/archive/2016/07/11/5660760.html
-Advertisement-
Play Games

文章內容來自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 ...


文章內容來自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

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 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.)

 

 

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 上文《詳細講解redis數據結構(記憶體模型)以及常用命令》介紹了redis的數據類型以及常用命令,本文我們來學習下redis的一些高級特性。目錄如下: 安全性設置 設置客戶端操作秘密 客戶端授權方式 主從複製 主從複製的特點 主從複製的過程 配置主從伺服器 事務與鎖 事務開啟與取消 樂觀鎖 持久化機 ...
  • 我從網上查的資料,解決方案都是設置MIME 映射和“處理腳本映射”。 我按照網上的解決方案執行之後還沒有解決我的這個問題,所以我想會不會是其他的原因。 在那麼一瞬間,靈光一閃,我把json文件放到新建的另一個文件夾裡面,然後我又重新設置了訪問文件的路徑。 本來我的訪問路徑是 後來改成了這個訪問路徑, ...
  • Nginx一個高性能的HTTP和反向代理伺服器,也是一個IMAP/POP3/SMTP伺服器,一個Apache伺服器不錯的替代品。 能夠支持高達 50,000 個併發連接數的響應 負載均衡伺服器 郵件代理伺服器 它,一款輕量級的web伺服器越來越被人們所熟知。作為即將要步上運維的我,也不得不去學習、了 ...
  • 對於美好事務的追求無論何時都不算晚。 文章內容來著我整理的 "fetool" ,以下內容可能更新不及時 Mac 下的軟體那麼多,又是免費又是付費,應該怎麼選呢?我來分享下我的推薦列表,推薦的優先順序老規矩,從上往下依次降低。 "Alfred" 免費 ,絕對的推薦Top1,很提效率,高級版 售價 。除了 ...
  • 以前在學校的時候,多線程這一部分是屬於那種充滿好奇但是又感覺很難掌握的部分。原因嘛我覺得是這玩意兒和編程語言無關,主要和操作系統的有關,所以這部分內容主要出現在講原理的操作系統書的某一章,看完原理是懂了,但是呢很難和編程實際結合起來,感覺很抽象,因為一般操作系統的書都沒有啥代碼。換到編程相關的書籍上 ...
  • 這裡先進行簡單的nginx負載,安裝nginx這裡就不多說了,我們情景假設在已經安裝好了nginx上: 1)查詢nginx中的upstrea負載均衡模塊 預設是有安裝的。進入nginx源碼目錄中 可以看到: 2)進入conf目錄,然後將配置文件過濾,為了讓我們看得更加清楚 3)查看負載均衡模塊的說明 ...
  • Linux文件系統是一個倒立的單根樹狀結構,文件名稱嚴格區分大小寫(windows系統則是對大小寫不明感的)。路徑用“/”分隔,跟windows的“\”不同。 這裡我畫了一張一般Linux系統的正常目錄結構圖: 單根指最頂級的目錄“/”,下麵每個目錄的大致作用如下: bin:保存常用的可執行的二進位 ...
  • 一、常用命令速查 以上是常用命令速查表,以下是命令詳解。 二、Linux 文件/目錄管理類命令詳解 Linux命令詳解之–ls命令 Linux命令詳解之–cd命令 Linux命令詳解之—pwd命令 Linux命令詳解之—cp命令 Linux命令詳解之–scp命令 Linux命令詳解之–mv命令 Li ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...