Parallels Desktop に ArchLinux をインストール(1)

Parallels Desktop(v10.1.1) に ArchLinux をインストールしてみる。

ArchLinux 公式ページ
ビギナーズ・ガイド

とりあえずベースシステムが起動できるようになるまで。

イメージファイルのダウンロード

ArchLinux のイメージファイル(iso)をダウンロードする。日本のミラーサイトから最新のものをGet。

Parallelsで新規仮想マシンを作成

1)ファイル→新規…(⌘+N)

2)DVD/イメージファイルから・・・を選んで続行
新規仮想マシン
3)手動で探す
手動で探す
4)ダウンロードしたimgファイルを画面にドラッグ&ドロップして続行
イメージファイルの指定
5)OSを検出できませんと表示されるけど続行
続行
6)OSの種類を指定する
「オペレーティングシステムを選択してください」と出てくるので、他のLinux → その他のLinux → OK
OSの指定1
OSの指定2
OSの指定3
7)名前と保存先を指定する
「インストール前に構成をカスタマイズする」に✔︎して続行
保存先
8)仮想マシンの設定画面が出てくるので各種設定

  • 一般
    名前
    説明
  • オプション
    起動と終了
    最適化
    共有
    アプリケーション
    Coherence
    フルスクリーン
    Modality
    詳細
  • ハードウェア
    CPUおよびメモリ
    ブート順序
    ビデオ
    マウスとキーボード
    プリンタ
    CD/DVD
    ハードディスク
    ネットワーク
    プリンタ
    サウンド
    USBとBluethooth
  • セキュリティ

※CPU・メモリをお好きな感じで
CPU・メモリ
※ネットワークの設定で「共有ネットワーク」となっているのを、「ブリッジネットワーク:デフォルトのアダプタ」に変更しておくと、仮想マシンが自分のLAN上に出てくるので、母艦のターミナル.appからSSH接続してセットアップできる
ネットワーク
9)構成の確認→続行
構成の概要
10)イメージファイルからArchLinuxが起動する
Boot Arch Linux (x86_64)が選ばれたままでEnterキー
iso起動画面
11)自動でrootとしてログイン状態になるので、ArchLinuxのインストールを行っていく
iso起動画面2

ゲストOSへのインストール

下準備

Parallels Tools がインストールされていないので、自動でゲストOS画面からマウスを解放してくれない。それにテキストのコピペもできない。
面倒なので、母艦のターミナル.appからssh接続してインストール作業できるようにsshdの起動と、rootパスワードの設定をする。

ParallelsのゲストOS画面でパスワード変更とsshの開始を指示

root@archiso ~ # passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@archiso ~ # systemctl start sshd

ParallelsのゲストOSのIP-Addressを調べてから、母艦のターミナル.appでssh接続

$ ssh root@99.99.99.99
The authenticity of host '99.99.99.99 (99.99.99.99)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '99.99.99.99' (RSA) to the list of known hosts.
root@99.99.99.99's password: 
Last login: Thu Dec 18 09:59:36 2014
root@archiso ~ #

root@archiso ~ # と出れば成功

あとはターミナル.appでコマンドのコピペができて少し幸せ。

インストール

ハードディスクの準備

仮想マシンなのでパーティションは分割せず、1パーティションで。

fdisk /dev/sda
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x1253e3b3.

Command (m for help): p						← p:状態表示
Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x1253e3b3
								← パーティションなし


Command (m for help): n						← n:新規
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):						← Enter 

Using default response p.
Partition number (1-4, default 1): 				← Enter
First sector (2048-134217727, default 2048): 			← Enter
Last sector, +sectors or +size{K,M,G,T,P} (2048-134217727, default 134217727): 	←Enter

Created a new partition 1 of type 'Linux' and of size 64 GiB.

Command (m for help): p						← p:状態表示
Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x1253e3b3

Device     Boot Start       End   Sectors Size Id Type
/dev/sda1        2048 134217727 134215680  64G 83 Linux		← 1パーティション追加


Command (m for help): w						← w:書き込み
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

フォーマット

mkfs.ext4 -b 2048 /dev/sda1
mke2fs 1.42.12 (29-Aug-2014)
Warning: specified blocksize 2048 is less than device physical sectorsize 4096
Creating filesystem with 33553920 2k blocks and 4194304 inodes
Filesystem UUID: e97d9f5a-1752-4fed-9281-da44318fa1d9
Superblock backups stored on blocks: 
	16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104, 
	2048000, 3981312, 5619712, 10240000, 11943936

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
ベースシステムのインストール

追加したパーティションを /mnt にマウント

mount /dev/sda1 /mnt

ミラーサーバーの設定
※ファイル内を”Japan”で検索して、日本のサイトを上に持っていく

vi /etc/pacman.d/mirrorlist
  :
## Score: 18.2, Japan
Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch
  :
## Score: 1.8, Japan
Server = http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/$repo/os/$arch
  :
インストール

マウントされたパーティションに、ベースシステムと基本的なコンパイルツールを流し込む

pacstrap /mnt base base-devel
システムの設定

fstab の設定

genfstab -p /mnt >> /mnt/etc/fstab

インストール先(/mnt)をルートディレクトリとして設定(chroot)

arch-chroot /mnt

ロケールの設定

vi /etc/locale.gen
  :
en_US.UTF-8 UTF-8
  :
ja_JP.UTF-8 UTF-8
  :

en_US.UTF-8 UTF-8ja_JP.UTF-8 UTF-8 を有効化

locale-gen

タイムゾーンの設定

ln -s /usr/share/zoneinfo/Japan /etc/localtime

ホストネームの設定

echo "host-name" > /etc/hostname

rootのパスワードを設定

passwd

ブートローダーのインストール

pacman -S grub
grub-install --recheck /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

ブートローダーの設定ファイルを生成

grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initramfs image: /boot/initramfs-linux-fallback.img
done
再起動後にLAN環境が使えるように、サービスを登録

ssh が使えるように openssh をインストール

pacman -S openssh

サービスの登録

systemctl enable sshd.service
systemctl enable dhcpcd.service

chroot を抜けてディスクのアンマウントとリブート

exit
umount -R /mnt
reboot

ゲストOSが再起動したら、再度ターミナルから ssh 接続して新システムの設定を続ける。

ssh 接続前に母艦の ~/.ssh/know_hosts を編集

vi ~/.ssh/know_hosts

→インストール時に接続した時のip-addressから始まる行(たいていの場合は最終行)を削除

ssh接続

ssh root@99.99.99.99
The authenticity of host '99.99.99.99 (99.99.99.99)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '99.99.99.99' (RSA) to the list of known hosts.
root@99.99.99.99's password: 
[root@arch ~]#

※パスワードは新しく設定したものを。

新システムの初期設定

基本的にODROID-U2用に作ったこちらのメモでいける。”ODROID-U2″と書いてあるのを”ゲストOS”って読み替えればいけるかと。

違う点
1)pacman のミラーリスト(/etc/pacman.d/mirrorlist
   →日本のサイトを上に持ってくる
2)ssh の設定
   →公開鍵認証までする必要はないかも

タグ: , ,
カテゴリー: ArchLinux

コメントを残す