Installing any OS on the Timeweb Cloud server

In this article, we will consider ways to install your own operating system on a Timeweb Cloud server.

Why?

There are many reasons for manual installation of an operating system, starting from the need to use a specific OS and ending with custom marking of disks or specific file systems.

The community is now in Telegram

Subscribe and stay up to date with the latest IT news

Sign up

Review

There are several installation options. In the end, it all depends on what formats the operating system comes in. Together we have:

  • Installing the OS from the ISO image of the installation disc.
  • Installation from a raw (raw) disk image, usually the file has the extension .img.
  • Installation via the OS kernel connection.

The process may vary in detail depending on the specific operating system. It is impossible to cover all options in this article, we will analyze only the most popular cases.

Installation of operating systems on the base will be considered here Linux and BSDHowever, if you really want to, you can try to install a more exotic OS.

Note: Before proceeding with the installation of any example, carefully study the site of the OS developer/vendor. It probably already has instructions for manually installing the system.

Approach

First of all, we need to know that:

  • Hardware virtualization – QEMU/KVM.
  • All servers are running Legacy BIOS, so don’t try to install UEFI.
  • There is no access to the BIOS from the client side, we are limited to the functionality of the control panel.

The task is reduced to running the OS installer. To do this, roughly speaking, we need to emulate booting from a LiveCD.

Since we have no way to initialize an “empty” server, we must first install the server with any installable operating system. This article will use Debian 11 as an example of a “base system”.

We will launch the installer through GRUB, it is in most OSes. Installation discs usually contain a custom bootloader to boot from the installer. We will use the GRUB chainloader function to run this bootloader from the “base system”.

Post-adjustment

Timeweb uses the control panel for many operations with the server qemu-guest-aget. After installing the operating system, it is advisable to install and, if necessary, configure it. Configuring qemu-ga is beyond the scope of this article. It’s usually straightforward, and standard settings are enough.

Installing the OS from an ISO using an additional disk

Most operating systems can be installed from ISO images this way, but sometimes this isn’t the case and you’ll have to resort to other installation options offered by the operating system vendor.

We need:

Note: You don’t need to label or format the additional drive, just add it, that’s enough.

An example installation of the GNU Guix System will be shown below.

ISO recording

1. Download the ISO to the server:


wget 

2. We add an additional disk to the PU. It will be connected to the system as a device /dev/vdb.

3. Burn the ISO to this disk:


dd if=guix-system-install-1.3.0.x86_64-linux.iso of=/dev/vdb

As a result, on /dev/vdb the file system should appear. We check that this is so, with the command:


fdisk -l

Disk /dev/vda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5569f8be

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 20971519 20969472  10G 83 Linux

Disk /dev/vdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot   Start     End Sectors  Size Id Type
/dev/vdb1  *          0 1247275 1247276  609M  0 Empty
/dev/vdb2       1247276 1253035    5760  2.8M ef EFI (FAT-12/16/32)

As you can see, sections have appeared /dev/vdb1 and /dev/vdb2.

Preparing to configure the GRUB menu

We will add an additional item to the GRUB menu that will allow us to run the OS installer.

In order to see the GRUB menu when the system boots and have time to select the desired item, we will set a wait of 60 seconds. Run the following command:


sed -e 's%GRUB_TIMEOUT=.*%GRUB_TIMEOUT=60%' -i.bak /etc/default/grub

We also need to edit the configuration file /boot/grub/device.map. For options in this file, GRUB will detect the drives. It is necessary to bring the content of the file to the following form:


(hd0)    /dev/vda
(hd1)    /dev/vdb

Here we tell GRUB to use the notation hd0 for disk /dev/vda (the “base system” is installed here) and hd1 for /dev/vdb.

Generate automatically /boot/grub/device.map can be a team grub-mkdevicemaphowever, if there is no such command, you will need to manually edit the file.

Run to quickly edit the file:


cp /boot/grub/device.map{,.bak}; printf '(hd0)\t/dev/vda\n(hd1)\t/dev/vdb\n' > /boot/grub/device.map

Apply the changes:


grub-mkconfig -o /boot/grub/grub.cfg

Now we can start bootloader configuration. Two options are described below, the better one chainloader.

Loading via chainloader

The GRUB command chainloader allows you to start another bootloader. You can chainload GRUB -> GRUB or another OS bootloader.

Specify the file /etc/grub.d/40_custom to this type:


#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Guix ISO" {
    set root='hd1'
    chainloader +1
}

After that, run the command to apply the settings:


grub-mkconfig -o /boot/grub/grub.cfg

The GRUB menu item will be called Guix ISO.

Download via configure

This method is more complicated and is only suitable for those cases where GRUB is also installed on the installation disk and for some reason chainloader does not work.

You will also have to find the GRUB configuration file on disk to specify the correct path to it. You can search for the config by walking around the ISO file system, mount the file and see what’s inside:

mount guix-system-install-1.3.0.x86_64-linux.iso /mntTeam configure loads the configuration file from disk. At the same time, in contrast to chainloaderGRUB does not start another bootloader, but applies the configuration “to itself”.

Here is the code snippet to add to /etc/grub.d/40_custom:


menuentry "Guix ISO" {
    set root='hd1'
    configure /boot/grub/grub.cfg
}

Downloading and installing the system

After executing the command grub-mkconfig you can restart the server. It should be done through the control panel to have quick access to the VNC web console.

All subsequent installation will be through the web console.

Note: the web console has the “stick” property. To control from the “stick” keyboard, use the “Paste from clipboard” function in the right corner above the console window.

1. Select the GRUB menu item Guix ISO.

2. You will be taken to the installer. Run the installation.

In process:

  • The installer will prompt you to determine the disk for installing the OS, select the disk /dev/vda.
  • Agree to install SSH server and DHCP client. The latter is important, because otherwise the network will not work on the server.

3. When the installation program informs you that everything is ready, reboot the server.

4. Verify that you can log into the freshly installed system, that the network and SSH daemon are working. If everything is fine, you can remove the extra drive.

This completes the installation, but you may need to install a package qemu-guest-agent.

Installing OpenBSD via a kernel image

There is no need to connect an additional disk to the server. Instead, the OS will be installed by booting the BSD kernel image from GRUB.

Necessary:

  • A server with an installed operating system.
  • Attentiveness.

Here you should carefully read the installation guide:

So:

1. We connect to the existing server and load the BSD kernel image:


wget  -O /boot/bsd.rd

Further actions are performed through the VNC console in the PUA.

2. Press the PUA button to restart the server. At the same time, you need to use the text insertion function in the console and insert the letter C (Latin letter C).

3. The GRUB bootloader console will open. It is necessary to sequentially enter and execute the following commands:


set root=(hd0,msdos1)
kopenbsd /boot/bsd.rd
boot

4. The OpenBSD kernel and installer will start to load. Next, you need to carefully read the prompts on the screen and enter the answers. Follow the instructions.

Most installer questions can be answered by simply pressing Enter.

  • The question of network settings (the IPv4 settings) should be answered dhcp.
  • Agree to install sshd (by default yes).
  • You can skip creating a regular user. In this case, it is necessary to answer yes to the question of root access via ssh.
  • After completion agree to reboot.

The first start of the server will be long due to the application of patches (the text will be displayed in the console: Checking for available binary patches).

That’s all. Further system configuration can be done via SSH.

Installation of Mikrotik Cloud Hosted Router

Note: Please note that in Timeweb virtual machines work behind NAT and have only one network interface with a gray IP. Two interfaces can only be obtained on a dedicated server.

We will install the OS using a raw disk image. You can get a link to the image on the Search page Raw disk image.

Necessary:

  • A server with an installed operating system.
  • Humility.

So:

1. Boot the server into recovery mode. This is necessary in order to completely stop writing to disk /dev/vda. SystemRescue is used as a recovery disk (LiveCD).

Further work will be done through the web console.

2. We download the Mikrotik CHR image:


wget 

3. You need to check the checksum to make sure the image is not corrupted. Find a line on the page Checksum and find the amount there for the selected OS version and file format. In my case these are the lines:


MD5 chr-6.49.6.img.zip: 484ba7de7f71b8672ca76ceaf46b0d27
SHA256 chr-6.49.6.img.zip: dc0a70dc806ef068c54b5541c9668270b058dda11307d958d059a7c292320003

Let’s check sha256the hash sum must match:


sha256sum chr-6.49.6.img.zip

4. Let’s unpack the image and burn it to disk /dev/vda:


unzip chr-6.49.6.img.zip
dd if=/tmp/chr-6.49.6.img of=/dev/vda

5. Return the server to the standard loading mode. At the first start, the OS will automatically resize the file system.

done In this way, you can try to install many other OSes that are supplied as raw disks. Please note that there may not be enough space on the LiveCD. You can download the image directly to the RAM. You need to initialize the RAM disk:


mount -t tmpfs tmpfs /tmp

That’s all for now.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2023 ZoNa365.ru - Theme by WPEnjoy · Powered by WordPress