6
6

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 5 years have passed since last update.

Hyper-VにさくっとCoreOSをインストールする

Last updated at Posted at 2018-06-07

概要

Windows 10 proのHyper-VにCoreOSをインストールする手順です
CoreOSの勉強を始めたい方にはすぐに構築できる環境になります

事前準備

「アプリと機能」でHyper-Vを有効化しましょう!

手順

  1. CoreOS公式サイトからISOをダウンロード

  2. Hyper-Vマネージャーで「仮想スイッチマネージャ」-「新しい仮想ネットワークスイッチ」-「外部」を作成
    switch-manager.png
    new-switch.png

  3. 「外部ネットワーク」で外部と通信できるNICを選択(すでに選択済みのNICはエラーになります)
    config-switch.png

  4. 新規仮想マシンを作成
    new-machine-1.png

  5. 仮想マシンの世代選択(第2世代はサポートされていない
    new-machine-2.png

  6. メモリの割り当て(最少2GB
    new-machine-3.png

  7. ネットワークの構成(前述で作成した外部ネットワークスイッチを選択
    new-machine-4.png

  8. 仮想ハードディスクの接続(適宜に変更)

  9. インストールオプション(前述でダウンロードしたISOファイルを選択)
    new-machine-5.png

  10. 仮想マシンの設定が完了し、起動してください
    ※ライブCDとして起動している?ため、この時点でローカルディスクにCoreOSがインストールされているわけではない

  11. 仮想マシン起動後、sshログイン用に(core)ユーザパスワードを設定します(勉強用なのでとりあえずパスワードログイン)

    > sudo passwd core
    

※Hyper-Vマネージャーのコンソール画面は使いづらいので、TeraTermなどのターミナルでログインすると楽です
12. ユーザパスワードのハッシュ値を取得
前述で設定したパスワードを再入力するとハッシュ値が表示されるので、それを控えてください

```
> openssl passwd -1
  Password:
  Verifying - Password:
  $1xxxxxxxxxxxxxxxxxxxxx
```
  1. cloud-config.ymlを作成
    cloud-configはインスタンスの初期構成定義ファイルである

    • 先頭行の**#cloud-config**は必須
    • passwdには前述のパスワードハッシュ値を記載
    • write_filesはファイルに書き込みを行ってくれます
    cloud-config.yml
    
    #cloud-config
    hostname: "coreos"
    
    coreos:
      units:
        - name: etcd.service
          command: start
    
    users:
      - name: core
        passwd: $1xxxxxxxxxxxxxxxxxxxxxxx
    
    write_files:
      - path: /etc/resolv.conf
        content: |
            nameserver 8.8.8.8
    
  2. ローカルディスクにCoreOSをインストール(インストールオプション

    > sudo coreos-install -d /dev/sda -V current -c ./cloud-config.yml
    
  3. インストール完了後、仮想マシンを一度シャットダウンし、ISOのマウントを解除して、仮想マシンを再起動してください

  4. 問題なく起動でき、ログインができる場合は成功です!Dockerコマンドが使えるので、思う存分に使ってください

6
6
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
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?