вторник, 1 декабря 2020 г.

Установка lxd на VirtualBox

16 G для машины свободно будет, ?
Последний релиз установленный у клиентов 8.3.17.1549
с последним pg 11. 
ubuntu 20.04.1 server
Настройка - 1 диска 250 Гб фиксированный
Для сети сетвой мост и неразборчивый режим

sudo apt update
sudo apt upgrade
sudo apt install ssh samba mc

sudo apt install bridge-utils -y

Настроим ip адрес
cd /etc/netplan
ls

Делаем так:
sudo nano /etc/netplan/00-installer-config.yaml

 

# This is the network config written by 'subiquity'
#network:
#  ethernets:
#    enp0s3:
#      dhcp4: true
#  version: 2
network:
  version: 2
  ethernets:
    enp0s3:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      dhcp4: false
      dhcp6: false
      interfaces:
        - enp0s3
      addresses:
      - 192.168.1.216/24
      nameservers:
        addresses:
        - 192.168.1.1
        - 8.8.8.8
      gateway4: 192.168.1.1

Сохранить.

sudo netplan generate
sudo netplan --debug apply

sudo reboot

lxd init
Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (ceph, btrfs, dir, lvm) [default=btrfs]: dir
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: br0
Would you like LXD to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:


nano tuning.sh

#!/bin/bash
# отключим ipv6
sudo /bin/su -c "echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf"
sudo /bin/su -c "echo '#net.ipv4.ip_forward = 1' >> /etc/sysctl.conf"
#тюнинг postgresql
sudo /bin/su -c "echo 'vm.swappiness=1' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'kernel.sched_migration_cost_ns = 5000000' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'kernel.sched_autogroup_enabled = 0' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'vm.dirty_background_bytes = 67108864' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'vm.dirty_bytes = 536870912' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'vm.zone_reclaim_mode = 0' >> /etc/sysctl.conf"
#lxd
sudo /bin/su -c "echo 'fs.inotify.max_queued_events = 1048576' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'fs.inotify.max_user_instances = 1048576' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'fs.inotify.max_user_watches = 1048576' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'vm.max_map_count=262144' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'kernel.dmesg_restrict=1' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'net.ipv4.neigh.default.gc_thresh3=8192' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'net.ipv6.neigh.default.gc_thresh3=8192' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'net.core.bpf_jit_limit=3000000000' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'kernel.keys.maxkeys=2000' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'kernel.keys.maxbytes=2000000' >> /etc/sysctl.conf"
sudo /bin/su -c "echo 'fs.aio-max-nr=524288' >> /etc/sysctl.conf"
sudo systemctl stop ondemand
sudo systemctl disable ondemand
sudo timedatectl set-timezone Europe/Moscow
sudo sysctl -p

Сохранить.

chmod +x tuning.sh
./tuning.sh

1 комментарий: