Deepin 15.3上安裝LXD

首先先看看效果,幾個容器全開,也佔不了多少內存。 折騰了快一天了,總算搞起來了。linux

lxc list
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
|     NAME      |  STATE  |        IPV4         |                     IPV6                     |    TYPE    | SNAPSHOTS |
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
| centos6       | RUNNING | 10.54.46.127 (eth0) | fd42:20c0:8696:546:216:3eff:feb8:af5c (eth0) | PERSISTENT | 0         |
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
| centos7       | RUNNING | 10.54.46.130 (eth0) | fd42:20c0:8696:546:216:3eff:feae:3681 (eth0) | PERSISTENT | 0         |
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
| debian8       | RUNNING | 10.54.46.152 (eth0) | fd42:20c0:8696:546:216:3eff:fe77:b416 (eth0) | PERSISTENT | 0         |
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
| ubuntu-trusty | RUNNING | 10.54.46.245 (eth0) | fd42:20c0:8696:546:216:3eff:fe47:71ac (eth0) | PERSISTENT | 0         |
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
| ubuntu-xenial | RUNNING | 10.54.46.201 (eth0) | fd42:20c0:8696:546:216:3eff:fe5f:9b78 (eth0) | PERSISTENT | 0         |
+---------------+---------+---------------------+----------------------------------------------+------------+-----------+
$ free -h
              total        used        free      shared  buff/cache   available
Mem:           7.7G        4.0G        212M        405M        3.5G        3.0G
Swap:            0B          0B          0B

而後說下怎麼搞,首先源碼編譯直接放棄,源碼編譯用到了go,而go的幾個類庫要從golang.org走,被牆了,因此直接放棄(儘管能夠經過hosts,可是爲了簡便起見就不弄了)。golang

而後用ubuntu官方編譯好的,就添加ubuntu的ppa好了:ubuntu

sudo add-apt-repository -y ppa:ubuntu-lxc/lxd-stable

這裏執行完是不能用的,sources.list裏面寫的是ubuntu 17.04的開發代號,須要改成16.04的(xenial),順便把ppa倉庫換成中科大的鏡像站以加速。centos

echo 'deb http://launchpad.proxy.ustclug.org/ubuntu-lxc/lxd-stable/ubuntu xenial main' | sudo tee /etc/apt/sources.list.d/ubuntu-lxc-ubuntu-lxd-stable-zesty.list

後面這一步最重要,也是折騰到快晚上才搞定的東西,就是調整apt的policy,讓lxc系列的安裝包走ubuntu的ppa,而不是從deepin的倉庫安裝,默認狀況下deepin的倉庫優先級會高於ppa,致使安裝到最後由於依賴問題失敗。centos7

/etc/apt/preferences文件寫入如下內容,下降deepin倉庫的優先級(即包名衝突的狀況下,使用第三方倉庫的版本,而非deepin的倉庫):code

Package: *
Pin: release l=Deepin
Pin-Priority: 400

以後刷新倉庫安裝lxd便可:內存

sudo apt update; sudo apt install -y lxd

後面就徹底按照lxd的手冊操做便可,若是須要使用zfs的話,須要自行安裝zfsutil-linux包。開發

最後,但願deepin把lxd收入倉庫中,就不用這麼折騰了。源碼

相關文章
相關標籤/搜索