CentOS Stream 10

LXC : Install2026/04/17

 

Install the container-based virtualization software LXC (Linux Containers).

Because it uses paravirtualization, which shares the host and kernel, other operating systems like Windows cannot be used.

[1] Install LXC.
# install from EPEL

[root@dlp ~]#
dnf --enablerepo=epel -y install lxc
[2] Configure Bridge networking for Containers.
Replace the interface name [enp1s0] for your own environment.
# add bridge [lxcbr0]

[root@dlp ~]#
nmcli connection add type bridge autoconnect yes con-name lxcbr0 ifname lxcbr0

Connection 'br0' (ced3dbca-7cc3-41bd-a42c-86857ecd1f7f) successfully added.
# set IP address for [lxcbr0]

[root@dlp ~]#
nmcli connection modify lxcbr0 ipv4.addresses 10.0.0.30/24 ipv4.method manual
# set Gateway for [lxcbr0]

[root@dlp ~]#
nmcli connection modify lxcbr0 ipv4.gateway 10.0.0.1
# set DNS for [lxcbr0]

[root@dlp ~]#
nmcli connection modify lxcbr0 ipv4.dns 10.0.0.10
# set DNS search base for [lxcbr0]

[root@dlp ~]#
nmcli connection modify lxcbr0 ipv4.dns-search srv.world
# remove the current interface

[root@dlp ~]#
nmcli connection del enp1s0
# add the removed interface again as a member of [lxcbr0]

[root@dlp ~]#
nmcli connection add type bridge-slave autoconnect yes con-name enp1s0 ifname enp1s0 master lxcbr0
[root@dlp ~]#
reboot
[root@dlp ~]#
ip addr show lxcbr0

4: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:e8:ad:a3 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global noprefixroute lxcbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::db46:d56b:154a:4186/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[3] As an example, we will create a CentOS Trixie container.
Various other OS templates are available besides CentOS, which can be viewed at the following URL.
⇒ https://images.linuxcontainers.org/
# create [centos10] container

[root@dlp ~]#
lxc-create --name centos10 --template download -- --dist centos --release 10-Stream --arch amd64

Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

---
You just created a Centos 10-Stream x86_64 (20260416_07:08) container.

# list containers

[root@dlp ~]#
lxc-ls

centos10

# display container information

[root@dlp ~]#
lxc-info -n centos10

Name:           centos10
State:          STOPPED

# start containers as daemons

[root@dlp ~]#
lxc-start -n centos10 -d

[root@dlp ~]#
lxc-info -n centos10

Name:           centos10
State:          RUNNING
PID:            2779
Link:           vethHwOYov
 TX bytes:      1.35 KiB
 RX bytes:      104 bytes
 Total bytes:   1.45 KiB

# Connect to the container

[root@dlp ~]#
lxc-attach -n centos10

[root@centos10 ~]#     # connected to the container's shell

# to return to the host console, press [Ctrl + d]

[root@centos10 ~]#
exit
[root@dlp ~]#
# To stop the container, do the following

[root@dlp ~]#
lxc-stop -n centos10
[4] Here are some other basic operating instructions.
# container you created is saved in the following location

[root@dlp ~]#
ll /var/lib/lxc

total 0
drwxrwx---. 3 root root 34 Apr 17 08:45 centos10

# for example, create a container on [ubuntu2404]

[root@dlp ~]#
lxc-create --name ubuntu2404 --template download -- --dist ubuntu --release noble --arch amd64

[root@dlp ~]#
lxc-start -n ubuntu2404 -d

# run a specific command and display the results on the host console

[root@dlp ~]#
lxc-attach -n ubuntu2404 -- /bin/echo "Welcome to the LXC World!"

Welcome to the LXC World!
# delete a container

[root@dlp ~]#
lxc-stop -n ubuntu2404

[root@dlp ~]#
lxc-destroy -n ubuntu2404

[root@dlp ~]#
lxc-ls

centos10
# take a snapshot of a container

[root@dlp ~]#
lxc-snapshot -n centos10

lxc-snapshot: centos10: ../src/lxc/lxccontainer.c: do_lxcapi_snapshot: 4129 Snapshot of directory-backed container requested
lxc-snapshot: centos10: ../src/lxc/lxccontainer.c: do_lxcapi_snapshot: 4130 Making a copy-clone.  If you do want snapshots, then
lxc-snapshot: centos10: ../src/lxc/lxccontainer.c: do_lxcapi_snapshot: 4131 please create overlay clone first, snapshot that
lxc-snapshot: centos10: ../src/lxc/lxccontainer.c: do_lxcapi_snapshot: 4132 and keep the original container pristine

[root@dlp ~]#
lxc-snapshot -n centos10 --list

snap0 (/var/lib/lxc/centos10/snaps) 2026:04:17 09:09:52
# restore from snapshot

[root@dlp ~]#
lxc-snapshot -n centos10 -r snap0
Matched Content