Skip to content

gitian building create vm debian

BytzCK edited this page Nov 23, 2021 · 1 revision

Setup Debian virtual machine on VirtualBox

Table of Contents

Create a new VirtualBox VM

  • In the VirtualBox GUI click "New" and choose the following parameters in the wizard:

  • Type: Linux, Debian (64-bit)

  • Memory Size: at least 4096MB, anything less and the build might not complete.

  • Hard Disk: Create a virtual hard disk now

  • Click Create

  • Hard Disk file type: Use the default, VDI (VirtualBox Disk Image)

  • Storage on physical hard disk: Dynamically Allocated

  • File location and size: at least 40GB; as low as 20GB may be possible, but better to err on the safe side

  • Click Create

After creating the VM, we need to configure it.

  • Click the Settings button, then go to System tab and Processor sub-tab. Increase the number of processors to the number of cores on your machine if you want builds to be faster.

  • Go to the Network tab. Adapter 1 should be attached to NAT.

  • Click Advanced, then Port Forwarding. We want to set up a port through which we can reach the VM to get files in and out.

  • Create a new rule by clicking the plus icon.

  • Set up the new rule the following way:
    • Name: SSH
    • Protocol: TCP
    • Leave Host IP empty
    • Host Port: 22222
    • Leave Guest IP empty
    • Guest Port: 22
  • Click Ok twice to save.

Download the most recent Debian ISO from https://www.debian.org/download (Version 11 at the time of writing)
This DVD image can be validated using a SHA256 hashing tool, for example on Unixy OSes by entering the following in a terminal:

echo "ae6d563d2444665316901fe7091059ac34b8f67ba30f9159f7cef7d2fdc5bf8a  debian-11.0.0-amd64-netinst.iso" | sha256sum -c
# (must return OK)

Replace sha256sum with shasum on OSX.

  • Start the VM. On the first launch you will be asked for a CD or DVD image. Choose the downloaded ISO by selecting "Add" when given the list of media.

  • Select the Debian 11 ISO file that you downloaded above

  • Click Start and your virtual machine will start using the Debian installer ISO

Installing Debian

This section will explain how to install Debian on the newly created VM.

  • Select Install from the boot menu. We do not need to install the graphical environment

setup1

  • Select your preferred language to install (English shown)

setup2

  • Select your location (United States shown)

setup3

  • Select the keyboard to use (American English shown)

setup4

  • Wait for the installer components to load

setup5

  • Give the system a hostname

setup6

  • Give the system a domain name

setup7

  • Set the root password

setup8

  • Confirm the root password

setup9

  • Create a new user which will be used for gitian building

setup10

  • Set the new user's username

setup11

  • Create a password for the new user

setup12

  • Confirm the password for the new user

setup13

  • Select your timezone

setup14

  • Partition the disk (Guided - use entire disk recommended)

setup15

  • Select the new disk to partition

setup16

  • Select "All files in one partition"

setup17

  • Select "Finish partitioning and write changes to disk"

setup18

  • Select "Yes" to write the changes to the disk

setup19

  • Wait for the base system to be installed

setup20

  • Select "No" when asked for extra installation media

setup21

  • Select your location to find a package repository close to you (United States shown)

setup22

  • Select a package mirror from the list

setup23

  • Configure a proxy if needed

setup24

  • Wait for the package manager to configure itself

setup25

  • Make your choice whether to participate in the package usage survey

setup26

  • Make sure to select ssh server here so you can log in to your system and deselect Debian Desktop Environment and GNOME

setup27

  • Wait for the software to install

setup28

  • Select "Yes" here to set up the boot loader

setup29

  • Select "/dev/sda" to install the boot loader on

setup30

  • Wait for the installation to complete

setup31

  • Installation is now complete

setup32

  • Choose continue to boot into your Debian Operating System

Connecting to the VM

After the VM has booted you can connect to it using SSH, and files can be copied from and to the VM using a SFTP utility. Connect to localhost, port 22222 (or the port configured when installing the VM). On Windows you can use putty and WinSCP.

For example, to connect as gitianuser from a Linux command prompt use

$ ssh gitianuser@localhost -p 22222
The authenticity of host '[localhost]:22222 ([127.0.0.1]:22222)' can't be established.
RSA key fingerprint is ae:f5:c8:9f:17:c6:c7:1b:c2:1b:12:31:1d:bb:d0:c7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:22222' (RSA) to the list of known hosts.
gitianuser@localhost's password: (enter gitianuser password configured during install)

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@debian:~#

Use sudo to execute commands as root.

Optional - Easier login to the VM

You'll need to generate an SSH key, e.g. by following the instructions under "Generating a new SSH key" here.

After that, login to the VM and enter:

mkdir .ssh

On your machine edit or create ~/.ssh/config and add:

Host gitian
    HostName localhost
    Port 22222
    User gitianuser

Open a new terminal tab and enter:

scp ~/.ssh/id_rsa.pub gitian:.ssh/authorized_keys

Next time you need to login to the VM, just use: ssh gitian

Clone this wiki locally