mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-10 22:21:11 +08:00
Update Part 2 - LXD 2.0: Installing and configuring LXD.md
This commit is contained in:
parent
cc2a52290c
commit
860c74a823
@ -1,43 +1,43 @@
|
||||
translating by ezio
|
||||
|
||||
Part 2 - LXD 2.0: Installing and configuring LXD
|
||||
Part 2 - LXD 2.0: 安装与配置
|
||||
=================================================
|
||||
|
||||
This is the second blog post in this series about LXD 2.0.
|
||||
这是 LXD 2.0 [系列介绍文章][2]的第二篇。
|
||||
|
||||
![](https://linuxcontainers.org/static/img/containers.png)
|
||||
|
||||
### Where to get LXD and how to install it
|
||||
### 安装篇
|
||||
|
||||
There are many ways to get the latest and greatest LXD. We recommend you use LXD with the latest LXC and Linux kernel to benefit from all its features but we try to degrade gracefully where possible to support older Linux distributions.
|
||||
|
||||
#### The Ubuntu archive
|
||||
#### Ubuntu 标准版
|
||||
|
||||
All new releases of LXD get uploaded to the Ubuntu development release within a few minutes of the upstream release. That package is then used to seed all the other source of packages for Ubuntu users.
|
||||
|
||||
If you are using the Ubuntu development release (16.04), you can simply do:
|
||||
如果使用 Ubuntu 16.04 则可以直接安装:
|
||||
|
||||
```
|
||||
sudo apt install lxd
|
||||
```
|
||||
|
||||
If you are running Ubuntu 14.04, we have backport packages available for you with:
|
||||
如果运行的是 Ubuntu 14.04,可以这样安装:
|
||||
|
||||
```
|
||||
sudo apt -t trusty-backports install lxd
|
||||
```
|
||||
|
||||
#### The Ubuntu Core store
|
||||
#### Ubuntu Core
|
||||
|
||||
Users of Ubuntu Core on the stable release can install LXD with:
|
||||
使用Ubuntu Core 稳定版的用户可以使用下面的命令安装 LXD:
|
||||
|
||||
```
|
||||
sudo snappy install lxd.stgraber
|
||||
```
|
||||
|
||||
#### The official Ubuntu PPA
|
||||
#### ubuntu 官方 PPA
|
||||
|
||||
Users of other Ubuntu releases such as Ubuntu 15.10 can find LXD packages in the following PPA (Personal Package Archive):
|
||||
是哟个其他 Ubuntu 发布版 —— 比如 Ubuntu 15.10 —— 的用户可以添加下面的 PPA (Personal Package Archive) 来安装:
|
||||
|
||||
```
|
||||
sudo apt-add-repository ppa:ubuntu-lxc/stable
|
||||
@ -46,21 +46,21 @@ sudo apt dist-upgrade
|
||||
sudo apt install lxd
|
||||
```
|
||||
|
||||
#### The Gentoo archive
|
||||
#### Gentoo
|
||||
|
||||
Gentoo has pretty recent LXD packages available too, you can install those with:
|
||||
Gentoo 已经有了最新的 LXD 安装包,你可以直接安装:
|
||||
|
||||
```
|
||||
sudo emerge --ask lxd
|
||||
```
|
||||
|
||||
#### From source
|
||||
#### 源代码
|
||||
|
||||
Building LXD from source isn’t very difficult if you are used to building Go projects. Note however that you will need the LXC development headers. In order to run LXD, your distribution also needs a recent Linux kernel (3.13 at least), recent LXC (1.1.5 or higher), LXCFS and a version of shadow that supports user sub-uid/gid allocations.
|
||||
|
||||
The latest instructions on building LXD from source can be found in the [upstream README][2].
|
||||
|
||||
### Networking on Ubuntu
|
||||
### ubuntu 上的网络配置
|
||||
|
||||
The Ubuntu packages provide you with a “lxdbr0” bridge as a convenience. This bridge comes unconfigured by default, offering only IPv6 link-local connectivity through an HTTP proxy.
|
||||
|
||||
@ -76,7 +76,7 @@ Or go through the whole LXD step by step setup (see below) with:
|
||||
sudo lxd init
|
||||
```
|
||||
|
||||
### Storage backends
|
||||
### 存储系统
|
||||
|
||||
LXD supports a number of storage backends. It’s best to know what backend you want to use prior to starting to use LXD as we do not support moving existing containers or images between backends.
|
||||
|
||||
@ -86,21 +86,22 @@ A feature comparison table of the different backends can be found [here][3].
|
||||
|
||||
Our recommendation is ZFS as it supports all the features LXD needs to offer the fastest and most reliable container experience. This includes per-container disk quotas, immediate snapshot/restore, optimized migration (send/receive) and instant container creation from an image. It is also considered more mature than btrfs.
|
||||
|
||||
To use ZFS with LXD, you first need ZFS on your system.
|
||||
|
||||
If using Ubuntu 16.04, simply install it with:
|
||||
要和 LXD 一起使用 ZFS ,你需要首先在你的系统上安装 ZFS。
|
||||
|
||||
如果你是用的是 Ubuntu 16.04 , 你只需要简单的使用命令安装:
|
||||
|
||||
```
|
||||
sudo apt install zfsutils-linux
|
||||
```
|
||||
|
||||
On Ubuntu 15.10, you can install it with:
|
||||
在 Ubuntu 15.10 上你可以这样安装:
|
||||
|
||||
```
|
||||
sudo apt install zfsutils-linux zfs-dkms
|
||||
```
|
||||
|
||||
And on older releases, you can use the zfsonlinux PPA:
|
||||
如果是更旧的版本,你需要这样安装:
|
||||
|
||||
```
|
||||
sudo apt-add-repository ppa:zfs-native/stable
|
||||
@ -108,7 +109,7 @@ sudo apt update
|
||||
sudo apt install ubuntu-zfs
|
||||
```
|
||||
|
||||
To configure LXD to use it, simply run:
|
||||
配置 LXD 只需要简单的执行下面的命令:
|
||||
|
||||
```
|
||||
sudo lxd init
|
||||
@ -139,7 +140,7 @@ By default LXD uses ext4 as the filesystem for all the LVs. You can change that
|
||||
lxc config set storage.lvm_fstype xfs
|
||||
```
|
||||
|
||||
#### Simple directory
|
||||
#### 简单目录
|
||||
|
||||
If none of the above are an option for you, LXD will still work but without any of those advanced features. It will simply create a directory for each container, unpack the image tarballs for each container creation and do a full filesystem copy on container copy or snapshot.
|
||||
|
||||
@ -147,11 +148,11 @@ All features are supported except for disk quotas, but this is very wasteful of
|
||||
|
||||
|
||||
|
||||
### More daemon configuration
|
||||
### 配置篇
|
||||
|
||||
The complete list of configuration options for the LXD daemon can be found [here][4].
|
||||
|
||||
#### Network configuration
|
||||
#### 网络配置
|
||||
|
||||
By default LXD doesn’t listen to the network. The only way to talk to it is over a local unix socket at /var/lib/lxd/unix.socket.
|
||||
|
||||
@ -172,7 +173,7 @@ You can also choose not to set a password and instead manually trust each new cl
|
||||
lxc config trust add client.crt
|
||||
```
|
||||
|
||||
#### Proxy configuration
|
||||
#### 代理配置
|
||||
|
||||
In most setups, you’ll want the LXD daemon to fetch images from remote servers.
|
||||
|
||||
@ -186,7 +187,7 @@ lxc config set core.proxy_ignore_hosts image-server.local
|
||||
|
||||
With those, all transfers initiated by LXD will use the squid01.internal HTTP proxy, except for traffic to the server at image-server.local
|
||||
|
||||
#### Image management
|
||||
#### 镜像管理
|
||||
|
||||
LXD does dynamic image caching. When instructed to create a container from a remote image, it will download that image into its image store, mark it as cached and record its origin. After a number of days without seeing any use (10 by default), the image is automatically removed. Every few hours (6 by default), LXD also goes looking for a newer version of the image and updates its local copy.
|
||||
|
||||
@ -200,19 +201,18 @@ lxc config set images.auto_update_cached false
|
||||
|
||||
Here we are instructing LXD to override all of those defaults and instead cache images for up to 5 days since they were last used, look for image updates every 24 hours and only update images which were directly marked as such (–auto-update flag in lxc image copy) but not the images which were automatically cached by LXD.
|
||||
|
||||
### Conclusion
|
||||
### 总结
|
||||
|
||||
At this point you should have a working version of the latest LXD release, you can now start playing with it on your own or wait for the next blog post where we’ll create our first container and play with the LXD command line tool.
|
||||
|
||||
### Extra information
|
||||
### 额外信息
|
||||
|
||||
The main LXD website is at: <https://linuxcontainers.org/lxd>
|
||||
Development happens on Github at: <https://github.com/lxc/lxd>
|
||||
Mailing-list support happens on: <https://lists.linuxcontainers.org>
|
||||
IRC support happens in: #lxcontainers on irc.freenode.net
|
||||
|
||||
And if you don’t want or can’t install LXD on your own machine, you can always [try it online instead][1]!
|
||||
LXD 的主站在: <https://linuxcontainers.org/lxd>
|
||||
LXD 的 GitHub 仓库: <https://github.com/lxc/lxd>
|
||||
LXD 的邮件列表: <https://lists.linuxcontainers.org>
|
||||
LXD 的 IRC 频道: #lxcontainers on irc.freenode.net
|
||||
|
||||
如果你不想或者不能在你的机器上安装 LXD ,你可以[试试在线版的 LXD][1] 。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user