[Linux] Arch Linux 2018.08 CUIインストール on VirtualBox 5
environment
環境
- Guest OS
- Arch Linux 2018.08
- Virtualization Software
- VirtualBox5.1.2 for Windows
- Host OS
- Windows 7 64bit
divide partition
archlinux-2018.08.01-x86_64.iso をDownload。
VirtualBoxで設定。
- mem768M
- hdd80G
- audioOFF
- network:NAT
VirtualBox起動。
https://wiki.archlinux.jp/ インストールガイドに従う。
# loadkeys jp106 ← Shift+2 は @ が " になった
# ls /sys/firmware/efi/efivars ←ない
# fdisk -l ← /dev/sda とストレージデバイスを確認
# fdisk /dev/sda
fdisk> Command: o (Create new DOS disklabel)
fdisk> Command: n (New Partition)
fdisk> Partition Type: Enter (Primary)
fdisk> Partition Number: Enter (1)
fdisk> First Sector: Enter
fdisk> Last Sector: +1G
fdisk> Command: t (Change Partition Type)
fdisk> Hex Code: 82 (Partition Type -> 'Linux swap')
fdisk> Command: n (New Partition)
fdisk> Partition Type: Enter (Primary)
fdisk> Partition Number: Enter (2)
fdisk> First Sector: Enter
fdisk> Last Sector: Enter (full)
fdisk> Command: a (Bootable flag)
fdisk> Partition Number: Enter (2)
fdisk> Command: p (Print)
fdisk> Command: w (Write)
# mkfs.ext4 /dev/sda2 ← fdiskのPrintで表示したらわかる
# mkswap /dev/sda1
# swapon /dev/sda1
# mount /dev/sda2 /mnt
# ping archlinux.jp
# vi /etc/pacman.d/mirrorlist
(JapanのURLを最上位にcopy)
# pacstrap /mnt base
(download 241MB install 829MB)
# genfstab -U /mnt >> /mnt/etc/fstab
# cat /mnt/etc/fstab
# arch-chroot /mnt
# ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
# hwclock --systohc --utc
# vi /etc/locale.gen
(en_US.UTF-8 UTF-8 と ja_JP.UTF-8 UTF-8 をアンコメント)
# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# echo KEYMAP=jp106 > /etc/vconsole.conf
# echo archlinux > /etc/hostname
# vi /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 archlinux.localdomain archlinux
# passwd
# pacman -S grub-bios intel-ucode
# grub-install --target=i386-pc /dev/sda ← /dev/sda2 ではない
# grub-mkconfig -o /boot/grub/grub.cfg
# exit
# umount -R /mnt
# shutdown -h now
VirtualBoxのストレージ設定でisoを外す。
network
(login root)
# pacman -S openssh ←エラー
# pacman -Syu ←エラー
# ping archlinux.jp ←ping通らない
# lspci -v | grep -A 10 -i ether →kernel module:e1000
# dmesg | grep e1000 → loadはされてる
# ip link →NIC名は enp0s3
# cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/eth0 ←定義名に「-」は使わない方がいいようだ
# vi /etc/netctl/eth0
Interface=enp0s3
..
# netctl start eth0 →PC電源offまでの設定
# ping archlinux.jp ←ping通らない DNS revolver問題
# ping 8.8.8.8 ←ping通る
# vi /etc/resolv.conf
nameserver 8.8.8.8 ←追加
...
# ping archlinux.jp ←ping通る
# netctl enable eth0 →恒久設定
# pacman -S openssh
# vi /etc/ssh/sshd_config
Port 22
# systemctl enable sshd.service
# useradd -d /home/foo -p foo foo <- adduserはない
# passwd foo <- なぜか必要
# mkdir /home/foo
# chown foo:users /home/foo
# shutdown -h now
[VirtualBoxのネットワーク設定 - NAT - 高度 - PortForwarding]
- hostPort:2222
- guestPort:22
仮想OS起動。 sshクライアント(今回はPuTTY)で localhost:2222 にssh接続。
# pacman -S sudo
# vi /etc/sudoers
foo ALL=(ALL) NOPASSWD: ALL <-そのファイルの設定例に書いてある
$ su -
# pacman -S base-devel
install VirtualBox Guest Addition
VirtualBox Guest Additionインストール。
(成功ルート)
# pacman -Syu ←これをしないと次のvirtualbox-guest-utilsで一部not found
(download 63MB)
# pacman -S virtualbox-guest-utils (← noxつきpkgだとなぜか失敗したようなのでnoxなし)
resolving dependencies...
1) virtualbox-guest-dkms 2) virtualbox-guest-modules-arch
Enter a number (default=1): 2
(ArchWikiでは「linuxカーネルを使用する場合2を選択。他のカーネルを使う場合1を選択」と書いてあり、他のカーネルってWindowsやmacOSのことか?と謎だったが linux-ltsとかlinux-zenパッケージのことだった。linuxという名のカーネルパッケージかそれ以外かということか)
# groupadd vboxsf
groupadd: group 'vboxsf' already exists
$ sudo gpasswd -a $USER vboxsf
$ sudo shutdown -h now
(VirtualBox 共有フォルダー設定 share R:/share)
# mkdir -p /media/sf_share
# chmod -R 777 /media
# mount -t vboxsf share /media/sf_share
# ls /media/sf_share/
$ touch /media/sf_share/test_w.txt
(結局[VirtualBox - Device - GuestAddition挿入]は必要なかった)
(失敗ルート)
(VirtualBox - Device - GuestAddition挿入)
$ sudo mount /dev/cdrom /mnt
$ su -
# cd /mnt; sh ./VBoxLinuxAdditions.run
Failed to set up service vboxadd, please check the log file
# less /var/log/VBoxGuestAdditions.log
vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
# less /var/log/vboxadd-install.log
/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current nux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
# pacman -S linux-headers
not found
# pacman -Syu
(download 63MB)
# pacman -S linux-headers
(download 16MB)
(/lib/modules/4.17.13-arch1-1-ARCH/ → /lib/modules/4.17.14-arch1-1-ARCH/ に変わったので)
# shutdown -h now
$ su -
(VirtualBox - Device - GuestAddition挿入)
$ mount /dev/cdrom /mnt
# cd /mnt; sh ./VBoxLinuxAdditions.run
Failed to set up service vboxadd, please check the log file
# less /var/log/VBoxGuestAdditions.log
vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
# less /var/log/vboxadd-install.log
grep: /lib/modules/4.17.14-arch1-1-ARCH/build/include/linux/version.h: No such file or rectory
# ls /lib/modules/4.17.14-arch1-1-ARCH/build/include/linux/ver*
# ln -s /usr/include/linux/version.h /lib/modules/4.17.14-arch1-1-ARCH/build/include/linux/
Failed to set up service vboxadd, please check the log file
# less /var/log/vboxadd-install.log
make[2]: *** [scripts/Makefile.build:313: /tmp/vbox.0/VBoxGuest-linux.o] Error 1
make[1]: *** [Makefile:1571: _module_/tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile.include.footer:84: vboxguest] Error 2
(Cソースレベルのエラー)




0 件のコメント:
コメントを投稿