0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

lxdcliを用いてLXD上で構築したubuntuの基本設定を行う

Last updated at Posted at 2023-09-05

目的

ubuntuを用いて検証を行いたい時にさくっとubuntuを立ち上げるときの設定

ファイル構成

  • lxdfile

ファイル

lxdfile

CONTAINERNAME ubuntu-base
FROM local:ubuntu/22.04


RUN export DEBIAN_FRONTEND=noninteractive
RUN timedatectl set-timezone Asia/Tokyo && hostnamectl set-hostname ubuntu-base
RUN apt-get -y update

RUN dpkg --configure -a
RUN echo "\n\n\n" | apt-get -y install openssh-server

RUN echo -e "root:password" | chpasswd
RUN echo -e 'PermitRootLogin  yes' >> /etc/ssh/sshd_config
RUN echo -e 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
RUN echo -e 'PubkeyAuthentication no' >> /etc/ssh/sshd_config
RUN rm /etc/ssh/ssh_config.d/60-cloudimg-settings.conf

RUN systemctl enable ssh
RUN systemctl restart ssh
RUN systemctl start ssh

NUMBER 10

ビルド

# lxdcli build lxdfile

確認

+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
|     NAME      |  STATE  |         IPV4         |                     IPV6                      |   TYPE    | SNAPSHOTS |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| alma-lamp     | RUNNING | 10.107.73.254 (eth0) | fd42:d70a:2761:a81b:216:3eff:feeb:4939 (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base   | RUNNING | 10.107.73.143 (eth0) | fd42:d70a:2761:a81b:216:3eff:fe59:ba70 (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-0 | RUNNING | 10.107.73.178 (eth0) | fd42:d70a:2761:a81b:216:3eff:fe17:73fe (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-1 | RUNNING | 10.107.73.216 (eth0) | fd42:d70a:2761:a81b:216:3eff:fe56:24eb (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-2 | RUNNING | 10.107.73.108 (eth0) | fd42:d70a:2761:a81b:216:3eff:fe50:b7ae (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-3 | RUNNING | 10.107.73.40 (eth0)  | fd42:d70a:2761:a81b:216:3eff:fe07:957f (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-4 | RUNNING | 10.107.73.46 (eth0)  | fd42:d70a:2761:a81b:216:3eff:fea3:22bb (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-5 | RUNNING | 10.107.73.66 (eth0)  | fd42:d70a:2761:a81b:216:3eff:fe8a:beaa (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-6 | RUNNING | 10.107.73.174 (eth0) | fd42:d70a:2761:a81b:216:3eff:fec4:f003 (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-7 | RUNNING | 10.107.73.161 (eth0) | fd42:d70a:2761:a81b:216:3eff:fe90:7b18 (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-8 | RUNNING | 10.107.73.94 (eth0)  | fd42:d70a:2761:a81b:216:3eff:fed0:adb7 (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-base-9 | RUNNING | 10.107.73.119 (eth0) | fd42:d70a:2761:a81b:216:3eff:fe87:1256 (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| ubuntu-lamp   | RUNNING | 10.107.73.209 (eth0) | fd42:d70a:2761:a81b:216:3eff:fef1:ff3b (eth0) | CONTAINER | 0         |
+---------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?