Virtualbox 下安装 Arch Linux

Archlinux installation guide
https://wiki.archlinux.org/index.php/Installation_guide

Pre-installation

分区

$ fdisk /dev/sda

boot

> n
> return (default primary)
> return (default partition 1)
> return (default first sector)
> +250M

swap

> n
> return (default primary)
> return (default partition 2)
> return (default first sector)
> +2G

/

> n
> return (default primary)
> return (default partition 3)
> return (default first sector)
> +2G
> return

/home

> n
> p (make primary)
> return (default first sector)
> return (default last sector)

make /dev/sda1 bootable

> a
> 1

make /dev/sda1 to swap type partition

> t
> 2
> 82

write table to disk and exit fdisk

> w

格式化分区

format partitions

$ mkfs.ext4 /dev/sda1
$ mkfs.ext4 /dev/sda3
$ mkfs.ext4 /dev/sda4

make swap

$ mkswap /dev/sda2

mount swap

$ swapon /dev/sda2

加载分区

$ mount /dev/sda3 /mnt
$ cd /mnt
$ mkdir boot home
$ mount /dev/sda1 boot
$ mount /dev/sda4 home
$ cd /

安装

检测最快的镜像地址

rankmirrors to make this faster (though it takes a while)

mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
rankmirrors -n 6 /etc/pacman.d/mirrorlist.orig \>/etc/pacman.d/mirrorlist
pacman -Syy

安装系统

# install base packages (take a coffee break if you have slow internet)
pacstrap /mnt base base-devel

设置系统

Generate an fstab file

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

Change root into the new system

$ arch-chroot /mnt

Set the hostname

$ echo [archlinux] > /etc/hostname

Set the time zone

$ ln -sf /usr/share/zoneinfo/Australia/Sydney /etc/localtime

uncomment the needed locales in /etc/locale.gen, then generate them with

$ locale-gen

Set locale preferences in /etc/locale.conf and possibly $HOME/.config/locale.conf

$ echo LANG=en_US.UTF-8 > /etc/locale.conf

Set the root password (root account ,not your account, we will create that later)

$ passwd

安装 bootloader

$ pacman -S grub-bios
$ grub-install /dev/sda

Create a new initial RAM disk

$ mkinitcpio -p linux
$ grub-mkconfig -o /boot/grub/grub.cfg
$ exit

卸载分区并重启

$ umount /mnt/home
$ umount /mnt/boot
$ umout /mnt
$ reboot

Until not, we finish installing archlinux, then we are going to setup the system.

Post-installation

重启后,需要手动获取下 ip 地址

$ dhcpcd

每次系统启动时,自动加载此命令

$ systemctl enable dhcpcd

允许安装 32 位程序

$ vi /etc/pacman.conf

uncomment

[multilib](#)
Include = /etc/pacman.d/mirrorlist

update packages

$ pacman -Syy
$ pacman -Su

install x environment

$ pacman -S xorg-server xorg-xinit xorg-server-utils

intall mesa for 3d

$ pacman -S mesa

install virtualbox guest packages

$ pacman -S virtualbox-guest-utils
$ modprobe -a vboxguest vboxsf vboxvideo

create
$ vi /etc/modules-load.d/virtualbox.conf

add

vboxguest
vboxsf
vboxvideo
$ reboot
$ pacman -S xorg-twm xorg-xclock xterm
$ startx

create user to login

$ useradd -m -g users -G storage,power,wheel -s /bin/bash jma
$ passwd jma
$ visudo

allow user to run sudo command

find

Uncomment to allow members of group wheel to execute any command

and uncomment

%wheel ALL=(ALL) ALL

    原文作者:sthtodo
    原文地址: https://www.jianshu.com/p/7fb30c5e679e
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞