“LXD on Ubuntu 18.04 LTS Server Edition”

LXD

What is LXD (Pure-container hypervisor)?

The LXD container hypervisors is supported and created by Ubuntu team, simplest, LXD is a daemon which provides a REST API to drive LXC containers. Its main goal is to provide a user experience that’s similar to that of virtual machines but using Linux containers rather than hardware virtualization. To obtain more info about that read this link

https://www.ubuntu.com/containers/lxd

and that

https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/

1 STEP – INSTALL LXD

Type the following aptgetcommand or apt command to LXD:

$: sudo sh -c 'apt update && apt upgrade'
$: sudo apt install lxd

1.2 STEP – ADD USER TO LXD GROUP

No need to be the root user to manage LXD daemon. To manage LXD server add our username to lxd group using the command:

$: sudo adduser {USERNameHere} lxd
$: sudo adduser richardsith lxd
$: newgrp lxd

Verify it with the id command:

$: id

2 STEP – SETUP ZFS

I suggest you use ZFS and look this link:

“ZFS ON UBUNTU 18.04 LTS SERVER EDITION″

3 STEP – CONFIGURE LXD STORAGE AND NETWORK

It is time set up the LXD server.  We must configure networking and storage option such as directory, zfs, btrf and more:

$: sudo lxd init

You must answer a series of questions on how to configure the LXD server. We can verify it with the following command:

$: lxd list
$: lxd list | more

4 STEP – CREATE A CONTAINER

Creating our first Linux container

$: lxc image list images:
$: lxc image list images: | grep -i ubuntu

To create and start containers from images use the launch command:

$: lxc launch images:ubuntu/bionic/amd64 ubuntu-svr

List the existing containers:

$: lxc list --fast

5 STEP – USEFUL COMMANDS

To run or execute command in containers use exec command:

$: lxc exec containerName -- command

example

$: lxc exec ubuntu-svr -- ip r

To gain login and gain shell access in a container named file-server , enter:

$: lxc exec ubuntu-svr bash

Start containers using the following cli:

$: lxc start ubuntu-svr

Stop containers using the following syntax:

$: lxc stop ubuntu-svr

Want to restart your containers for any reasons? Try:

$: lxc restart ubuntu-svr

The command to delete immediately the container is:

$: lxc stop ubuntu-svr
$: lxc delete ubuntu-svr

Type the following command to have some info:

$: lxc info ubuntu-svr

“cya to the next 1…. Njoy !”
bye dakj

Disclaimer: All the tutorials included on this site are performed in a lab environment to simulate a real world production scenario. As everything is done to provide the most accurate steps to date, we take no responsibility if you implement any of these steps in a production environment.

“We learn from our mistakes”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.