@@ -12,74 +12,68 @@ files into `/usr/local/bin`.
12
12
1 . Get an AWS account (see
13
13
[ this article] ( https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/ )
14
14
if you need help creating one)
15
- 2 . Launch an i3.metal instance running Amazon Linux 2 (you can find it in the
16
- EC2 console Quickstart wizard, or by running
17
- ` aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 `
18
- in your chosen region). If you need help launching an EC2 instance, see the
15
+ 2 . Launch an i3.metal instance running Debian Stretch (you can find it in the
16
+ [ AWS marketplace ] ( http://deb.li/awsmp ) or on [ this
17
+ page ] ( https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch ) . If you need
18
+ help launching an EC2 instance, see the
19
19
[ EC2 getting started guide] ( https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html ) .
20
- 3 . If you have an older kernel, update the kernel to
21
- ` kernel-4.14.88-88.76.amzn2 ` (there's a bugfix in this that we need) and
22
- reboot. The latest AMIs for Amazon Linux 2 (which you can discover from the
23
- instructions above) already have a new-enough kernel.
24
- <details ><summary >Click here for instructions on updating your kernel</summary >
25
- ``` bash
26
- if [[ $( rpm --eval " %{lua: print(rpm.vercmp('$( uname -r) ', '4.14.88-88.76.amzn2.x86_64'))}" ) -lt 0 ]]; then
27
- echo " You need to install a kernel >= 4.14.88-88.76.amzn2. You can do so by running the following commands:"
28
- echo " sudo yum -y upgrade kernel && sudo reboot"
29
- else
30
- echo ' You are already up to date!'
31
- fi
32
- ```
33
- </details >
34
20
3 . Run the script below to download and install all the required components.
35
21
This script expects to be run from your ` $HOME ` directory.
36
22
37
23
``` bash
38
24
#! /bin/bash
39
25
40
- if [[ $( rpm --eval " %{lua: print(rpm.vercmp('$( uname -r) ', '4.14.88-88.76.amzn2.x86_64'))}" ) -lt 0 ]]; then
41
- echo " You need to install a kernel >= 4.14.88-88.76.amzn2. You can do so by running the following commands:"
42
- echo " sudo yum -y upgrade kernel && sudo reboot"
43
- fi
44
-
45
26
cd ~
46
27
47
- # Install git
48
- sudo yum install -y git
49
-
50
- # Install Rust and Go 1.11
51
- sudo amazon-linux-extras install -y rust1
52
- sudo amazon-linux-extras install -y golang1.11
53
-
54
- # Check out Firecracker and build it from the v0.12.0 tag
28
+ # Install git, Go 1.11, make, curl
29
+ sudo mkdir -p /etc/apt/sources.list.d
30
+ echo " deb http://ftp.debian.org/debian stretch-backports main" | \
31
+ sudo tee /etc/apt/sources.list.d/stretch-backports.list
32
+ sudo DEBIAN_FRONTEND=noninteractive apt-get update
33
+ sudo DEBIAN_FRONTEND=noninteractive apt-get \
34
+ --target-release stretch-backports \
35
+ install --yes \
36
+ golang-go \
37
+ make \
38
+ git \
39
+ curl \
40
+ e2fsprogs \
41
+ musl-tools \
42
+ util-linux
43
+
44
+ # Install Rust
45
+ curl https://sh.rustup.rs -sSf | sh -s -- --verbose -y --default-toolchain 1.32.0
46
+ source $HOME /.cargo/env
47
+ rustup target add x86_64-unknown-linux-musl
48
+
49
+ # Check out Firecracker and build it from the v0.15.2 tag
55
50
git clone https://github.com/firecracker-microvm/firecracker.git
56
51
cd firecracker
57
- git checkout v0.12.0
58
- cargo build --release --features vsock --target x86_64-unknown-linux-gnu
59
- sudo cp target/x86_64-unknown-linux-gnu /release/{firecracker,jailer} /usr/local/bin
52
+ git checkout v0.15.2
53
+ cargo build --release --features vsock --target x86_64-unknown-linux-musl
54
+ sudo cp target/x86_64-unknown-linux-musl /release/{firecracker,jailer} /usr/local/bin
60
55
61
56
cd ~
62
57
63
- # Check out containerd and build it from the v1.2.1 tag
58
+ # Check out containerd and build it from the v1.2.4 tag
64
59
mkdir -p ~ /go/src/github.com/containerd/containerd
65
60
git clone https://github.com/containerd/containerd.git ~ /go/src/github.com/containerd/containerd
66
61
cd ~ /go/src/github.com/containerd/containerd
67
- git checkout v1.2.1
68
- sudo yum install -y libseccomp-devel btrfs-progs-devel
62
+ git checkout v1.2.4
63
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libseccomp-dev btrfs-progs
69
64
make
70
65
sudo cp bin/* /usr/local/bin
71
66
72
67
cd ~
73
68
74
- # Check out runc and build it from the 96ec2177ae841256168fcf76954f7177af9446eb
69
+ # Check out runc and build it from the 6635b4f0c6af3810594d2770f662f34ddc15b40d
75
70
# commit. Note that this is the version described in
76
- # https://github.com/containerd/containerd/blob/v1.2.1 /RUNC.md and
77
- # https://github.com/containerd/containerd/blob/v1.2.1 /vendor.conf#L23
71
+ # https://github.com/containerd/containerd/blob/v1.2.4 /RUNC.md and
72
+ # https://github.com/containerd/containerd/blob/v1.2.4 /vendor.conf#L23
78
73
mkdir -p ~ /go/src/github.com/opencontainers/runc
79
74
git clone https://github.com/opencontainers/runc ~ /go/src/github.com/opencontainers/runc
80
75
cd ~ /go/src/github.com/opencontainers/runc
81
- git checkout 96ec2177ae841256168fcf76954f7177af9446eb
82
- sudo yum install -y libseccomp-static glibc-static
76
+ git checkout 6635b4f0c6af3810594d2770f662f34ddc15b40d
83
77
make static BUILDTAGS=' seccomp'
84
78
sudo make BINDIR=' /usr/local/bin' install
85
79
88
82
# Check out firecracker-containerd and build it
89
83
git clone https://github.com/firecracker-microvm/firecracker-containerd.git
90
84
cd firecracker-containerd
91
- sudo yum install -y device-mapper
85
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y dmsetup
92
86
make STATIC_AGENT=' true'
93
87
sudo cp runtime/containerd-shim-aws-firecracker snapshotter/cmd/{devmapper/devmapper_snapshotter,naive/naive_snapshotter} /usr/local/bin
94
88
@@ -114,8 +108,8 @@ cd /container
114
108
EOF
115
109
chmod +x fc-agent.start
116
110
truncate --size=+50M hello-rootfs.ext4
117
- e2fsck -f hello-rootfs.ext4
118
- resize2fs hello-rootfs.ext4
111
+ /sbin/ e2fsck -f hello-rootfs.ext4
112
+ /sbin/ resize2fs hello-rootfs.ext4
119
113
sudo mount hello-rootfs.ext4 /tmp/mnt
120
114
sudo cp $( which runc) firecracker-containerd/agent/agent /tmp/mnt/usr/local/bin
121
115
sudo cp fc-agent.start /tmp/mnt/etc/local.d
@@ -156,14 +150,17 @@ sudo tee -a /etc/containerd/firecracker-runtime.json <<EOF
156
150
"metrics_fifo": "/tmp/fc-metrics.fifo"
157
151
}
158
152
EOF
153
+
154
+ # Enable vhost-vsock
155
+ sudo modprobe vhost-vsock
159
156
```
160
157
161
158
4 . Open a new terminal and start the ` naive_snapshotter ` program in the
162
159
foreground
163
160
164
161
``` bash
165
162
sudo mkdir -p /var/run/firecracker-containerd /var/lib/firecracker-containerd/naive
166
- sudo /usr/local/bin/ naive_snapshotter \
163
+ sudo naive_snapshotter \
167
164
-address /var/run/firecracker-containerd/naive-snapshotter.sock \
168
165
-path /var/lib/firecracker-containerd/naive \
169
166
-debug
@@ -172,16 +169,16 @@ sudo /usr/local/bin/naive_snapshotter \
172
169
5 . Open a new terminal and start ` containerd ` in the foreground
173
170
174
171
``` bash
175
- sudo PATH= $PATH /usr/local/bin/ containerd
172
+ sudo containerd
176
173
```
177
174
178
175
6 . Open a new terminal, pull an image, and run a container!
179
176
180
177
``` bash
181
- sudo /usr/local/bin/ ctr image pull \
178
+ sudo ctr image pull \
182
179
--snapshotter firecracker-naive \
183
180
docker.io/library/debian:latest
184
- sudo /usr/local/bin/ ctr run \
181
+ sudo ctr run \
185
182
--snapshotter firecracker-naive \
186
183
--runtime aws.firecracker \
187
184
--tty \
@@ -190,4 +187,4 @@ sudo /usr/local/bin/ctr run \
190
187
```
191
188
192
189
When you're done, you can stop or terminate your i3.metal EC2 instance to avoid
193
- incurring additional charges from EC2.
190
+ incurring additional charges from EC2.
0 commit comments