LoginSignup
11
11

More than 5 years have passed since last update.

RaspberryPi2でプライベートクラウド(1) --Ubuntuのインストール--

Posted at

複数のRaspberryPi2(以降はRpi2と表記)でプライベートクラウド環境を構築します。
まずはOSの選択ですが、RaspbianではなくUbuntuを使用します。理由は次回以降に説明します。

・公式サイトに掲載されているUbuntuはそのままでは使いにくいのでこちらのサイトからイメージをダウンロードしてください。最新版は「2015-04-06-ubuntu-trusty.zip」です。

・ダウンロードしたファイルを適当な場所で展開してください。展開したフォルダの中には「2015-04-06-ubuntu-trusty.img」がありますので、このファイルをRaspbianなどと同じようにMicroSDに書き込んでください。

・書き込みが終了したら、Rpi2にMicroSDを挿し変えて電源を入れます。しばらくすると、問題がなければログインプロンプトが表示されます。

・ID:ubuntu/PW:ubuntuでログインできます。

・Raspbianのようにディスク容量を拡張してくれないので手動で拡張します。

console
ubuntu@ubuntu:~$sudo fdisk /dev/mmcblk0
[sudo] password for ubuntu:

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (133120-30965759, default 133120):
Using default value 133120
Last sector, +sectors or +size{K,M,G} (133120-30965759, default 30965759):
Using default value 30965759

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
ubuntu@ubuntu:~$

一旦リブートします。

ログイン後ファイルシステムを拡張します。dfコマンドで拡張されたか確認します。

console
ubuntu@ubuntu:~$ sudo resize2fs /dev/mmcblk0p2
[sudo] password for ubuntu:
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 3854080 blocks long.

ubuntu@ubuntu:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2   15G  521M   14G   4% /
devtmpfs        458M  4.0K  458M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none             93M  268K   93M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            462M     0  462M   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/mmcblk0p1   64M   20M   45M  31% /boot/firmware
ubuntu@ubuntu:~$

・あとはapt-get update,apt-get upgradeを実行してシステムを最新の状態にしておきましょう。

・インストールしたイメージは最小構成なので必要なコマンドなどは適宜インストールしましょう。

・SSHサーバはあった方がいいのでインストールしておきましょう。

console
ubuntu@ubuntu:~$ sudo apt-get install openssh-server

今回はここまでとします。
次回はクラウド環境の構築をしてみたいと思います。

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