ParrotSecurity 4.2: Install LXD for container

Table of Contents

1 Install LXD

Install lxd with snap.

#!/bin/sh -e# Install LXD with snap.sudo snap install lxdsudo addgroup –system lxd# Add user to lxd group.sudo gpasswd -a “${USER}” lxdsudo reboot

Initialize lxd.

#!/bin/sh# Would you like to use LXD clustering? (yes/no) [default=no]: no# Do you want to configure a new storage pool? (yes/no) [default=yes]: yes# Name of the new storage pool [default=default]: default# Name of the storage backend to use (dir, lvm, zfs) [default=zfs]: dir# Would you like to connect to a MAAS server? (yes/no) [default=no]: no# Would you like to create a new network bridge? (yes/no) [default=yes]: yes# What should the new bridge be called? [default=lxdbr0]: lxdbr0# What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”)# [default=auto]: auto# What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”)# [default=auto]: none# Would you like LXD to be available over the network? (yes/no)# [default=no]: no# Would you like stale cached images to be updated automatically? (yes/no)# [default=yes] yes# Would you like a YAML “lxd init” preseed to be printed? (yes/no)# [default=no]: no# Initialize LXD with NAT network.lxd waitreadycat <<EOF | lxd initnoyesdefaultdirnoyeslxdbr0autononenoyesnoEOF

2 Run container

Run Debian 9 container with lxd.

#!/bin/sh -e# Wait that LXD daemon is up.lxd waitready# Create and start debian-9.lxc launch images:debian/stretch debian-9# Wait that network interface is up.for trial in $(seq 30); do if lxc exec debian-9 ip a s eth0 | grep ‘inet ‘ > /dev/null; then break fi sleep 1done# Check whether network interface can be up or not.if [ “${trial}” -eq 30 ]; then echo “Network interface cannot be up” exit 1fi# Show network interface.lxc exec debian-9 ip a s

Android | Linux | SDL - Narrow Escape