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?

More than 1 year has passed since last update.

VyOS を ESXi へインストール & 仮想マシンのコピー

0
Last updated at Posted at 2023-06-18

ー ダウンロード
image.png
Rolling Release をクリックすると iso イメージへのリンクがあり (問題が無ければ) 日々リリースされています。ここから最新の物をダウンロード。(たまに起動できない物もあるので、そういう場合は数日前のものでリトライしてください)

  • ESXi へインストール
    image.png
    「仮想マシンの作成/登録」を選択
    image.png
    VyOS は Debian ベースのため、Debian を選択。
    image.png
    ストレージは私の環境では一つしか無いのでそのまま「次へ」
    image.png

VyOS On VMware によると、推奨は CPU 1コア、メモリ 1GB、ストレージ 10GB ということなので、CPU のみ 4個にしてあとは推奨で。
インストールは ISO イメージなので、アップロードする。
image.png
左上の「アップロード」をクリックし、ISO ファイルを選択 (アップロード)。アップロードが完了すると ISO ファイルが表示されるので選択。
image.png
次へ。
image.png
確認画面が表示されるので「完了」
image.png
仮想マシンが登録されるので「パワーオン」で起動。
image.png
起動開始。ログイン画面が表示されたらユーザ名、パスワードとも vyos でログイン。

vyos のインストール

vyos@vyos:~$ install image
Welcome to the VyOS install program.  This script
will walk you through the process of installing the
VyOS image to a local hard drive.
Would you like to continue? (Yes/No) [Yes]: ⏎
Probing drives: OK
Looking for pre-existing RAID groups...none found.
The VyOS image will require a minimum 1000MB root.
Would you like me to try to partition a drive automatically
or would you rather partition it manually with parted?  If
you have already setup your partitions, you may skip this step

Partition (Auto/Parted/Skip) [Auto]:⏎

I found the following drives on your system:
 sda    10737MB

Install the image on? [sda]:⏎

This will destroy all data on /dev/sda.
Continue? (Yes/No) [No]: Yes

Looking for pre-existing RAID groups...none found.
How big of a root partition should I create? (2000MB - 10737MB) [10733MB]:⏎

Creating filesystem on /dev/sda1: |[  302.718178] critical target error, dev sda, sector 20971392 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio 
class 2
OK
Done!
Mounting /dev/sda1...
What would you like to name this image? [vyos-1.4-rolling-202306180317]:⏎
OK.  This image will be named: vyos-1.4-rolling-202306180317
Copying squashfs image...
Copying kernel and initrd images...
Done!
I found the following configuration files:
    /opt/vyatta/etc/config/config.boot
    /opt/vyatta/etc/config.boot.default
Which one should I copy to sda? [/opt/vyatta/etc/config/config.boot]:⏎

Copying /opt/vyatta/etc/config/config.boot to sda.
Enter password for administrator account
Enter password for user 'vyos':
Retype password for user 'vyos':
I need to install the GRUB boot loader.
I found the following drives on your system:
 sda    10737MB

Which drive should GRUB modify the boot partition on? [sda]:⏎

Setting up grub: OK
Done! Please reboot now.
vyos@vyos:~$ sudo su -
root@vyos:~$ shutdown -r now

で再起動。 (ISO ファイルはアンマウントする)

  • ssh を有効化
    ホスト名、ドメイン名を設定、
    eth0 を DHCP
vyos@vyos:~$ configure
[edit]
vyos@vyos# set system host-name vyos-1
[edit]
vyos@vyos# set system domain-name home.my
[edit]
vyos@vyos# set interfaces ethernet eth0 description DHCP
[edit]
vyos@vyos# set interfaces ethernet eth0 address dhcp
[edit]
vyos@vyos# set service ssh
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos# exit
exit
vyos@vyos-01:~$ ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 192.168.0.101/24 brd 192.168.0.255 scope global dynamic eth0
       valid_lft 3026sec preferred_lft 3026sec
  • ntp の設定
    タイムゾーン、ntp の設定を修正
    デフォルトで time○.vyos.net が入っているので削除する。
vyos@vyos-01:~$ show configuration
....
service {
    ntp {
        allow-client {
            address 0.0.0.0/0
            address ::/0
        }
        server time1.vyos.net {
        }
        server time2.vyos.net {
        }
        server time3.vyos.net {
        }
    }
    ssh {
    }
}
....
vyos@vyos-01:~$

vyos@vyos-01:~$ configure
[edit]
vyos@vyos-01# set system time-zone Asia/Tokyo
[edit]
vyos@vyos-01# delete service ntp server time1.vyos.net
[edit]
vyos@vyos-01# delete service ntp server time2.vyos.net
[edit]
vyos@vyos-01# delete service ntp server time3.vyos.net
[edit]
vyos@vyos-01# set service ntp server ntp.nict.jp
[edit]
vyos@vyos-01# commit
[edit]
vyos@vyos-01# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos-01# exit
exit
vyos@vyos-01:~$
  • これをテンプレートとして ESXi の中に用意する

一旦シャットダウンする

vyos@vyos-01:~$ poweroff
Are you sure you want to poweroff this system? [y/N] y

Broadcast message from root@debian on pts/1 (Mon 2023-06-19 02:05:01 JST):

The system will power off now!

image.png
データストアブラウザを開きます

image.png
「ディレクトリの作成」で、「テンプレート」ディレクトリを作成します

image.png
VyOS のディスクを右クリックして (~.vmx) をコピー

image.png
テンプレートの下へコピー

image.png
~.vmdk も同様にコピーします

image.png
テンプレートの下へコピー

-コピーしたディスクで新たにインストール
コピー先のディレクトリを作成し、コピーしたディスクを (~.vmdk, ~.vmx の2つとも) コピーする。
image.png
コピー元のファイルを右クリックしてコピー

image.png
新しいディレクトリに 2つのファイルをコピー

  • テンプレートから仮想マシンを作成
    image.png
    ~.vmx を右クリックして「仮想マシンの登録」を選択

image.png
仮想マシンが登録された。ホスト名や、CPU、メモリなどを編集して、マシンを起動。

image.png
テンプレートをコピーしたので「コピーしました」を選択。

image.png
ホスト名が VyOS-01 のまま起動。
テンプレートはテンプレートっぽい設定で保存するべきでしたね。既存の 01 と、コピーした 01 (新 02) のマシンの区別がつきにくい。

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?