Install archlinux on VirtualBox

archlinuxをインストールして、Xを起動するまでの作業メモ

基本的には、Installation guide - ArchWikiで書かれている内容のままです~

Pre-installation

enable efi mode

# loadkeys jp106

Verify the boot mode

# ls /sys/firmware/efi/efivars

Connect to the Internet

# ping -c 3 www.archlinux.org

Update the system clock

# timedatectl set-ntp true

以下のコマンドで、設定内容を確認できます~

# timedatectl status

Partition the disks

# cgdisk /dev/sda

適当にパーティションを作成

たとえば。。。

 

 

Format the partitions

# mkfs.vfat -F32 /dev/sda1

# mkfs.ext4 /dev/sda2

Mount the file systems

# mount /dev/sda2 /mnt

# mkdir /mnt/boot

# mount /dev/sda1 /mnt/boot

Installation 

Select the mirrors

# vim /etc/pacman.d/mirrorlist

## 2yy で2行コピー
## P でペースト
## ^ で行頭に移動
## gg でファイルの先頭に移動

# pacman -Syy

Install the base packages

# pacstrap /mnt base base-devel

Configure the system

Fstab

# genfstab -U /mnt >> /mnt/etc/fstab

Chroot

# arch-chroot /mnt

Time zone

# ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

# hwclock --systohc

Locale

# vi /etc/locale.gen

## Uncomment en_US.UTF-8 UTF-8 and ja_JP.UTF-8 UTF-8

 

# locale-gen

 

# vi /etc/locale.conf

--------------------------------------------------
LANG=en_US.UTF-8
--------------------------------------------------

 

# vi /etc/vconsole.conf

--------------------------------------------------
KEYMAP=jp106
--------------------------------------------------

Hostname

# echo {hostname} > /etc/hostname

 

# vi /etc/hosts
--------------------------------------------------
127.0.0.1 localhost.localdomain localhost}
::1 localhost.localdomain localhost}
127.0.0.1 {hostname}.localdomain {hostname}
--------------------------------------------------

Network configuration

# systemctl enbale dhcpcd  

Root password

# passwd
New password: {新しいパスワードを入力}
Retype new password: {新しいパスワードを再入力}

Boot loader

# pacman -S grub dosfstools efibootmgr
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck
# grub-mkconfig -o /boot/grub/grub.cfg
# mkdir /boot/EFI/boot
# cp /boot/EFI/arch_grub/grubx64.efi /boot/EFI/boot/bootx64.efi

Reboot

# exit
# umount -R /mnt
# reboot 

 ただし、rebootしちゃうとインストールディスクを抜くタイミングがなくなるんで、

# shutdown now

してインストールディスクを抜いてから起動した方がいいかな?

System administration

Users and groups

# useradd -m -G wheel -s /bin/bash {user name}
# passwd {user name} 

Privilege escalation

# visudo
--------------------------------------------------
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
--------------------------------------------------

Package management

yaourt

$ sudo vi /etc/pacman.conf
--------------------------------------------------
#[testing]
#Include = /etc/pacman.d/mirrorlist

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
--------------------------------------------------

 

$ sudo pacman -Syy yaourt

VirtualBox guest additions

Install the Guest Additions

$ sudo pacman -S virtualbox-guest-utils
:: THere are 2 providers available for VIRTUALBOX-GUEST-MODULES:
:: REpository community
1) virtualbox-guest-dkms 2) virtualbox-guest-modules-arch

Enter a number (default=1): 2 <= 2 を選択する

Load the Virtualbox kernel modules

$ sudo modprobe -a vboxguest vboxsf vboxvideo

GUI(Xorg)

Xorg

$ sudo pacman -S xorg-server xorg-server-utils xorg-xinit xterm
$ startx

f:id:o_masaaki:20170124131744p:plain

Xの起動を確認できたら、Xを抜ける

$ exit

  

あとは、awesome - ArchWikiなり、xmonad - ArchWikiなり入れてけばいっかな?