VirtualBox に Debia8 を入れる のバックアップ(No.1)

更新


公開メモ/電気回路/z-turn?

VirtualBox に Debian8 を新規インストール

z-turn での開発に Linux 環境が必要だったので、64bit Windows 10 上の Oracle VM VirtualBox に 32bit の Debian8 (Jessie) をインストールします。

Zynq 用の arm バイナリをコンパイルするのに 32 ビットライブラリが必要という情報があるようで、 たぶんコンパイル環境も 32 ビットのほうが都合が良いのかと思ったためです。

VirtualBox の作成

VirtualBox マネージャの [新規] から、Debian8new という 32bit Debian の VM を作成します。

virtualbox-new.png

  • メモリ4G
  • VDI形式の仮想ハードディスク可変型20G

としました。

Debian8 インストールディスクのダウンロード&マウント

https://www.debian.org/CD/netinst/

の i386 というリンクから、debian-8.7.1-i386-netinst.iso をダウンロード。

VirtualBox "Debian8new" を右クリックし、[設定] から [ストレージ] の [光学ディスクファイルを選択...] で上記 .iso ファイルをマウント

virtualbox-mount-iso.png

ネットワークの設定

ホスト PC の Windows10 と、VirtualBox 内の Debian8 との間で通信を可能にするため ネットワークアダプタを追加します。

virtualbox-hostonly-adapter.png

起動&インストール

virtualbox-run.png

  1. [Install]
  2. Select Language => [Japanese]
  3. 場所の選択 => [日本]
  4. キーボードの設定 => [日本語]
  5. ネットワークの設定
    • プライマリアダプタ => [eth0] (NATアダプタ)
    • ホスト名 => [debian8new]
    • ドメイン名 => []
  6. root のパスワード => [********]
  7. 新しいユーザー
    • 本名 => [Osamu Takeuchi]
    • ユーザ名 => [osamu]
    • パスワード => [********]
  8. パーティショニング => [ディスク全体を使う] - [return] x 3 - [はい]
  9. アーカイブミラー => [日本]-[ftp.tsukuba.wide.ad.jp]-[]
  10. パッケージ利用調査に参加しますか => [はい]
  11. ソフトウェアの選択 => [SSHサーバ + 標準システムユーティリティ]
  12. GRUB ブートローダのインストール => [はい]-[/dev/sda]
  13. インストールの完了

vivado は Windows 上で使うつもりで、デスクトップ環境は入れませんでした。

インストールCDがアンマウントされていることを確認して続行すると再起動されます。

virtualbox-confirm-unmounted.png

ログイン&必須パッケージのインストール

etckeeper, sudo, jed の導入

自動再起動後、コンソールからログインできることを確認し、

virtualbox-login.png

  • /etc フォルダのバージョン管理をするため etckeeper を入れます。
  • 設定ファイルの編集用に sudo および jed エディタを入れます。
  • sudo グループに自分を追加します
LANG:console
$ export LANG=C
$ su
 Password: (rootパスワードを入力)
# export LANG=C
# apt install etckeeper
 The following extra packages will be installed:
   git git-man liberror-perl rsync
 Suggested packages:
   sudo git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui
   gitk gitweb git-arch git-cvs git-mediawiki git-svn
 The following NEW packages will be installed:
   etckeeper git git-man liberror-perl rsync
 0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
 Need to get 5065 kB of archives.
 After this operation, 26.7 MB of additional disk space will be used.
 Do you want to continue? [Y/n]
 ...
# apt install sudo jed
 The following extra packages will be installed:
   jed-common libonig2 libslang2-modules slsh
 Suggested packages:
   gpm
 The following NEW packages will be installed:
   jed jed-common libonig2 libslang2-modules slsh sudo
 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
 Need to get 1892 kB of archives.
 After this operation, 5984 kB of additional disk space will be used.
 Do you want to continue? [Y/n]
 ...
# adduser osamu sudo
 Adding user `osamu' to group `sudo' ...
 Adding user osamu to group sudo
 Done
# exit
$ sudo echo ok
 
 We trust you have received the usual lecture from the local System
 Administrator. It usually boils down to these three things:

     #1) Respect the privacy of others.
     #2) Think before you type.
     #3) With great power comes great responsibility.

 [sudo] password for osamu:
 osamu is not in the sudoers file.  This incident will be reported.
$ groups
 osamu cdrom floppy audio dip video plugdev netdev bluetooth
$ groups osamu
 osamu: osamu cdrom floppy sudo audio dip video plugdev netdev bluetooth
$ exit

一旦ログインしなおさないと、グループ設定は反映されないみたいだったので、 exit してログインしなおしました。

sshd on eth1

以下、再ログイン後、

LANG:console
$ export LANG=C
$ groups
 osamu cdrom floppy sudo audio dip video plugdev netdev bluetooth
$ sudo ifconfig
 [sudo] password for osamu:
 eth0     ...
          ...

 lo       ...
          ...

$ sudo jed /etc/network/interfaces
 + allow-hotplug eth1
 + iface eth1_inet dhcp
$ sudo service networking restart
$ sudo service networking restart  # なぜか2回必要?
$ sudo ifconfig eth1
 eth1     ...
          inet addr:192.168.56.103
          ...

これでホスト PC から 192.168.56.103 というアドレスへ ssh 接続が可能になった

以下、PuTTY で ssh 接続して手順を続行します。


Counter: 4703 (from 2010/06/03), today: 1, yesterday: 1