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

Hands-on : Windows VirtualBox + Ubuntu 18.04 + Docker + TensorFlow

Last updated at Posted at 2018-07-15

概要

ハンズオン用にTensorFlow環境をセットアップします。

#VirtualBoxのインストール
Oracle VirtualBoxダウンロードサイト
http://www.oracle.com/technetwork/server-storage/virtualbox/downloads
最新版(本記事作成時は5.2.12)をインストールしてください。
https://download.virtualbox.org/virtualbox/5.2.12/VirtualBox-5.2.12-122591-Win.exe [108MB]

Ubuntuのダウンロード

https://www.ubuntu.com/download/desktop
最新Desktop版をダウンロードしましょう。
ubuntu-18.04-desktop-amd64.iso [1.78GB]

Ubuntuのインストール

  • VirtualBoxの起動
  • 新規
  • 名前:ubuntu-18.04-desktop-amd64
  • メモリ1024MB:作成
  • ストレージ10GB:作成
  • ubuntu-18.04-desktop-amd64を選択
  • 設定(Ctrl+S)
  • ストレージ
  • CDアイコンを選択
  • 光学ドライブ(D):IDE セカンダリマスター横のCDアイコン
  • 仮想光学デスクファイルを選択で、ubuntu-18.04-desktop-amd64.isoを選択
  • OK
  • ネットワーク
  • アダプター 2
  • ネットワークアダプターを有効化をチェック
  • 割り当て:ホストオンリーアダプター
  • OK
  • ubuntu-18.04-desktop-amd64を起動
  • インストール言語に日本語を選択
  • Ubuntuをインストール
  • キーボードレイアウト:続ける
  • アップデートと他のソフトウェア:「最小インストール」「その他のオプションのグラフィックスとWi-Fiハードウェアと・・・」をチェックし、続けるボタン押下
  • インストールの種類:デスクを削除してUbuntuをインストールを選択し、インストールボタン押下
  • デスクに変更を書き込みますか?:続ける
  • どこに住んでいますか?:続ける
  • インストール:あなたの情報を入力してください:続けるボタン押下。
  • 今すぐ再起動する。
  • Please remove the installation medium, then press ENTER:ENTER

※VM:ubuntu-18.04-desktop-amd64のサイズ[5.42GB]

UbuntuのCUI起動設定

Ubuntu Desktopをインストールしましたが、軽量化するためCUI起動に切り替えます。

  • ログイン
  • アプリケーションアイコンを押下
  • 検索窓からterminalを起動
  • CUI起動設定
$ sudo systemctl set-default multi-user.target
[sud] XXX のパスワード:
Created symlink /etc/systemd/system/default.target →/lib/systemd/system/multi.user.target.
$
  • sshdのインストール

あわせて、sshdのセットアップも済ませておきます。

$ sudo apt -y install openssh-server
$ sudo reboot

パッケージ更新

TeraTerm等のターミナルソフトを使用しsshログイン、パッケージを最新のものにアップデートしてください。

$ sudo apt -y update
$ sudo apt -y upgrade

※VM:ubuntu-18.04-desktop-amd64のサイズ[6.65GB]

dockerのインストール

$ sudo apt -y install docker.io

docker hello-worldを試します。

$ sudo docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
...
Hello from Docker!
...

TensorFlowのインストール

TensorFlowをDockerで起動します

$ sudo docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3

ブラウザから、ホストオンリーアダプターのIPアドレスについて指定されたトークンを使用し、JupyterNotebookを起動します。

http://192.168.56.101:8888/?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

最後に、TensorFlowでHello worldできたらインストール成功です。

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Hello, TensorFlow!

※VM:ubuntu-18.04-desktop-amd64のサイズ[7.83GB]

お疲れさまでした。

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?