Migrating Linux to Microsoft Azure - Rithin Skaria - E-Book

Migrating Linux to Microsoft Azure E-Book

Rithin Skaria

0,0
29,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

With cloud adoption at the core of digital transformation for organizations, there has been a significant demand for deploying and hosting enterprise business workloads in the cloud. Migrating Linux to Microsoft Azure offers a wealth of actionable insights into deploying Linux workload to Azure.
You'll begin by learning about the history of IT, operating systems, Unix, Linux, and Windows before moving on to look at the cloud and what things were like before virtualization. This will help anyone new to Linux become familiar with the terms used throughout the book. You'll then explore popular Linux distributions, including RHEL 7, RHEL 8, SLES, Ubuntu Pro, CentOS 7, and more.
As you progress, you'll cover the technical details of Linux workloads such as LAMP, Java, and SAP, and understand how to assess your current environment and prepare for your migration to Azure through cloud governance and operations planning. Finally, you'll go through the execution of a real-world migration project and learn how to analyze and debug some common problems that Linux on Azure users may encounter.
By the end of this Linux book, you'll be proficient at performing an effective migration of Linux workloads to Azure for your organization.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 223

Veröffentlichungsjahr: 2021

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Migrating Linux to Microsoft Azure

A hands-on guide to efficiently relocating your Linux workload to Azure

Rithin Skaria

Toni Willberg

Migrating Linux to Microsoft Azure

Copyright © 2021 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Authors: Rithin Skaria, Toni Willberg

Technical Reviewers: Marin Nedea, Micha Wets

Managing Editors: Neha Pande, Mamta Yadav

Acquisitions Editors: Saby Dsilva, Ben Renow-Clarke

Production Editor: Deepak Chavan

Editorial Board: Vishal Bodwani, Edward Doxey, Ben Renow-Clarke, Arijit Sarkar, and Dominic Shakeshaft

First Published: July 2021

Production Reference: 1150721

ISBN: 978-1-80107-172-7

Published by Packt Publishing Ltd.Livery Place, 35 Livery Street, Birmingham, B3 2PB, UK.

www.packt.com

Table of Contents

Preface   i

1. Linux: History and future in the cloud   1

A brief history of Linux   3

Unix   3

Linux   3

Linux version history   4

Linux evolution and distributions   5

Typical Linux use cases in IT infrastructure   6

Workstations   6

Application servers   7

Database servers   8

Virtualization   8

Containers   9

Cloud computing   11

Container orchestration   12

Big data   13

Challenges in on-premises infrastructure   14

Cloud economics   15

Scale comes with benefits   16

Many services available   16

Benefits of migrating to Azure   17

The journey from Linux to Azure   18

Clustering   19

Subscription portability   23

Summary   24

2. Understanding Linux distributions   27

Linux licensing and open-source business models   28

Open-source licenses   28

Enterprise agreements   29

Linux subscriptions   29

Popular Linux distributions   30

Linux on Azure   32

Benefits of Linux on Azure   33

Linux support scope   35

Licensing on Azure   36

Available distros   46

Summary   55

3. Assessment and migration planning   57

Popular workloads on Linux   58

LAMP   59

Database servers   60

HPC, clustering, and SAP   61

Shared storage   61

Pre-project preparations   63

Identifying relevant roles and responsibilities   63

Cloud governance and operations   66

Migration assessment   67

Preparing a cloud migration plan   67

Discovery and evaluation   68

Involving key stakeholders   69

Estimating the savings   69

Identifying tools   70

Assessing tooling   70

Azure Migrate   71

Service Map   71

Azure TCO calculator   73

Hands-on assess lab   75

Prerequisites   76

Setting up the Azure Migrate project   76

Setting up and registering the Azure Migrate appliance   80

Verifying discovered VMs in the portal   85

Running an assessment   86

Reviewing the assessment   89

Dependency analysis   90

Summary   95

4. Performing migration to Azure   97

Hands-on migration lab   99

Migrating servers to Azure   99

Migrating databases   117

Summary   133

5. Operating Linux on Azure   135

Optimize   136

Azure Cost Management   136

Azure Advisor   138

Manage and Secure   139

Linux Agent for Azure   139

Extensions   141

Data protection   143

Azure Disk Encryption   144

Updating Linux on Azure   145

Azure Update Management   147

Hands-on managing Linux on Azure   148

Creating a Log Analytics workspace   150

Onboarding an Azure virtual machine   152

Data collection   154

Querying data   156

Summary   159

6. Troubleshooting and problem solving   161

Remote connectivity and VM start issues   162

Run commands without a network connection   164

Boot diagnostics and serial console access   166

Common boot problems   167

Common Linux runtime challenges   169

SELinux   169

Storage configuration issues   171

Disk encryption problems   173

Resizing disks   173

Performance issues and analysis   176

Azure diagnostics tooling – a summary   179

Opening support requests   180

Summary   183

New horizons for Linux in Azure   184

Index   187

Preface

About

This section briefly introduces the authors and reviewers, the coverage of this book, the technical skills you'll need to get started, and the hardware and software needed to complete all of the topics.

About Migrating Linux to Microsoft Azure

With cloud adoption at the core of digital transformation for organizations, there has been a lot of demand to deploy and host enterprise business workloads in the cloud. Migrating Linux to Microsoft Azure offers a series of actionable insights into deploying Linux workloads to Azure.

You will begin by learning about the history of IT, operating systems, Unix, Linux, and Windows, before moving on to look at the cloud and what things were like before virtualization. This will enable those not very familiar with Linux to learn the terms required to grasp the upcoming chapters. Furthermore, you will explore popular Linux distributions including RHEL 7, RHEL 8, SLES, Ubuntu Pro, CentOS 7, and more.

As you progress, you will dive into the technical details of Linux workloads such as LAMP, Java, and SAP. You will learn how to assess your current environment and plan migrating to Azure through cloud governance and operations planning.

Finally, you will go through the execution of a real migration project and learn how to analyze, debug, and recover from some common problems that Linux on Azure users have encountered.

By the end of Linux book, you will be proficient in performing the effective migration of Linux workloads to Azure for your organization.

About the authors

Rithin Skaria is an open-source evangelist with over 9 years of experience in managing open-source workloads on Azure, AWS, and OpenStack. He is currently working for Microsoft as a Customer Engineer and is part of several open-source community activities conducted within Microsoft. He has played a vital role in several open-source deployments and the administration and migration of these workloads to the cloud. He also co-authored Linux Administration on Azure, Second Edition and Azure For Architects, Third Edition both published by Packt. Connect with him on LinkedIn at @rithin-skaria.

Toni Willberg is a Linux on Azure subject matter expert with 25 years of professional IT experience. He has worked with Microsoft and Red Hat as a solution architect, helping clients and partners in their open-source and cloud journeys. He has been involved in the technical reviews of various books published by Packt.

Currently, Toni holds the position of Head of Cloud Business Unit at Iglu, a managed service provider company offering professional public cloud projects and services. Connect with him on Twitter at @ToniWillberg.

About the reviewers

Marin Nedea is an experienced Linux Escalation Engineer, a mentor, and a certified Azure Linux Trainer, ITIL, and KT practitioner, with a history of more than 15 years in the IT services industry. He has strong theoretical and practical knowledge regarding replication, clustering, and high availability, as well as expertise in on-premises datacenters, virtualization, IBM Cloud, and Azure cloud technologies. Although he is an IT professional, his studies are in Psychology of Educational Sciences at Spiru Haret University in Bucharest, Romania. You can follow on LinkedIn at @Marin Nedea.

Micha Wets is a Microsoft MVP who enjoys talking about Azure, Powershell, and automation and has previously spoken at Microsoft conferences, international events, Microsoft webinars, workshops, and much more. He has over 15 years of experience as a DevOps engineer and has in-depth knowledge concerning hybrid and public clouds.

Today, Micha mainly focuses on Azure, Powershell, automation, Azure DevOps, GitHub Actions, and Windows Virtual Desktop environments, and he is particularly knowledgeable when it comes to migrating those environments to Azure. Micha is the founder of Cloud.Architect and you can follow him on Twitter at @michawets.

Learning objectives

Explore the terminology and technology of various Linux distributionsUnderstand the technical support co-operation between Microsoft and commercial Linux vendorsAssess current workloads by using Azure Migrate Plan cloud governance and operations Execute a real-world migration project Manage projects, staffing, and customer engagement

Audience

This book is intended to benefit cloud architects, cloud solution providers, and any stakeholders dealing with the migration of Linux workloads to Azure. Basic familiarity with Microsoft Azure would be a plus.

Approach

Migrating Linux to Microsoft Azure uses an ideal blend of theoretical explanations and hands-on examples to help you prepare for real-world migration challenges faced by businesses today.

Hardware and software requirements

Hardware requirements

For the optimal lab experience, we recommend the following hardware configuration:

Windows Server 2016 with a Hyper-V role installed and at least 8 GB RAM and 8 cores for the Assess and Migration Lab

Software requirements

We also recommend that you have the following software configuration in advance:

Azure subscriptionAzure CLI

Conventions

Code words in the text, database names, folder names, filenames, and file extensions are shown as follows.

"You can either download it in Linux using the wget command or download it to your computer and transfer it to a Linux machine using SFTP/SCP."

Here's a sample block of code:

wget --content-disposition https://aka.ms/dependencyagentlinux -O InstallDependencyAgent-Linux64.bin

sh InstallDependencyAgent-Linux64.bin

As Azure is evolving at a very rapid pace, it is possible that some of the views or features you see in the Azure Portal are different from the screenshots seen in this book. We have tried to make sure that the screenshots and all the technical facts in this book are correct at the time of writing. We have provided links to the official documentation throughout this book. If you're unsure, check the documentation for the latest usage guidance.

Downloading resources

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

1. Linux: History and future in the cloud

"Microsoft ♡ Linux" was written on the closing slide of a presentation given by Microsoft CEO Satya Nadella in 2015. This announced a wave of changes that were going to happen, and Satya Nadella wanted to address Microsoft's interest in Linux and Open-Source Software (OSS) technologies. Everyone felt that there was some contradiction here, wondering why Microsoft was working with OSS technologies. Wired magazine reported that Nadella is not interested in fighting old battles—especially, when, like it or not, Linux has become a vital part of today's business technology. "If you don't jump on the new," Nadella told Wired, "you don't survive."

At the time of writing, more than 50% of Microsoft Azure is ruled by Linux. There are a lot of misconceptions around migrating existing Linux workloads to Microsoft Azure and this book will help in understanding the complexities, simplifying the migration process.

We will start off with a brief history of Linux and the events that led to its development. Along with that, we will talk about some of the competitors of Linux and the use cases for both Linux and these competitors. We will cover some of the key roles that Linux servers play in IT infrastructure, touching on why the cloud is better for running these workloads compared to on-premises solutions. As most organizations are going with a cloud transformation strategy, the demand for virtual machines, containers, container orchestration solutions, big data, and so on is increasing, and Microsoft Azure provides a platform to run all these mission-critical workloads.

In order to understand the complexity of migrating Linux workloads to Azure, you need to understand the history of IT, operating systems, Unix, Linux, and Windows, before the cloud and virtualization. This chapter will provide some important background information about Linux to enable those who are not very familiar with it to learn the terminology.

The public cloud has many benefits over self-hosted environments. We will talk about them, particularly covering how Azure is designed to support Linux workloads.

While we will briefly mention some typically difficult aspects of Linux systems, you will also learn that Azure is evolving rapidly. Azure now has out-of-the-box features that will make Linux sysadmins' lives much easier.

This chapter covers the following key topics:

Brief history and evolution of LinuxUse cases of Linux in IT infrastructureChallenges in on-premises infrastructureCloud economicsAdvantages of migrating to AzureSimplifying the complexity associated with migration

Let's get started with a brief history of Linux.

A brief history of Linux

Before we talk about the history of Linux, it's a good idea to start with the events that led to its development. You might have seen pictures of old computers that were as big as a car or a house. It's hard to imagine how cumbersome it would be to handle a system this big now that we live in a world of handheld devices and thin clients. It's not just the massive size; the different operating systems that used to run on these devices made things more complicated. Every piece of software was designed to serve a single purpose and was impossible to run on another computer. In short, we had a compatibility issue. On top of these problems, the cost of buying these computers was huge. Purchasing a computer was not a dream that came true for normal people.

Unix

The aforementioned shortcomings led to the development of a project called Unix, which was started in the mid-1970s by a group of developers at Bell Laboratories. The main intention of this project was to make a common software for all computers, rather than having individual pieces of software for each computer. The project used the C language instead of assembly language; it was indeed refined and uncomplicated.

The Unix operating system was widely adopted by government organizations, universities, and schools. It existed for many systems, ranging from personal computers all the way to supercomputers. Though the advent of Unix resolved some issues, it hadn't dealt with the pricing problem; these systems were still expensive.

During the early 1980s, organizations began developing their own versions of Unix. As a result of the multiple development branches, we ended up with lots of different versions, or dialects. Every developer and organization wanted to create a free Unix-like operating system and, in 1983 at MIT, Richard Stallman developed the GNU project. The goal of this project was to create a free operating system (in the sense of licensing, and not necessarily cost). This project didn't gain much popularity, as expected; nevertheless, GNU tools were adopted by Linux when it came into existence.

Linux

In 1991, Linus Torvalds developed Linux as a freely distributable Unix while he was a student at the University of Helsinki, Finland. Linus was motivated by Andrew Tanenbaum's Minix operating system, which was another free Unix for PCs. Linus wanted to author a freely available academic version of Unix that could run on Intel 386-based PCs for Minix users who wanted to get more out of their computers. The project was initially named "Freax," a fun project that ended up as one of the biggest revolutions in the history of computers with the name "Linux." On a public forum (comp.os.minix) during the initial days of Linux, Linus referred to his work as "a better Minix than Minix." Quoting his own words:

"After that it was plain sailing: hairy coding still, but I had some devices, and debugging was easier. I started using C at this stage, and it certainly speeds up development. This is also when I start to get serious about my megalomaniac ideas to make "a better Minix than Minix." I was hoping I'd be able to recompile gcc under Linux some day...

"Two months for basic setup, but then only slightly longer until I had a disk driver (seriously buggy, but it happened to work on my machine) and a small filesystem. That was about when I made 0.01 available [around late August of 1991]: it wasn't pretty, it had no floppy drive, and it couldn't do much of anything. I don't think anybody ever compiled that version. But by then I was hooked, and didn't want to stop until I could chuck out Minix."

If only he had guessed how widely adopted Linux would be 30 years on.

Linux version history

For the first version of Linux (v0.01), there were no executables. To play with this version, you needed a Minix machine to compile, as the intention was to make the Minix system better. In 1991, v0.02 was launched and is now referred to as the first official version of Linux. The current Linux systems that we see have immense provisions for a variety of things, such as user support, documentation, and software repositories. However, this was not the case during the early stages of Linux. In v0.02, Bash (GNU Bourne Again Shell) and gcc (GNU compiler) were the only things that were running, and the main focus was kernel development.

After v0.02 came v0.03, and so on; revisions were made until Linux reached v0.95 in 1992, with the goal of a bug-free v1.0. After two years with a couple of revisions in between, v1.0 came out in March 1994. After 25+ years of v1.0, we are currently in v5.x and, at the time of writing, the last version released is v5.9. We are expecting v5.10 soon.

As mentioned earlier, Linux adopted GNU tools, and these tools played an inevitable role in the making of Linux. Without these, Linux might not have made the impact that we see today. Along with GNU, Berkeley Software Distribution (BSD) played a role in making Linux popular. Though BSD was not initially adopted in the early stages of Linux, later versions had tools that were ported from BSD. The networking daemon and several other utilities are perfect examples of BSD's contributions to Linux that have made it the subject of admiration.

Linux evolution and distributions

Linux evolved over these years and the fun project started by Linus Torvalds is now used by millions of computers, smartphones, servers, and even supercomputers across the globe. Today, Linux is capable of running web, mail, emacs, the X Windows System…the list goes on. Linux not only dominates on-premises but has a major share of the workload in Azure too. Currently, we have a lot of Linux flavors tailored for enterprise use as well as personal use.

As already stated, Linux isn't something that is developed by a single organization. It is a combination of different parts or modules, such as the kernel, GNU shell utilities, the X server, the desktop environments, system services, daemons, and Terminal commands—all of these come from different developers and they are developed independently. If you want, you can take source code for the kernel, shell, and other components and assemble it. There are projects such as Linux from Scratch (LFS) and Beyond Linux from Scratch (BLFS) where users can download these pieces of software that are licensed under open-source software, compile them, and make their own Linux flavor.

Although exciting, the amount of work needed for this is heavy and you have to invest a lot of time for these components to work together properly. Linux distributions (often referred to as distros) make this hectic task easier. Distros will take all the code from the repositories and compile them, finally creating a single operating system that you can boot up on your computer. Examples of distros include Ubuntu, Fedora, CentOS, RHEL, Mint, and SUSE Linux. Some distros, such as RHEL, SUSE, and Ubuntu, have an enterprise server–grade version as well, which is used by organizations to host their mission-critical workloads.

Linux for Enterprise is a new realm altogether. It began with Red Hat, which used to have a monopoly. However, more competitors soon appeared, including Canonical and SUSE, as well as the non-commercial CentOS. Azure supports all of the preceding enterprise-grade Linux operating systems, so each and every organization can migrate their Linux workloads to Azure.

Before we talk about the benefits of moving workloads to Azure, let's understand the common use case scenarios for these Linux servers in IT infrastructure, along with some of the challenges associated with on-premises approaches.

Typical Linux use cases in IT infrastructure

As mentioned in the previous section, A brief history of Linux, the customer base for the Linux operating system is very large for on-premises environments as well as the cloud. In this section, we will talk about some use cases of Linux in IT infrastructure. Some things have been relevant since the beginning of Linux adoption (files, the web, databases, and so on), while others have been adopted recently with the introduction of new technologies (containerization and container orchestration, for example). These use cases will be added to and evolve over time.

Workstations

There is a large subset of consumers who prefer to use Linux as a daily commuter on their personal computers. This area was mainly monopolized by Windows and macOS, but things changed a lot when Linux came to the stage. Traditionally, Linux was an all-time favorite for coders and programmers, providing more customization options for the general consumer than Windows or macOS. For this reason, Linux became the preferred option for millions of people across the globe:

Figure 1.1: Different workstation distros and GUIs

Currently, we have flavors such as Ubuntu, Fedora Workstation, Linux Mint, Elementary OS, CentOS, and Arch Linux. Figure 1.1 shows how the Graphical User Interface (GUI) appears in different workstation distros.

Application servers

An application server is computer software that is bundled together to facilitate business logic. If we take a three-tier application, the application server is the component that comprises the GUI, the business logic, and the database server. The majority of application servers support the Java platform, some examples being JBoss, Jetty, JOnAS, Apache Geronimo, and Glassfish:

Figure 1.2: Coupling of application servers with other services to provide end-to-end solutions

In Figure 1.2, you can see how the application servers are coupled with other services, including the front-end and back-end services. An application server handles connections between the user requests that originate from the front-end and back-end services, such as databases and other logic.

Database servers

Linux has been the home of databases for a very long time now. We can install relational and non-relational databases on Linux as per our data requirements. The term database server refers to the combination of a database application and memory allocated for data storage. These databases can be used to record transactions in a similar way to how SQL Server works on Microsoft Windows:

Figure 1.3: Two-tier application model with databases behind a load balancer

Some commonly used database services include MariaDB, PostgreSQL, MySQL, and MongoDB. In most scenarios, the databases hosted in Linux servers are kept behind a load balancing solution to provide high availability. Figure 1.3 is an example of this.

Virtualization

The purpose of virtualization is to create virtual machines using specialized software called hypervisors. Most of you might be familiar with the term virtual machines (VMs), as this is quite common in on-premises environments as well as in the cloud. The purpose of making Linux a virtualization host is the same as installing a Windows Server instance with the Hyper-V role. VMs are often created for the isolation of workloads and for testing purposes. Popular Linux virtualization solutions include KVM, RHEV, Xen, QEMU, VirtualBox, and VMware:

Figure 1.4: Virtualization levels

As shown in Figure 1.4, the hypervisor is installed on the hardware and different VMs are created using hypervisors. Each of these VMs is isolated from the operating system and can host different applications.

Containers

We just discussed VMs and their creation using hypervisors installed on our Linux servers. The footprint of these servers will be large and will often contain some stock libraries and binaries that we do not require. This leads to a waste of compute resources; with all VMs being deployed, your host capacity will soon be exhausted. With the introduction of containers, things have changed, and we don't need to deploy the entire VM to host a dedicated service.

A container is just a software package that contains the code, binaries, and libraries required for a specific task. For example, to run a web server, we could deploy a VM and install NGINX on it. The resource consumption for the VM would be high and encompass a lot of services that we do not need. We could instead use containers, so the image would only have code to run the NGINX server, and nothing else. This would mean a lightweight image and quick deployment.

In the case of VMs, we were using hypervisors to run them; in the case of containers, we use container runtime engines. A comparison of the two is shown in Figure 1.5. Some common examples include Docker (which is the most used), Runc, Rkt (which is no longer in development), and Mesos:

Figure 1.5: Containers versus VMs

Currently, we have container images available for each and every service, including NGINX, MySQL, and Apache. All major software packages have been ported.

Cloud computing

Linux can be used to host cloud operating system solutions such as OpenStack. We can install OpenStack on our Linux server to host a cloud environment (both private and public) to manage large pools of underlying resources including compute, storage, and network. Think of this as the Azure Stack, where you can run Azure in your own datacenter. In a similar way, you can host a cloud environment in your datacenter for your users to deploy services using OpenStack, which is running on Linux:

Figure 1.6: OpenStack running on top of Linux

OpenStack exposes a lot of APIs using which users can track, manage, and monitor their deployment. Figure 1.6 displays the basic architecture of how OpenStack runs on top of Linux to serve as a platform for deployments.

Container orchestration

With the introduction of containers, many organizations are moving from a monolithic architecture to a microservice architecture. As the number of containers increases, it's not easy to manage them on a large scale. That is where container orchestration tools such as Kubernetes come into the picture. We can install the Kubernetes service on a Linux machine and add Linux and Windows worker nodes to it. The master will be running on a Linux server and this will act as a management plane for the cluster. Figure 1.7 shows a high-level representation of how Linux nodes are added to the Kubernetes master. In a similar fashion, we can also create a pool of Windows nodes and add it to the Kubernetes cluster:

Figure 1.7: Linux worker nodes in a Kubernetes cluster

Another distribution of Kubernetes is OpenShift, developed by Red Hat. There are many Kubernetes distributions published by different vendors, all meant for container orchestration. In fact, there are dedicated Linux distributions that have been developed with Kubernetes in mind, such as k3OS from Rancher. Container orchestration is a booming and ever-growing sector, and we could even write a whole book on this topic alone.

Big data

We started with simple examples and have expanded our horizons all the way to complex scenarios, such as big data on Linux. You can install tools such as Apache Hadoop on Linux and then perform big data analysis. We don't really see this scenario in every organization due to varying availability and support for managed cloud services such as Azure Synapse Analytics or Azure HDInsight. Nevertheless, if you would like to implement big data analytics on Linux, it's possible. Figure 1.8