Tag: Linux

Last updated by at .

AzCopy Azure and Azure Stack

Sync Azure Blob Storage with Azure Stack Blob Storage

There are some scenarios where you want to sync Blob Storage on Azure with Blob Storage on Azure Stack. This easily be done using the AzCopy tool. AzCopy is a command-line utility designed to copy data to and from Microsoft Azure blob and table storage using simple commands with optimal performance. You can copy data from one object to another within your storage account, or between storage accounts in Azure as well as in Azure Stack.

You can get AzCopy on Windows and AzCopy on Linux. You should get at least AzCopy version 7.1.0. In my example I use the version 8.0.0 preview version, which also works fine. Make also sure that you have deployed a supported version of Azure Stack. Check out my blog about updating Azure Stack to get more information.

After the installation you will find the AzCopy.exe in the “C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy”

How to Sync and copy files from Azure to Azure Stack

You can use AzCopy with Azure Stack as you would do in Microsoft Azure. To copy and Sync files you can use the following command. Be aware that synchronous data transfer between Azure storage and Azure Stack is not supported. There for you will need to specify the the /SyncCopy or –sync-copy parameter.

Of course this works in both directions and also between two different Azure Stack storage accounts.

You can find more about AzCopy on Azure Stack on the documentation page. If you have any questions feel free to comment on the blog post. There are other great storage tools which work great with the Microsoft Hybrid Cloud environment like Visual Studio or Azure Storage Explorer. These scenarios show perfectly how Microsoft built their hybrid cloud environment. Basically you can use the same tools, processes and knowhow in the Public Cloud as well as in your datacenter.



Create Ubuntu Hyper-V Generation 2 Virtual Machine

How to Install Ubuntu in a Hyper-V Generation 2 Virtual Machine

If you want to install Ubuntu or any other Linux inside a Hyper-V Generation 2 Virtual Machine you need to do a simple change to the VM so you can install it from ISO.  If you just create a Hyper-V Generation 2 Virtual Machine and try to start the Virtual Machine, the Virtual Machine will not boot from ISO. This is because of the Secure Boot feature which is included in Hyper-V Generation 2 Virtual Machines, and applies to all Linux operating systems running on Hyper-V.

How to Install Linux in a Hyper-V Generation 2 VM

Create a new Virtual Machine in the Hyper-V Manager

Create Ubuntu Hyper-V Generation 2 Virtual Machine

On the Hyper-V Virtual Machine Generation selection screen, choose Generation 2

Create Ubuntu Hyper-V Generation 2 VM

Attach the Ubuntu ISO Image to the virtual machine

Attach Ubuntu ISO to Hyper-V VM

After you have created the Virtual Machine using the wizard, go into the settings of the virtual machine. Switch to the Security section and choose the Microsoft UEFI Certificate Authority Secure Boot Template.

Now the Virtual Machine will boot from the Ubuntu ISO and you can install Ubuntu.



OpenSSH Server on Windows Server

Install OpenSSH Server on Windows Server

Back in 2017 Microsoft made OpenSSH available on Windows 10. Shorty after OpenSSH was also available for Windows Server, version 1709. This blog post should give you a simple step by step guy how you install OpenSSH Server on Windows Server. OpenSSH is available for Windows Server, version 1709 and higher. If you are running Windows Server 2016, and you want to stay in the long-term servicing branch, you will need to wait for the next Windows Server LTSC build.

Install OpenSSH Server on Windows Server

If you are running a Windows Server 1709 or higher, you can simply use PowerShell to install the OpenSSH Client and Server.

OpenSSH on Windows Server

You can use the following PowerShell commands to install the OpenSSH Server on Windows Server.

After the installation you can find the OpenSSH Server files and some more configuration options under “C:\Windows\System32\OpenSSH”

Next you need to configure the OpenSSH Server (sshd)

To enable authentication into an SSH server on Windows, you first have to generate host keys and repair the ACL on the host keys.

Configure OpenSSH Server on Windows

To configure the OpenSSH Server on Windows Server, just run the following PowerShell commands:

Now you should be able to access your Windows Server using an SSH client.

OpenSSH Server on Windows Server

Remember if you run your server in Microsoft Azure, you might also need to configure the Network Security Group to allow SSH Remoting on port 22.



Ubuntu on Windows Server using WSL

Install Windows Subsystem for Linux on Windows Server

In 2017 Microsoft made it possible to run different Linux distribution on Windows 10, using a feature called the “Windows Subsystem for Linux“. With the latest official Semi-Annual Channel Windows Server release called Windows Server, version 1709 Microsoft also allowed to run the Windows Subsystem for Linux (WSL) on Windows Server. With the next release of Windows Server called Windows Server, version 1803, Microsoft will also add some improvements to the Windows Subsystem on Linux, which also apply to Windows 10 as well as Windows Server. This blog post shows you how you can do this.

First you have a Windows Server, version 1709 running. After that enable the Microsoft Windows Subsystem for Linux feature, running the following command (This will need a reboot)

You can download the appx packages for you favorite Linux distribution, this can be today:

  • Ubuntu
  • OpenSUSE
  • Suse Linux Enterprise Server

If you are running on Windows Server Core (which is highly likely), you can use the following command to download the Linux distributions.

You can then unpack the file:

Now you can open that folder and run the installer for example ubuntu.exe. The first time this will do the setup where you also define the UNIX username and password as well as the root password.

WSL on Windows Server

After that you can run updates for your distro and you can start using Linux.

If you want to know more about the WSL, check out the Microsoft Documentation: Windows Subsystem for Linux Documentation and have a look at my WSL post in for Windows 10: Crazy times – You can now run Linux on Windows 10 from the Windows Store

You can also find the other Linux distro packages here: WSL distro packages.



Hyper-V HVC SSH Direct for Linux VMs

HVC – SSH Direct for Linux VMs on Hyper-V

If you are running Hyper-V on Windows 10 or on Windows Server 2016, you probably know about a feature called PowerShell Direct. I also mentioned that PowerShell Direct is one of the 10 hidden features in Hyper-V you should know about. PowerShell Direct lets you remote connect to a Windows Virtual Machine running on a Hyper-V host, without any network connection inside the VM. PowerShell Direct uses the Hyper-V VMBus to connect inside the Virtual Machine. Of course this feature is really handy if you need it for automation and configuration for Virtual Machines. As this is great for Windows virtual machines, it does not work with Virtual Machines running Linux. In the latest Windows 10, Windows Server 1803 (RS4) and Windows Server 2019 (RS5) Insider Preview builds, Microsoft enabled a tool called HVC. HVC is at tool which allows you to do some command line VM management. HVC SSH is basically SSH Direct of Linux VMs.

This allows to connect to a Linux VM using SSH over the Hyper-V VMBus. You are also able to copy file inside a virtual machines using scp.

How to connect to Linux VMs using SSH Direct

HVC SSH on Hyper-V

To connect to Linux VMs using SSH Direct (HVC) simply type hvc.exe into the command line or PowerShell. This will give you all the possible command options. Of course SSH has to big configured inside the Linux virtual machine.

To make this work, the SSH server inside the VM needs to be configured.

Final Thoughts

Pretty cool tool which will be available in the official releases of Windows 10 and Windows Server 1803, released this spring. Later this year this feature will also be included in Windows Server 2019. If you want to try it out today, give the Windows Insider Preview builds a spin.

Thanks to Ben Armstrong for pointing this out 😉



PowerShell Core

PowerShell Core 6.0 for Windows, Linux and macOS General Available (GA)

Microsoft yesterday announced the general availability of PowerShell Core 6.0. PowerShell Core 6.0 is a new edition of PowerShell that is cross-platform (Windows, macOS, and Linux), open-source, and built for heterogeneous environments and the hybrid cloud. PowerShell Core uses .NET Core 2.0 as its runtime. PowerShell Core also exposes the API set offered by .NET Core 2.0 to be used in PowerShell cmdlets and scripts.

First and foremost, thank you to all of our amazing community, especially our open-source contributors (the most recent of which you can find on our community dashboard at https://aka.ms/PSGitHubBI) for donating your time and energy to PowerShell Core. Whether you contributed code, tests, documentation, issues, or even just your feedback and opinions, we are extremely grateful for the sweat and tears that you’ve invested in PowerShell. (For those interested in contributing, hop and over to our Contribution Guide on GitHub. You don’t have to be a guru to help out!)

Quote: PowerShell Team Blog: PowerShell Core 6.0: Generally Available (GA) and Supported!

PowerShell Core Installer

You can get PowerShell Core 6.0 here:

PowerShell Core is open source and you can have a look at the code on PowerShell on GitHub



Tar and Curl on Windows 10

Today Microsoft released Windows 10 Insider Preview Build 17063 which includes a lot of great new features like Timeline, Activities, Microsoft Edge, Windows Subsystem for Linux improvements and much more. But Microsoft also included something for IT Pros and Developers. After the OpenSSH client and the OpenSSH server. Microsoft brings two new command-line tools for the Windows toolchain: curl and bsdtar. These tools are very well known tools in the open source world. Including them in Windows should make Windows even a better development platform.

 

Tar on Windows 10
Tar: A command line tool that allows a user to extract files and create archives. Outside of PowerShell or the installation of third party software, there was no way to extract a file from cmd.exe. We’re correcting this behavior 🙂 The implementation we’re shipping in Windows uses libarchive.

curl on Windows 10

Curl: Another command line tool that allows for transferring of files to and from servers (so you can, say, now download a file from the internet).

Why this, so first of all you have PowerShell which has similar functionality, but PowerShell is not always available (Think about Nano Server container images where you have not the Full .Net Framework available). Secondly Developers which come from other operating systems are already familiar with these tools and they can use, as they would on their “old” operating system.

If you want to know more, check out Craig Wihite’s (Microsoft) blog post: Tar and Curl Come to Windows!

As mentioned this is included in the Windows 10 Insider Preview Build 17063 and should ship to production customers in the next Windows 10 release, which might be Windows 10 (1803).