Windows server on openstack

Работа с OpenStack API с помощью консольных клиентов

Перед началом работы с консольными клиентами OpenStack следует создать пользователя и добавить его в проект в панели управления или с помощью selvpc CLI, а затем установить необходимое программное обеспечение на локальную систему.

Запуск RC-файла

Перед установкой необходимого ПО настройте доступ к проекту из локальной системы и установите переменные среды. Для этого в панели управления:

Перейдите в раздел Доступ в проекте, выберите пользователя и регион облака по умолчанию, скачайте RC-файл.

Примечание: с помощью этого файла можно управлять ресурсами в одном регионе. Для работы с другими регионами вы можете передавать нужное имя ключом —os-region-name или менять содержимое переменной окружения OS_REGION_NAME .

На локальном компьютере перейдите в каталог, в котором лежит файл rc.sh.

Запустите скрипт из этого каталога в том терминале, где будут запускаться утилиты, с помощью команды:

Введите запрашиваемый пароль OpenStack — пароль пользователя проекта.

Установка ПО

Для установки на локальную систему программного обеспечения, необходимого для работы с консольными клиентами OpenStack, используйте следующие команды.

Примечание: для каждого дистрибутива предназначен свой набор утилит.

Debian 9 / 10 или Ubuntu 16 / 18 / 20 (для python3)

CentOS

Fedora

Использование Docker-контейнера с утилитами

Вы можете использовать Docker-контейнер для установки необходимого ПО.

    Установите Docker на своей локальной системе.

Создайте Dockerfile со следующим содержимым:

Для сборки контейнера используйте команду:

Запустите Docker из каталога, в котором лежит файл rc.sh:

После этого в контейнере можно работать с утилитами, представленными выше. Перед этим запустите внутри docker-контейнера скрипт rc.sh из папки /workspace:

SSH-ключ

С помощью SSH-ключа можно подключаться к виртуальным машинам по SSH.

Создание SSH-ключа

Для создания SSH-ключа введите:

Эта команда выведет в файл приватный ключ, с помощью которого можно будет подключаться к виртуальным машинам по SSH. Команда соединения в этом случае будет выглядеть так:

Обратите винмание! Если не указать —private-key , то содержимое будет выведено на экран.

Если у вас уже есть пара «приватный ключ – публичный ключ», можно указать публичный ключ в качестве аргумента:

Добавление SSH-ключа

SSH-ключи можно также добавлять в панели управления в разделе Доступ в проекте.

Openstack Install Windows Server (2016/2019) with image(iso)

Nov 11, 2019 · 4 min read

Story: Install Windows Server 2019 on openstack instance with complied iso from PART I

Preparation

Openstack

  1. upload windows server iso to openstack

2. Create instance

3. Choose the ISO image and Set Create New Volume = No

4. Select flavors & network

5. Power off the instance

6. Create a new Volume

7. edit the volume, make it bootable

8. Attach the volume to instance

9. power on the instance and begin installation

Windows Server Installation

  1. Select Custom: Install Windows only (advanced)

2. Load Network Driver, Choose your CDROM look for Drivers\NetKVM\

3. Then, VirtIO disk driver

4. Th e VirtIO disk is shown

5. Let’s start the Windows installation on Drive 0, continue Windows installation step by step until finish

Repack with Cloudinit

  1. Start PowerShell to open the firewall for RDP:
  • Click on Start > Settings, and search for remote desktop, now choose allow remote desktop access to your computer .
  • In the popup choose for Allow remote connections to this computer , Click OK to close the popup.
  • If you are using an unofficial- or older RDP client, remove the checkbox below.
  • Click on Apply and press OK.

2. To be able to use Cloud-Init (we need this to, for example, be able to set an admin passphrase when deploying) we have to configure this:

  • Click Next
  • To continue, you will have to read and accept the license terms
  • Click Next
  • The default settings will be fine, again click Next
  • Leave everything be except for the Serial port for logging, set that to COM1
Читайте также:  Unity linux что это такое

When the installation is finished, select both run Sysprep and Shutdown when Sysprep terminates .

If you click Finish the Windows installation will be prepared for use as an image and the VM will be closed.

Now you have a Windows image that is switched off, you can create a snapshot image for later use.

How to use the OpenStack CLI tools on Windows

Introduction

This tutorial describes how to use the OpenStack Command Line Interface (CLI) tools on Windows. For example, you will learn how to list your instances and volumes by using the CLI. You will also learn how you can launch a new instance by using the CLI.

Prerequisites

For this tutorial you’ll need the following:

  1. A Fuga Cloud account
  2. A device running Windows

In case you’re running Mac OS X or Linux, please check out the following guides:

We recommend using WinPython, this is a portable Python application which you can register to Windows.

Step 1 — Installing WinPython

Use the latest stable WinPython installer to download and install WinPython.

Open the WinPython Powershell or the WinPython Command Prompt (located in the folder where you just installed WinPython) and verify that the installation has succeeded by using these commands:

Step 2 — Setting environment variables in session

To communicate with your OpenStack API, you’ll need to configure some variables. The default OpenStack RC file is only built for UNIX-based systems, so it will not work on Windows.

This means that we have to set our environment variables manually, keep in mind that we are only setting these settings for the current Powershell/Command Prompt session, and they will be deleted (automatically) after closing the window.

If you’re unsure what to fill in, you can download the OpenStack RC file from the dashboard (through Account → Access). Open the RC file in Notepad and you will find these variables (except password) and their values.

Step 3 — Install OpenStack CLI

Now in the Powershell or Command Prompt:

Check if everything works:

If your list of VM’s are being returned, everything is set up.

Step 4 — Using the OpenStack CLI

You have now installed and configured the OpenStack CLI client and you can start using the OpenStack CLI. The following are some examples you can try. You can also call openstack help for all available commands. For more in-depth information, check out OpenStack Command Line Interface .

List your instances

List your volumes

List the images

Interactive mode

If you only enter the command openstack, you enter interactive mode. This mode lets you interact faster with the OpenStack CLI.

This might not work on Ubuntu 18.04 depending on your configuration.

While in interactive mode enter help to get all the different commands.

Pro tip

If you only need to find a specific command enter:

This will return all list commands.

Step 5 — Creating a new server with CLI

Start an interactive session with:

If you get an error whilst using the interactive session, just prepend openstack to all commands.

First, create a new key named, for example, test_cli_key or use an existing key.

Creating a key with the CLI can be done with the following command:

This command returns the newly generated private key. Make sure to store this securely.

Now test if the key is created:

Next up is to list the images and flavors we can choose from:

In this example, I chose to create a c2.small instance, named CLI Test, on the IPv4 public network and running Ubuntu 18.04 using the newly generated key.

After a few seconds, the server is created and built.

Alternatives

Alternatively, you could use the latest stable Python installer to download and install regular Python and then set the OpenStack configuration as environmental variables. This is possible but we cannot guarantee that does in fact work.

Conclusion

In this tutorial, you’ve learned how to use the OpenStack Command Line Interface tools on Windows using WinPython. By using these tools you learned how to list your instances and volumes. Besides this, you also learned how to launch a new instance by using the CLI.

More tutorials about using the Command Line Interface can be found here.

OpenStack + Windows Nano Server

Nano Server is a Windows OS created for the cloud age. It has been announced by Microsoft this April and is going to be shipped with Windows Server 2016.

What makes Nano Server special?

  • A very small disk footprint compared to traditional Windows Server deployments (a few hundred MB instead of multiple GB).
  • A very limited attack surface.
  • A very limited number of components, which means fewer updates and fewer reboots
  • Much faster virtual and bare-metal deployment times due to the reduced footprint.
Читайте также:  Storahci sys windows 10 что делать

How is this possible?

In short, the OS has been stripped from everything that is not needed in a cloud environment, in particular the GUI stack, the x86 subsystem (WOW64), MSI installer support and unnecessary API.

What about OpenStack support?

Nano Server and OpenStack are a perfect match in multiple scenarios, including:

  • Compute instances (virtual and bare-metal)
  • Heat orchestration
  • Hyper-V Nova compute nodes with native and OVS networking support
  • Cinder storage server, including Scale-out File Server clusters
  • Windows Containers host (Nova-Docker and soon Magnum)
  • Manila SMB3 file servers

Nano Server compute instances on OpenStack

Nano can be deployed on OpenStack like any other Windows or Linux guest OS. Currently it supports Hyper-V compute nodes, with KVM and other hypervisors as soon as drivers become available. Bare metal deployments using Ironic or MaaS are also supported.

Like in any other Linux or Windows instance case, a guest boot agent is required to take advantage of the OpenStack infrastructure.

I’m glad to announce that Cloudbase-Init is now fully supported on Nano Server!

How to create a Nano Server image for OpenStack?

Creating a Nano OpenStack image is easy and as usual we open sourced the scripts required to do that.

Disclaimer: please consider that Nano Server is still in technical preview, so things can change before the final release.

At the time of this writing the latest public available Nano Server install image can be obtained as part of the Windows Server 2016 TP3 ISO, available for download here.

The following steps need to be executed using PowerShell on Windows, we tested them on Windows 10, Windows Server 2016 TP3 and Hyper-V Server 2012 R2.

Let’s start by cloning our git scripts repository, checking out the nano-server-support branch:

How to deploy Windows on OpenStack

Fuga Cloud’s Yuri Sijtema offers this tutorial.

In this tutorial, I’ll show you how to run Windows Server 2016 on OpenStack.

Preparation

Download a Windows 2016 Server ISO image at Microsoft (requires registration.)
Download the Fedora VirtIO drivers. You can find more options here.
In this example we will use VirtalBox, although you can also use KVM on Linux for this.

Create a VM inside VirtualBox

  • Choose a name, as a type, choose Microsoft Windows , and as a version choose Other Windows (64 bit) .
  • Assign the VM a minimum of 2GB memory.
  • Create a virtual disc with a minimum disc-space of 15GB , the standard 20GB is fine, as a type, choose QCOW .

When the VM is created, do not start it yet. We first have to fine-tune certain things in the settings screen:

  • System > processor: Add a second CPU, this saves us time
  • Ports: Enable the first serial port (COM1), this is for logging and debugging purposes
  • Storage: Change the first CD-ROM to primary slave
  • Storage: Connect the first CD-ROM to the Windows ISO you’ve downloaded
  • Storage: Add a second CD-ROM (secondary master) to the existing IDE controller and connect the virtio driver disc to this CD-ROM
  • Audio: Disable audio (unless you like to use it)
  • Network: Change the network to bridge mode, this way you can access it with RDP
  • Network: Change the network type to virtio-net

Now you have a VM you can boot.

The two ISOs now have the correct start-up sequence, after booting, your VM will start to install from the ISO.

Installing Windows

After booting the VM, the installation of Windows will start automatically.

Windows wants to be aware of some regional settings, after which it will ask which version of Windows to install.

  • In this example we will choose Windows Server 2016 Datacenter Evaluation (Desktop Experience)
  • Read the license terms, if you want to continue, you will have to accept them
  • After this, choose Custom installation

Installing Drivers

Now you have the option to install the viostor SCSI drivers, these are necessary, even though we use the IDE controller of VirtualBox at this moment.

To see the drivers, navigate to e:\viostor\2k16\amd64\ , and remove the checkbox so you can see everything.

Choose the disc and let the installer do its job.

Finally, Windows will ask for a passphrase, after that the installation will be finished. Because you want to create an image, you now have to edit your own settings. There are many manuals available on rules about what you can and cannot edit, and why. We will limit ourselves to the necessary settings.

  • Log in (and leave Windows for now, Server Manager wil start alongside a few background processes)
Читайте также:  1с предприятие для платформы linux

What stands out is that the network isn’t working, this is because the drivers have not been installed.

  • Navigate to E:\NetKVM\2k16\amd64 and install netkvm.inf (select the file and press right mouse button)
  • Next, install the IO drivers E:\viostor\2k16\amd64\viostor.inf (select the file and press right mouse button)

After this, the NIC will work, we will need this in a while but now we know for sure that the necessary IO drivers are installed.

Remote Desktop

To be able to use RDP later on, which makes maintenance easier, we have to change two things:

  • Start Powershell to open the firewall for RDP:
  • Click on Start > Settings, and search for remote desktop, now choose allow remote desktop access to your computer .
  • In the popup choose for Allow remote connections to this computer , Click OK to close the popup.
  • If you are using an unofficial- or older RDP client, remove the checkbox below.
  • Click on Apply and press OK.

You can now test the RDP connection, which should work by now.

Cloud-Init

To be able to use Cloud-Init (we need this to, for example, be able to set an admin passphrase when deploying) we have to configure this:

After this, download and install Cloud-Init:

The download is approximately 40MB

  • Click Next
  • To continue, you will have to read and accept the license terms
  • Click Next
  • The default settings will be fine, again click Next
  • Leave everything be except for the Serial port for logging, set that to COM1
  • Next…
  • Install

When the installation is finished, select both run Sysprep and Shutdown when Sysprep terminates .

If you click Finish the Windows installation will be prepared for use as an image and the VM will be closed.

Now you have a Windows image that is switched off, based upon a qcow file which we can upload to OpenStack.

Uploading the Image

When the upload speed of your internet connection isn’t that high (because Windows images are mostly around 10GB) I suggest you use the OpenStack CLI tools for this (see below).

Option 1: Upload with an OpenStack Dashboard

  • Go to an OpenStack Dashboard
  • Login
  • On the left, choose ‘Images’
  • Create Image
  • Enter a name and a description
  • Image Source > Image File en select the qcow image you have created. The location can be found in VirtualBox. In my case it’s a qcow of nearly 13GB.
  • Change the format to Qcow2
  • Architecture: x86_64
  • Minimum Disk: 20
  • Minimum RAM: 2048
  • Create Image

Now, the web-interface will upload the entire image, after which it will be processed and put inside the list of available images.

Option 2: Upload with OpenStack CLI tools

Make sure that the OpenStack CLI tools are installed on your system. If not, you can follow our CLI tutorials.

To be able to create a new image you have to enter the following command in the terminal:

If uploading will take longer than an hour you will get a 401-error , you get this error because in the meanwhile your token has expired. You can ignore this error. Enter the following command to make sure your image has been added to the list of available images in OpenStack:

If you don’t see the new image in the list, try to create it once more.

Starting Windows

To launch a Windows instance now, you have to follow the normal procedure except for two differences:

  • Go to the Fuga Dashboard
  • Login
  • On the left, choose Access & Security . Click on Security Groups and add a security group with RDP access for the IP you’re connecting from (Go to this website to retrieve your IP). If you do not have this yet, you can also add this, and connect the Security Group to your instance later.
  • Create a new instance in the Instances panel. To be able to login Windows later, you need a passphrase. The passphrase we had set earlier does not work anymore. Click on the Metadata tab to add a new custom key admin_pass , after which you can assign a value which is shown in plain text. This is a bit annoying, but you have to change the passphrase again after the initial login anyway.

Sources

This post, written by Yuri Sijtema, was first published on Fuga Academy, the learning branch of Fuga Cloud, a self-service, on-demand, cloud service based in the Netherlands.

Оцените статью