Conoha VPSへは下記の手順でFedora CoreOSをインストールしています。
Fedora CoreOSのインストールには最低2GBのメモリが必要です。
インストール終了後は1GBのメモリにプラン変更しても動作させることが可能です。
ConoHa VPSにはFedora CoreOSのイメージタイプは存在しませんので、ISOイメージを使用してのインストールになります。
そのため、イメージタイプは任意で構わないのですが、ここではOS:Arch Linuxを選択することにします。
契約したインストールサーバーはシャットダウンしておきます。
ConoHa VPSではSSL化されたサーバーからインストール用のISOイメージをダウンロードすることができません。
Fedora CoreOSのダウンロードサイトはSSL化されていますので、一時的にISO配信用サーバーを準備します。
ConoHa VPSでメモリ512MBのLAMP(PHP)イメージのサーバーを一時的に契約して、Fedora CoreOSのインストール後に解約することにします。
契約したISO配信用サーバーにSSH(rootユーザー、パスワード認証)でログインして、Fedora CoreOSのダウンロードページから最新バージョンのISOイメージを取得します。
1 2 3 |
cd /var/www/html JSON=https: //builds .coreos.fedoraproject.org /streams/stable .json curl $(curl $JSON | sed - ne '/location.*-live.x86_64\.iso/p' | cut -d '"' -f 4) > fedora-coreos-live.iso |
インストールサーバーで作業するためにSSHログイン用の鍵ペアを作成します。
1 |
ssh -keygen -t ed25519 |
2 3 4 5 6 |
Generating public/private ed25519 key pair. Enter file in which to save the key (/root/.ssh/id_ed25519): /var/www/html/ed25519 Enter passphrase (empty for no passphrase): [パスフレーズ] Enter same passphrase again: [パスフレーズ] : |
ISO配信用サーバーでConoHa VPSのISOインストール用ツールconoha-isoを使用してFedora CoreOSをインストールします。
conoha-isoのダウンロードおよび実行用環境変数を設定します。
実行用環境変数の設定する内容はConoHa VPSのコントロールパネル➡APIで確認できます。
1 2 3 4 5 6 7 |
cd /tmp URL=https: //github .com /hironobu-s/conoha-iso/releases/download/current curl -sL $URL /conoha-iso-linux .amd64.gz | zcat > conoha-iso && chmod +x . /conoha-iso export OS_TENANT_ID=[API情報(テナントID)] export OS_REGION=tyo1 export OS_USERNAME=[APIユーザー名] export OS_PASSWORD=[APIユーザーパスワード] |
ConoHa VPSにISO配信用サーバーのISOイメージをダウンロードします。
1 2 |
INFO[...] Download request was accepted. |
ダウンロードの終了を確認します。
1 |
. /conoha-iso list |
2 3 4 5 6 7 |
[Image1] Name: fedora-coreos-live.iso Path: /mnt/isos/repos/tenant_iso_data/.../fedora-coreos-live.iso Ctime: ... Size: ... |
ConoHa VPSにダウンロードしたISOイメージをマウントします。
1 |
. /conoha-iso insert |
2 3 4 5 6 7 |
[1] server1 (...) Please select VPS [1]: 1 [1] fedora-coreos-live.iso Please select ISO [1]: 1 INFO[...] ISO file was inserted and changed boot device. |
ConoHa VPSのコントロールパネルからインストールするサーバーを起動します。
ConoHa VPSのサーバーコンソールではキーマップがUS仕様であったり、auditログが流れたりと作業がしづらいので、RLogin等のSSHクライアントからログインできるように準備します。
1 2 3 |
mkdir . ssh '' chmod 700 . ssh '' cd . ssh curl http+ // [ISO配信サーバーIP] /ed25519 .pub > authorized=keys chmod 600 authorized=keys |
インストールサーバーにSSH(coreユーザー、鍵認証(ISO配信用サーバーで作成した秘密鍵を使用))でログインして、インストールディスクの初期化を行います。
1 |
sudo fdisk /dev/vda |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
: Command (m for help): p : /dev/vda1 ... BIOS boot /dev/vda2 ... EFI System Command (m for help): d Partition number (1,2, default 2): [Enter] Partition 2 has been deleted. Command (m for help): d Selected partition 1 Partition 1 has been deleted. Command (m for help): wq : |
インストールに使用するFedora CoreOSの構成ファイルconfig.yamlを準備して、SFTPやSCPでインストールするConoHa VPSサーバーに転送します。
構成ファイルの変換ツールFedora CoreOS Config Transpiler(fcct)を使用してYAML形式の構成ファイルをJSON形式に変換します。
1 2 3 4 5 |
URL=https: //github .com /coreos/fcct/releases/download VER=v0.6.0 curl -L $URL/$VER /fcct-x86_64-unknown-linux-gnu > fcct chmod +x fcct . /fcct --input config.yaml --output config.ign |
Fedora CoreOSのインストールを実行します。
1 |
sudo coreos-installer install /dev/vda --ignition config.ign |
2 3 4 5 |
: Writing Ignition config Install complete. |
6 |
sudo poweroff |
ConoHa VPSのISOイメージをアンマウントします。
1 |
. /conoha-iso eject |
2 3 4 |
[1] server1 (...) Please select VPS [1]: 1 INFO[...] ISO file was ejected. |
ConoHa VPSのコントロールパネルからFedora Coreサーバーを起動します。