在LXD上运行Ubuntu
以下是在Ubuntu 23.04上安装的lxd 5.15中安装和配置Ubuntu 23.04的方法。
安装完成并登录后,将如下所示。
$ ssh ubuntu.local
Welcome to Ubuntu 23.04 (GNU/Linux 6.2.0-27-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sun Aug 27 15:59:25 JST 2023
System load: 0.34
Usage of /home: unknown
Memory usage: 0%
Swap usage: 0%
Temperature: 49.0 C
Processes: 23
Users logged in: 0
IPv4 address for eth0: 10.112.67.251
IPv6 address for eth0: fd42:5645:8539:e52d:216:3eff:fe1e:e8cc
0 updates can be applied immediately.
Last login: Sun Aug 27 15:59:44 2023 from 10.112.67.1
uchida@ubuntu:~$ uname -a
Linux ubuntu 6.2.0-27-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 12 22:39:51 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
uchida@ubuntu:~$ cat /etc/os-release
PRETTY_NAME="Ubuntu 23.04"
NAME="Ubuntu"
VERSION_ID="23.04"
VERSION="23.04 (Lunar Lobster)"
VERSION_CODENAME=lunar
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=lunar
LOGO=ubuntu-logo
uchida@ubuntu:~$
操作系统的安装
lxc launch ubuntu:23.04 ubuntu
设置 root 的密码
lxc exec ubuntu -- bash
登录 lù)
$ lxc console ubuntu
To detach from the console, press: <ctrl>+a q
ubuntu login:
登錄後的設置 de
创建用户
adduser --uid 1200 uchida
gpasswd -a uchida sudo
sshd的配置设置
PasswordAuthentication yes
因为 vi 的状态不好,所以用 sed 进行了更改。
s/#PasswordAuthentication/PasswordAuthentication/
sed -f sed01 < sshd_config > tmp01
sudo systemctl restart ssh
创建.ssh/authorized_keys文件
注册客户端的公钥
使用IP地址进行登录。
例如,
ssh 10.112.67.251
如果没有.ssh/authorized_keys文件,将会出现以下错误。
$ ssh 10.112.67.251
uchida@10.112.67.251: Permission denied (publickey).
安装 avahi
sudo apt install avahi-daemon
如果avahi可以运行,可以通过以下方式进行登录。
ssh ubuntu.local
设置时区
sudo timedatectl set-timezone Asia/Tokyo
请提供相关信息。
虚拟机容器清单
lxc list
相关信息
在LXD中使用Arch Linux
在LXD中使用CentOS Stream 9
在LXD中使用Alpine
在LXD中使用Gentoo