6
4

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.

RancherOSをBoot from ISOした手順

Posted at

背景

個人的なことですが,2016年に,仮想マシンにいろいろなアプリを入れて動作確認をしていました.
いろいろなアプリを簡単に管理するために,RancherOSを使ってみようと思いました.

関連記事

RancherOSの日本語の記事を参考にしました.
【Docker】RancherOSで本格的な自宅サーバーを構築しよう(1) ~ 要件と構成 ~
RancherOSをCDブートで運用

Rancher自体の説明は次のスライドがおもしろかったです.
インフラエンジニアのためのRancherを使ったDocker運用入門

他にもDockerのわかりやすい説明がSlideShareにあり,読ませていただいています.
役に立つ情報を公開されている方々に,感謝しています.

目標

次の状況を目標として環境を作る.

  • VMWare上でRancherOSが動作している
  • ISOからブートとする
  • Rancherの管理画面に普通のブラウザからアクセスできる

バージョン等

VMWare

VMWare Fusion 8.1.1を使っています.

RancherOS

次のアドレスから2017年1月3日にダウンロードしたもの(v0.7.1, md5=eb58ac4958cf66bb9c2675cd7e565419)
https://releases.rancher.com/os/latest/rancheros.iso

その他

docker pull的なものによってダウンロードされたデータもあるでしょうがこの日の前後に作業をしました.

手順

1. VMWareの設定

仮想マシンは次のようなところを設定しました.

メモリ 4,096MB
ネットワークアダプタ 自動検出
CD/DVD rancheros.iso
起動ディスク CD/DVD
ハードディスクバスタイプ IDE
ハードディスクサイズ 20GB

2. ファイルシステムの作成

ISOからブートだと何もしないとHDDを使ってくれないため,アプリのインストール時に容量不足が発生しました.そこで,HDDを使ってくれるような設定をします.
次のように入力します(1行目でパーティション作成,2行目で再起動).

sudo mkfs.ext4 -L B2D_STATE /dev/sda
sudo reboot

注意

ドキュメントには次のように書いてあります.ここではパーティションのラベルをRANCHER_STATEにするようにと書いてあります.私の場合はRANCHER_STATEとしてもだめでしたが,B2D_STATEとしたところ,うまくできました.

If you are running from the ISO, RancherOS will be running from memory. All downloaded Docker images, for example, will be stored in a ramdisk and will be lost after the server is rebooted. You can create a file system with the label RANCHER_STATE to instruct RancherOS to use that partition to store state.

再起動時に次のメッセージが表示されれば設定は成功です.

INFO[0000] Mounting state device /dev/sda to /state

また,_という文字はUS配列ではShift + -で入力できました.

3. ターミナルから入る

普段使っているターミナルから操作できるように,sshの設定を行いました.

ssh_configの編集

/etc/ssh/ssh_configの25行目に次の行があるので,先頭の#記号を削除する.

#   PasswordAuthentication yes

パスワードの設定

次のように入力してパスワードを設定します.

[rancher@rancher ~]$ sudo passwd rancher
Changing password for rancher
New password: (rancherと入力)
Bad password: similar to username
Retype password: (rancherと入力)
passwd: password for rancher changed by root
[rancher@rancher ~]$

ターミナルから接続

私は普段sshコマンドで接続しますので,次のようにします.

$ ssh (IPアドレス) -l rancher
The authenticity of host '(IPアドレス)' can't be established.
ECDSA key fingerprint is (略).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '(IPアドレス)' (ECDSA) to the list of known hosts.
rancher@(IPアドレス)'s password: (rancherと入力)
[rancher@rancher ~]$ 

5. rancher/serverを起動

次のコマンドで起動できます.

docker run -d -p 8080:8080 rancher/server

6. Rancher画面を表示

しばらくしたら,ブラウザのアドレス欄に次のように入力し,Rancherの画面が表示されることを確認します.

http://(IPアドレス):8080/
6
4
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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?