# Quickstart with firecracker-containerd This quickstart guide provides simple steps to get a working firecracker-containerd environment, with each of the major components built from source. Once you have completed this quickstart, you should be able to run and develop firecracker-containerd (the components in this repository), the Firecracker VMM, and containerd. Note that the guide below should result in VMs by default having network access to IPs assigned on the host and may, depending on the configuration of your host's network, also have outbound access to the internet. This quickstart will clone repositories under your `$HOME` directory and install files into `/usr/local/bin`. 1. Get an AWS account (see [this article](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/) if you need help creating one) 2. Launch an i3.metal instance running Debian Bullseye (you can find it in the [AWS marketplace](https://aws.amazon.com/marketplace/pp/prodview-l5gv52ndg5q6i) or on [this page](https://wiki.debian.org/Cloud/AmazonEC2Image/Bullseye). If you need help launching an EC2 instance, see the [EC2 getting started guide](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html). 3. Run the script below to download and install all the required dependencies on a debian based instance. Alternate steps for rpm based instance is provided as well. This script expects to be run from your `$HOME` directory. ```bash #!/bin/bash cd ~ # Install git, Go 1.17, make, curl sudo mkdir -p /etc/apt/sources.list.d echo "deb http://ftp.debian.org/debian bullseye-backports main" | \ sudo tee /etc/apt/sources.list.d/bullseye-backports.list sudo DEBIAN_FRONTEND=noninteractive apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get \ install --yes \ golang-1.17 \ make \ git \ curl \ e2fsprogs \ util-linux \ bc \ gnupg # Debian's Go 1.17 package installs "go" command under /usr/lib/go-1.17/bin export PATH=/usr/lib/go-1.17/bin:$PATH cd ~ # Install Docker CE # Docker CE includes containerd, but we need a separate containerd binary, built # in a later step curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - apt-key finger docker@docker.com | grep '9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88' || echo '**Cannot find Docker key**' echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list sudo DEBIAN_FRONTEND=noninteractive apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get \ install --yes \ docker-ce aufs-tools- sudo usermod -aG docker $(whoami) # Install device-mapper sudo DEBIAN_FRONTEND=noninteractive apt-get install -y dmsetup ``` A similar script to install dependencies for rpm based linux distro e.g. Amazon Linux 2 can be found here
```bash #!/bin/bash cd ~ # Install git, make, curl sudo yum -y update sudo yum -y install \ make \ git \ curl \ e2fsprogs \ util-linux \ bc \ gnupg \ gcc # Amazon Linux 2 packages can sometimes be dated, so let's install using # the Go installer. The installer will handle any path changes and just # need to source environment variables afterwards for the existing shell session. curl -LO https://get.golang.org/$(uname)/go_installer && \ chmod +x go_installer && \ ./go_installer -version 1.17 && \ rm go_installer && \ source .bash_profile cd ~ # Install Docker CE # Docker CE includes containerd, but we need a separate containerd binary, built # in a later step sudo yum -y update sudo amazon-linux-extras install -y docker sudo usermod -aG docker $(whoami) sudo yum -y install device-mapper ```
4. Now run the following script below to download and install firecracker containerd. ```bash #!/bin/bash cd ~ # Check out firecracker-containerd and build it. This includes: # * firecracker-containerd runtime, a containerd v2 runtime # * firecracker-containerd agent, an inside-VM component # * runc, to run containers inside the VM # * a Debian-based root filesystem configured as read-only with a read-write # overlay # * firecracker-containerd, an alternative containerd binary that includes the # firecracker VM lifecycle plugin and API # * tc-redirect-tap and other CNI dependencies that enable VMs to start with # access to networks available on the host git clone https://github.com/firecracker-microvm/firecracker-containerd.git cd firecracker-containerd sg docker -c 'make all image firecracker' sudo make install install-firecracker demo-network cd ~ # Download kernel curl -fsSL -o hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/x86_64/kernels/vmlinux.bin # Configure our firecracker-containerd binary to use our new snapshotter and # separate storage from the default containerd binary sudo mkdir -p /etc/firecracker-containerd sudo mkdir -p /var/lib/firecracker-containerd/containerd # Create the shim base directory for which firecracker-containerd will run the # shim from sudo mkdir -p /var/lib/firecracker-containerd sudo tee /etc/firecracker-containerd/config.toml <