Installation of Calculate LXC Container


Installing the required packages

To continue, you need to install app-emulation/lxc:

emerge -a lxc

Installing Calculate into a container

To install Calculate Linux Container, run:

lxc-create -n css -t download -- --server --no-validate --arch x86_64
lxc-create -n ccs -t download -- --server --no-validate --arch x86_64
Downloading the image index
WARNING: Running without gpg validation!

CCS     18      x86_64  default 20181224


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

You just created a Gentoo container (release=18, arch=amd64, variant=default)

To enable sshd, run: rc-update add sshd

For security reason, container images ship without user accounts
and without a root password.

Use lxc-attach or chroot directly into the rootfs to set a root password
or create user accounts.

Replace css with any other suitable container name. The boot script will display the available images and prompt you for the distribution name in capitals (CCS~ ) and the release number (currently 18). The application will automatically fetch the container on the cloud and install it. The installed containers are stored in the /var/calculate/lxc/ directory.


In further descriptions used in commands and paths, use the container name you have chosen instead of css~.

Network configuration

Network configuration of the host computer

To configure the network in a LXC container, you will need to configure the network bridge on the host. To do this, select one of the two configuration options:

  • If the host computer has multiple IP addresses, for example, if you intend to use the container on a desktop running in the local network and obtaining its IP via DHCP, you can configure the network by [using shared network] (network#ispolzovanie_obshchei_seti).
  • If the host computer has a single IP address, say when starting a container on a VPS or on a dedicated server, you can configure [NAT] (network#transliatsiia_ip-adresov) with the same interface.

Network configuration of the container

Configure the network for your container:


# network type if bridge is used = veth
# start the network at system start = up
# interface inside the container = eth0
# bridge to be used by the virtual interface = br0
# random MAC for the network interface of the container (first number must be even) = 02:03:04:05:06:07

Replace the MAC (02:03:04:05:06:07). Note that the first number must be even.

Start the container

To start the container, run:

lxc-start ccs

Make sure the container is up and running:

lxc-info ccs
Name:           ccs
State:          RUNNING
PID:            25107
CPU use:        3.03 seconds
BlkIO use:      51.98 MiB
Memory use:     61.21 MiB
KMem use:       4.39 MiB
Link:           vethXLWII2
 TX bytes:      516 bytes
 RX bytes:      516 bytes
 Total bytes:   1.01 KiB

Add the container to autostart:

ln -sf /etc/init.d/lxc /etc/init.d/lxc.ccs

rc-update add lxc.ccs

In order for the system in the container to start correctly once the network is up, create a file containing the following rule:



Configuring system in the container

You can adjust the container settings on the host computer using the lxc-attach <container_name> -- <command> syntax, or connect to the container and run the following:

lxc-attach ccs


Network configuration when using a shared network

If you are using a shared network (with local IPs), you can configure the network either with DHCP or by specifying an available IP address and a router IP address.

When using a DHCP server on a local network, you simply have to run the following:

/etc/init.d/net.eth0 start

rc-update add net.eth0

Network configuration when using NAT

If using [network address translation (NAT)] (network#transliatsiia_ip-adresov), edit the host settings accordingly:

cl-setup-network --iface eth0: --route default: --dns

rc-update add net.eth0

In the example, the container uses IP ~ to route via ~

Other settings

Check the localization parameters and set the root password:

cl-setup-locale -l ru_RU --timezone Europe/Moscow


You can also specify the complete hostname:

cl-setup-network --hostname

To check the new hostname, run:

hostname -f

Adding applications in a container

Update Portage in the container:


At first startup, cl-update will fetch the Portage tree as well as all added overlays.

Now install the software you need for logging and cron jobs:

emerge -a syslog-ng logrotate vixie-cron

When you have completed the configuration, exit the container: