6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Arch LinuxAdvent Calendar 2015

Day 7

Arch Linuxを1GB DISKにVirtualbox込みでインストール

Last updated at Posted at 2015-12-06

この記事はArch Linux Advent Calender 2015の7日目です。

ssh接続できるようにする
passwd
systemctl start sshd
DISKフォーマット
mkfs.btrfs /dev/sda1 -f
mount -o compress=zlib /dev/sda1 /mnt
#mount -o compress=lzo /dev/sda1 /mnt
/etc/pacman.d/mirrorlist(先頭に記述)
Server = http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/$repo/os/$arch
パッケージインストール
pacstrap /mnt base grub-bios openssh btrfs-progs

virtualbox用

パッケージインストール
pacstrap /mnt mesa qt4 xorg-xauth sudo otf-ipafont
arch-chroot /mnt pacman -Scc

pacstrap /mnt virtualbox virtualbox-guest-utils
/mnt/etc/modules-load.d/virtualbox.conf
vboxdrv
vboxnetadp
vboxnetflt
vboxpci

chroot

chroot
arch-chroot /mnt /bin/bash
chroot環境
# キャッシュのクリア
pacman -Scc

# ブートローダーの設定
mkinitcpio -p linux
grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

# sshdでX転送を許可
systemctl enable sshd
sed -i -e 's/#X11Forwarding no/X11Forwarding yes/' /etc/ssh/sshd_config

# ユーザの作成
useradd -m vagrant
passwd vagrant
usermod -aG wheel vagrant 
usermod -aG vboxusers vagrant

# locale
sed -i -e 's/#ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
echo 'LANG="ja_JP.UTF-8"' > /etc/locale.conf

# ネットワーク設定
sed 's/eth0/enp0s3/' /etc/netctl/examples/ethernet-dhcp > /etc/netctl/enp0s3
netctl enable enp0s3
virtualbox用
systemctl enable vboxservice
chrootを抜ける
exit

ssh鍵の設置

  • /mnt/root/.ssh/authorized_keys をパーミッション600で設置しておく。

fstab生成

fstab生成
genfstab -U -p /mnt >> /mnt/etc/fstab
再圧縮
btrfs filesystem defragment -r -czlib /mnt
#btrfs filesystem defragment -r -clzo /mnt
  • これで disk: 692M, mem: 15M
再起動
reboot

再起動後の設定

rootでログイン
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
timedatectl set-timezone Asia/Tokyo

まとめ

  • archlinuxは最小構成を作りやすく、勉強にもなって良いですね。
6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?