{"id":159,"date":"2015-05-17T19:08:14","date_gmt":"2015-05-17T19:08:14","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=159"},"modified":"2015-05-17T19:08:14","modified_gmt":"2015-05-17T19:08:14","slug":"linux-ubuntu-hyper-v","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/linux\/ubuntu\/hyper-v\/","title":{"rendered":"Developing for Ubuntu with Visual Studio and Hyper-V"},"content":{"rendered":"\n<p>This tutorial shows how to configure a Hyper-V virtual machine to run Ubuntu 15 and use Visual Studio with VisualGDB to develop applications for it from Visual Studio. In this tutorial we will use Visual Studio 2015 Preview, Windows 10 Preview and Ubuntu 15.<\/p>\n<p>Before you begin, install Visual Studio and <a href=\"http:\/\/visualgdb.com\/download\/\">VisualGDB<\/a> on your machine.<\/p>\n<ol>\n<li>Enable Hyper-V. To do this, open Control Panel, go to Programs and select &#8220;Turn Windows features on and off&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/01-features.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/01-features.png\" alt=\"01-features\" width=\"660\" height=\"364\" \/><\/a><\/li>\n<li>Enable &#8220;Hyper-V&#8221;. Ensure that you install both the platform and the management tools:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/02-hyperv.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/02-hyperv.png\" alt=\"02-hyperv\" width=\"415\" height=\"368\" \/><\/a><\/li>\n<li>Find Hyper-V in start menu and start the Hyper-v Manager:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/03-startmenu.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/03-startmenu.png\" alt=\"03-startmenu\" width=\"645\" height=\"324\" \/><\/a><\/li>\n<li>Before you can create any VMs, you need to configure network settings so that you can communicate to your VM. Click on &#8220;Virtual Switch Manager&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/04-hypervcons.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/04-hypervcons.png\" alt=\"04-hypervcons\" width=\"672\" height=\"593\" \/><\/a><\/li>\n<li>Create a new virtual switch:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/05-switch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/05-switch.png\" alt=\"05-switch\" width=\"677\" height=\"337\" \/><\/a>There are 2 options of creating a switch:\n<ul>\n<li>If your computer is connected to a network with a DHCP server that can assign address to your VM, select an <strong>external switch<\/strong>. This will virtually place your VM into the same network as if it was just another physical computer.<\/li>\n<li>If you do not have a DHCP server, or do not have enough IP addresses available, select an <strong> internal switch<\/strong>. We will configure network sharing with an internal switch later.<\/li>\n<\/ul>\n<\/li>\n<li>Press &#8220;Create Virtual Switch&#8221; to complete the operation:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/06-createdswitch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/06-createdswitch.png\" alt=\"06-createdswitch\" width=\"722\" height=\"687\" \/><\/a><span class=\"warning\">Warning: Hyper-V may report that your network adapter is already bound to the virtual switch protocol:<\/span><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/07-error.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/07-error.png\" alt=\"07-error\" width=\"352\" height=\"240\" \/><\/a><br \/> If that happens, go to Network Connections in Control Panel and uncheck the corresponding checkbox for your network adapter:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/07a-unswitch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/07a-unswitch.png\" alt=\"07a-unswitch\" width=\"363\" height=\"468\" \/><\/a>Once you uncheck it and apply the changes, you can try creating the switch again.<\/li>\n<li>Only if you have created an internal switch, go to Network Connections in Control Panel, open the properties of your Internet connection and share it with the newly created switch:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/08-share.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/08-share.png\" alt=\"08-share\" width=\"363\" height=\"468\" \/><\/a><\/li>\n<li>Now we can create a VM. Right-click on your computer name in Hyper-V manager and select &#8220;New-&gt;Virtual Machine&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/09-newvm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/09-newvm.png\" alt=\"09-newvm\" width=\"672\" height=\"593\" \/><\/a><\/li>\n<li>Press &#8220;Next&#8221; to skip the introduction page:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/10-intro.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-11\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/10-intro.png\" alt=\"10-intro\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Select the first generation of the VM:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/11-gen1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/11-gen1.png\" alt=\"11-gen1\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Specify the memory amount you would like to allocate to your VM:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/12-memory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/12-memory.png\" alt=\"12-memory\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Select the network switch created before:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/13-vswitch.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/13-vswitch.png\" alt=\"13-vswitch\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Select &#8220;Create a virtual hard disk&#8221; and specify the size you want to use:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/14-vhd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/14-vhd.png\" alt=\"14-vhd\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Specify the path to the Ubuntu installation disk image. You can download one <a href=\"http:\/\/www.ubuntu.com\/download\/desktop\">here<\/a>.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/15-iso.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-16\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/15-iso.png\" alt=\"15-iso\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Verify the VM settings on the last page and click &#8220;Finish&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/16-summary.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-17\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/16-summary.png\" alt=\"16-summary\" width=\"704\" height=\"533\" \/><\/a><\/li>\n<li>Right-click on the newly created VM and select &#8220;Connect&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/17-conn.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/17-conn.png\" alt=\"17-conn\" width=\"673\" height=\"593\" \/><\/a><\/li>\n<li>Click &#8220;start&#8221; to start the virtual machine:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/18-start.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-19\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/18-start.png\" alt=\"18-start\" width=\"642\" height=\"507\" \/><\/a><\/li>\n<li>Once the Ubuntu installer loads, select &#8220;Install Ubuntu&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/19-ubuntu.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/19-ubuntu.png\" alt=\"19-ubuntu\" width=\"700\" height=\"589\" \/><\/a><\/li>\n<li>Verify that you have internet connection. If not, recheck the virtual switch settings:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/20-inet.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/20-inet.png\" alt=\"20-inet\" width=\"700\" height=\"525\" \/><\/a><\/li>\n<li>Select &#8220;erase disk and install&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/21-install.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-22\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/21-install.png\" alt=\"21-install\" width=\"700\" height=\"525\" \/><\/a><\/li>\n<li>Specify the user name, computer name and a password you would like to use:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/22-username.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-23\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/22-username.png\" alt=\"22-username\" width=\"700\" height=\"399\" \/><\/a><\/li>\n<li>Once the Ubuntu installation is done, open a terminal window on it and run &#8220;ifconfig&#8221;. This will display the current IP address of the virtual machine:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/23-ipaddr.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-24\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/23-ipaddr.png\" alt=\"23-ipaddr\" width=\"700\" height=\"525\" \/><\/a>Unless you have a DCHP server configured to publish updates to the DNS server, you will need to use the&nbsp; IP address to<br \/>\n\t\t\t\t\taccess the machine. Verify that you can access it by pinging<br \/>\n\t\t\t\t\tit from Windows.<\/li>\n<li>Install the OpenSSH package on the VMto enable access via SSH:\n<pre>sudo apt-get install openssh-server<\/pre>\n<p><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/24-openssh.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/24-openssh.png\" alt=\"24-openssh\" width=\"700\" height=\"525\" \/><\/a><\/li>\n<li>Now we will create a VisualGDB project for your Linux app. Select File-&gt;New project and choose the VisualGDB Linux Project Wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/25-newprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-26\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/25-newprj.png\" alt=\"25-newprj\" width=\"700\" height=\"486\" \/><\/a><\/li>\n<li>Proceed with the default &#8220;Application&#8221; setting:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/26-app.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-27\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/26-app.png\" alt=\"26-app\" width=\"682\" height=\"622\" \/><\/a><\/li>\n<li>On the next page select &#8220;New SSH connection&#8221; in the Remote Computer field and enter the IP address, user name and password you specified when installing Ubuntu:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/27-newconn.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-28\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/27-newconn.png\" alt=\"27-newconn\" width=\"539\" height=\"409\" \/><\/a><\/li>\n<li>Confirm the host key:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/28-key.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-29\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/28-key.png\" alt=\"28-key\" width=\"496\" height=\"184\" \/><\/a><\/li>\n<li>VisualGDB will remember the connection settings, so next time you create a project, it will be displayed in the connection list:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/29-machine.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-30\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/29-machine.png\" alt=\"29-machine\" width=\"682\" height=\"622\" \/><\/a><\/li>\n<li>Proceed with the default file transfer settings:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/30-filetransfer.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-31\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/30-filetransfer.png\" alt=\"30-filetransfer\" width=\"682\" height=\"622\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; complete creating the project:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/31-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-32\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/31-build.png\" alt=\"31-build\" width=\"695\" height=\"792\" \/><\/a><\/li>\n<li>Set a breakpoint somewhere in the code and press F5 to build your project and start debugging it:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/32-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/32-debug.png\" alt=\"32-debug\" width=\"695\" height=\"792\" \/><\/a><\/li>\n<li>You can edit various VisualGDB-related settings by right-clicking on your project in Solution Explorer and selecting &#8220;VisualGDB Project Properties&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/33-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-34\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/linux\/ubuntu\/hyper-v\/33-settings.png\" alt=\"33-settings\" width=\"700\" height=\"609\" \/><\/a>If you are using VisualGDB 5.0, it will automatically enable the new Clang-based IntelliSense engine, so you will be able to refactor your code and explore it via Code Map.<\/li>\n<\/ol>\n<p><\/root><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to configure a Hyper-V virtual machine to run Ubuntu 15 and use Visual Studio with VisualGDB<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[83,33,81],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/159"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":0,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}