Installation guide (简体中文)

From ArchWiki
Revision as of 00:33, 23 July 2012 by Fenprace (talk | contribs) (Created page with "[https://github.com/falconindy/arch-install-scripts Arch Install Scripts] 是由一组 Bash 脚本组成的,简易的 Arch 安装器。 本文总结了用 Arch Install S...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Arch Install Scripts 是由一组 Bash 脚本组成的,简易的 Arch 安装器。 本文总结了用 Arch Install Scripts 安装 Archlinux 的基本步骤。


Keyboard layout

For many countries and keyboard types appropriate keymaps are available already, and a command like loadkeys uk might do what you want. More available keymap files can be found in /usr/share/kbd/keymaps/ (you can omit the keymap path and file extension when using loadkeys).

To make these changes permanent, edit /etc/vconsole.conf.

Partition disks

See partitioning for details.

Remember to create any stacked block devices like LVM, LUKS, or RAID.

Format partitions

mkfs is a nice utility for formatting the partitions into filesystems of your choosing. By typing mkfs and hitting Tab you will see all the available choices. For example let's say we created three partitions sda1, sda2 and sda3. The corresponding commands can be found in the table below.

Partition Mountpoint mkfs command
/dev/sda1 /boot mkfs.ext4 /dev/sda1
/dev/sda2 / mkfs.ext4 /dev/sda2
/dev/sda3 /home mkfs.ext4 /dev/sda3

If you are using (U)EFI you will most probably need another partition to host the UEFI System partition. Read this article.

Mount the partitions

Given the above example, we now must mount the root partition on /mnt.

# mount /dev/sda2 /mnt

Next we create directories for any other partitions into /mnt and then we mount them.

# mkdir /mnt/boot && mount /dev/sda1 /mnt/boot

Same with /home

# mkdir /mnt/home && mount /dev/sda3 /mnt/home

Connect to the internet

Assuming a wired connection, running dhcpcd is sufficient to get a lease. For more info visit configuring network.

Wireless

If on a wireless connection, see Wireless Setup to determine if you need to load extra firmware for your device. Assuming your device is correctly loaded and working, you will need to establish a connection to your router.

If you have a WPA protected router, run wpa_passphrase "Your Router SSID" "Your WPA Key" > /etc/wpa_supplicant.conf followed by wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf. Either run this command with & >/dev/null or switch to another tty and run dhcpcd wlan0.

Install the base system

Before installing, you may want to edit /etc/pacman.d/mirrorlist such that your preferred mirror is first. This copy of the mirrorlist will be installed on your new system by pacstrap as well, so it's worth getting it right.

Using the pacstrap script we install the base system.

# pacstrap /mnt base{,-devel} 

One can install other packages appending their names to the above command (space seperated).

Install a bootloader

Syslinux

# pacstrap /mnt syslinux

GRUB

  • For BIOS
# pacstrap /mnt grub-bios
  • For EFI (in rare cases you will need grub-efi-i386 instead)
# pacstrap /mnt grub-efi-x86_64

Configure system

Generate an fstab with the following command. (If you prefer to use UUIDs or labels, add the -U or -L option, respectively.)

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

Next we chroot into our newly installed system.

# arch-chroot /mnt
  • Write your hostname to /etc/hostname.
  • Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone. Replace Zone and Subzone to your liking. For example
# ln -s /usr/share/zoneinfo/Europe/Athens /etc/localtime
  • Set locale preferences in /etc/locale.conf.
  • Uncomment the selected locale in /etc/locale.gen and generate it with locale-gen.
  • Configure /etc/mkinitcpio.conf as needed (see mkinitcpio) and create an initial RAM disk with
# mkinitcpio -p linux
  • Configure the bootloader.
  • For syslinux, edit the /boot/syslinux/syslinux.cfg to point to the right /boot partition. Then type the following command to install (-i), set boot flag (-a) and install the MBR (-m).
# /usr/sbin/syslinux-install_update -iam
  • For GRUB(2), refer to the GRUB2 article.
  • Create the grub.cfg and install grub to the harddrive containing your boot partition
 # grub-mkconfig -o /boot/grub/grub.cfg
 # grub-install /dev/sda
  • Set a root password with passwd.

Unmount the things you mounted

If you are still in the chroot environment then type exit or Ctrl+D in order to exit chroot. In step 3 we mounted the partitions under /mnt. In this step we will unmount them.

# umount /mnt/{boot,home,}

Finally reboot and configure your system as explained in Beginners' Guide/Post-Installation.