mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Add misc tips to configure LXC properly
This commit is contained in:
parent
db04eb9463
commit
0a989d0c56
3 changed files with 31 additions and 4 deletions
21
README.md
21
README.md
|
@ -49,10 +49,29 @@ lxc-checkconfig
|
|||
echo "veth" | sudo tee -a /etc/modules
|
||||
```
|
||||
|
||||
On Debian Buster, I had to re-patch the driver.rb of vagrant-lxc plugin with [this version](https://raw.githubusercontent.com/fgrehm/vagrant-lxc/2a5510b34cc59cd3cb8f2dcedc3073852d841101/lib/vagrant-lxc/driver.rb) (especially the `roofs_path` function). I also had to install `apparmor` then `systemctl restart apparmor` for `lxc-start` to work.
|
||||
On Debian Buster, I had to re-patch the driver.rb of vagrant-lxc plugin with [this version](https://raw.githubusercontent.com/fgrehm/vagrant-lxc/2a5510b34cc59cd3cb8f2dcedc3073852d841101/lib/vagrant-lxc/driver.rb) (especially the `roofs_path` function). I also had to install `apparmor` then `systemctl restart apparmor` for `lxc-start` to work. Also check instruction on https://feeding.cloud.geek.nz/posts/lxc-setup-on-debian-stretch/
|
||||
|
||||
If you run Archlinux, this page should be quite useful to setup LXC : https://github.com/fgrehm/vagrant-lxc/wiki/Usage-on-Arch-Linux-hosts
|
||||
|
||||
Typically `/etc/default/lxc-net` and `/etc/lxc/default.conf` should look like this :
|
||||
|
||||
```
|
||||
> cat /etc/default/lxc-net
|
||||
USE_LXC_BRIDGE="true"
|
||||
LXC_BRIDGE="lxcbr0"
|
||||
LXC_ADDR="10.0.3.1"
|
||||
LXC_NETMASK="255.255.255.0"
|
||||
LXC_NETWORK="10.0.3.0/24"
|
||||
LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
|
||||
LXC_DHCP_MAX="253"
|
||||
|
||||
> cat /etc/lxc/default.conf
|
||||
lxc.net.0.type = veth
|
||||
lxc.net.0.link = lxcbr0
|
||||
lxc.net.0.flags = up
|
||||
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
|
||||
```
|
||||
|
||||
Then, go into your favorite development folder and deploy ynh-dev with :
|
||||
|
||||
```bash
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
BOX="ynh-dev"
|
||||
|
||||
# Create box
|
||||
vagrant up $BOX
|
||||
vagrant up $BOX --provider=lxc
|
||||
|
||||
# Package box
|
||||
vagrant package $BOX --output /tmp/$BOX.box
|
||||
|
|
12
ynh-dev
12
ynh-dev
|
@ -113,6 +113,10 @@ function create_sym_link() {
|
|||
|
||||
function start_ynhdev()
|
||||
{
|
||||
[[ $(systemctl is-active lxc-net) == "active" ]] || critical "Service lxc-net should be running ... You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
ip a | grep lxcbr0 -q || critical "There is no 'lxcbr0' interface. You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
local NAME=${1:-ynh-dev}
|
||||
local BOX_NAME="yunohost/$NAME"
|
||||
local BOX_URL="https://build.yunohost.org/yunohost-$BOX_NAME-lxc.box"
|
||||
|
@ -145,16 +149,20 @@ function destroy_ynhdev()
|
|||
|
||||
function rebuild_ynhdev()
|
||||
{
|
||||
[[ $(systemctl is-active lxc-net) == "active" ]] || critical "Service lxc-net should be running ... You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
ip a | grep lxcbr0 -q || critical "There is no 'lxcbr0' interface. You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
local BOX="ynh-dev"
|
||||
|
||||
set -x
|
||||
cd prebuild
|
||||
|
||||
# Create box
|
||||
vagrant up $BOX
|
||||
vagrant up $BOX --provider=lxc || critical "Could not create the box ?"
|
||||
|
||||
# Package box
|
||||
vagrant package $BOX --output /tmp/$BOX.box
|
||||
vagrant package $BOX --output /tmp/$BOX.box || critical "Could not package package the box ?"
|
||||
|
||||
# Destroy current box
|
||||
vagrant destroy $BOX
|
||||
|
|
Loading…
Add table
Reference in a new issue