Files
git.limbosolutions.com/documentation/setup-lxc.md
2022-10-09 18:12:20 +01:00

1.8 KiB

LXC Setup

Install

Requirements

  • Currently hosted using macvlan network
  • Instructions are provided for $LXC_PROFILE defined as macvlan For more information how to setup a lxc profile with macvlan network https://git.limbosolutions.com/kb/lxc

Replace and execute on bash

LXC_CONTAINER_NAME=gitsrv01
LXC_PROFILE=default

then execute

## Create ubuntu container
lxc launch ubuntu $LXC_CONTAINER_NAME -p $LXC_PROFILE

## Setup container for docker
curl -s "https://git.limbosolutions.com/kb/lxc/raw/branch/main/scripts/lxc-config-docker-requirements.sh" | bash -s $LXC_CONTAINER_NAME


## update ubuntu container
lxc exec $LXC_CONTAINER_NAME -- bash -c "apt update -y && apt upgrade -y"

## Install fuse and docker on lxc container
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/docker/raw/branch/main/scripts/ubuntu-fuse-setup.sh\" | bash"

## Check docker for fusefs
lxc exec $LXC_CONTAINER_NAME -- bash -c "docker info"

#Setup Portainer
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash"

#confirm container ip address
lxc exec $LXC_CONTAINER_NAME -- bash -c "ip a"

lxc restart $LXC_CONTAINER_NAME

Check instalation

From other computer

 ping $LXC_CONTAINER_NAME 

Access portainer (https://$LXC_CONTAINER_NAME:9443/) for inicial setup:

  • Setup administration username and password

Remove

 lxc rm $LXC_CONTAINER_NAME --force

set a static ip

On lxc container

Example:

/etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.121.221/24
      gateway4: 192.168.121.1
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]
``` bash