Arch linux安装

Arch linux安装
官方文档:

以archlinux-2016.01.01-dual.iso为例

/root/install.txt是arch的安装说明
     * 1 Pre-installation
          + 1.1 Set the keyboard layout
          + 1.2 Connect to the Internet
          + 1.3 Update the system clock
          + 1.4 Partition the disks
          + 1.5 Format the partitions
          + 1.6 Mount the partitions
     * 2 Installation
          + 2.1 Select the mirrors
          + 2.2 Install the base packages
          + 2.3 Configure the system
          + 2.4 Install a boot loader
          + 2.5 Reboot
     * 3 Post-installation

arch live cd启动后会直接以root身份登录

提示:修改live cd root密码并启sshd
passwd root
systemctl start sshd

Pre-installation
1.1.设置键盘
默认为美式键盘

1.2.配置网络
dhclient eno16777736

1.3.同步时间

说明:前三项都是在live cd下,只需通外网即可

1.4.分区
这里创建gpt磁盘

Partition

Filesystem

Size

Description

/dev/sda1

(bootloader)

2M

BIOS boot partition

/dev/sda2

ext2 (or vfat)

128M

Boot partition

/dev/sda3

(swap)

512M or higher

Swap partition

/dev/sda4

ext4

Rest of the disk

Root partition

parted /dev/sda mklabel gpt
parted /dev/sda unit mib

parted /dev/sda mkpart primary 1 3
parted /dev/sda name 1 grub
parted /dev/sda set 1 bios_grub on

parted /dev/sda mkpart primary 3 131
parted /dev/sda name 2 boot

parted /dev/sda mkpart primary 131 643
parted /dev/sda name 3 swap

parted /dev/sda 
mkpart primary 643 -1
name 4 rootfs
quit

parted /dev/sda set 2 boot on
partprobe /dev/sda
注意:最后一块分区只能在交互模式下分,在静默模式下分会报不合法

root@archiso ~ # parted /dev/sda print

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sda: 42.9GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags: 


Number  Start   End     Size    File system  Name    Flags

      1049kB  3146kB  2097kB               grub    bios_grub

      3146kB  137MB   134MB                boot    boot, esp

      137MB   674MB   537MB                swap

      674MB   42.9GB  42.3GB               rootfs


1.5.格式化
mkfs.vfat /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.xfs /dev/sda4
mkswap /dev/sda3
swapon /dev/sda3

1.6.挂载
mkdir /mnt/arch
mount /dev/sda4 /mnt/arch/
mkdir -p /mnt/arch/boot
mount /dev/sda2 /mnt/arch/boot


Installation
2.1.配置本地镜像源

grep -A1 China /etc/pacman.d/mirrorlist|egrep -v '^[#-]' >/etc/pacman.d/mirrorlist.china

mv /etc/pacman.d/mirrorlist.china /etc/pacman.d/mirrorlist

或者

cat >>/etc/pacman.conf <<'HERE'
[archlinuxcn]
SigLevel = Optional TrustAll
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
HERE
说明:如上虽说都是国内源,但还是非常慢,实在受不了,最后mirrorlist里只留下了网易163的镜像,速度就飞快了Server = http://mirrors.163.com/archlinux/$repo/os/$arch


2.2.安装base包组
pacstrap /mnt/arch base base-devel vim net-tools openssh

Total Download Size:   243.58 MiB

Total Installed Size:  873.54 MiB


2.3.配置chroot系统
fstab

root@archiso ~ # genfstab  -U -p /mnt/arch >>/mnt/arch/etc/fstab 

root@archiso ~ # cat /mnt/arch/etc/fstab

# /etc/fstab: static file system information

#

#

# /dev/sda4

UUID=8b0f3eb5-eb82-426f-97e6-646974897ccf /         xfs       rw,relatime,attr2,inode64,noquota 0 1


# /dev/sda2

UUID=c8846f20-3d8a-4bcd-9809-19f8a2a85ae1 /boot     ext4      rw,relatime,data=ordered 0 2


# /dev/sda3

UUID=0120550a-f99c-4b28-b955-55b984721efd none      swap      defaults  0 0



chroot

arch-chroot /mnt/arch


hostname

echo jlive >/etc/hostname


time zone

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


locales

sed -i '/^#en_US/s/^#//' /etc/locale.gen

sed -i '/^#zh_CN/s/^#//' /etc/locale.gen

locale-gen 

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

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


keymap

https://wiki.archlinux.org/index.php/Keyboard_configuration_in_console


font

https://wiki.archlinux.org/index.php/Fonts#Console_fonts


network

https://wiki.archlinux.org/index.php/Network_configuration

https://wiki.archlinux.org/index.php/Netctl


initramfs

https://wiki.archlinux.org/index.php/Mkinitcpio

mkinitcpio -p linux

sh-4.3# mkinitcpio -p linux

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'

  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img

==> Starting build: 4.3.3-2-ARCH

  -> Running build hook: [base]

  -> Running build hook: [udev]

  -> Running build hook: [autodetect]

  -> Running build hook: [modconf]

  -> Running build hook: [block]

  -> Running build hook: [filesystems]

  -> Running build hook: [keyboard]

  -> Running build hook: [fsck]

==> Generating module dependencies

==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img

==> Image generation successful

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'

  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect

==> Starting build: 4.3.3-2-ARCH

  -> Running build hook: [base]

  -> Running build hook: [udev]

  -> Running build hook: [modconf]

  -> Running build hook: [block]

==> WARNING: Possibly missing firmware for module: wd719x

==> WARNING: Possibly missing firmware for module: aic94xx

  -> Running build hook: [filesystems]

  -> Running build hook: [keyboard]

  -> Running build hook: [fsck]

==> Generating module dependencies

==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img

 

==> Image generation successful


password for root user
passwd root


2.4.安装boot loader

pacman -S grub os-prober

grub-install /dev/sda

grub-mkconfig -o /boot/grub/grub.cfg


2.5.重启

在重启前可以先安装一些基本工具

pacman -S screen screenfetch dialog wpa_actiond ifplugd wpa_suppicant sudo zsh 

exit
umount /mnt/arch/boot
umount /mnt/arch
reboot


Post-installation
Arch <wbr>linux安装

[root@jlive ~]# uname -a

Linux jlive 2.6.63-2-ARCH #1 SMP PREEMPT Wed Dec 23 20:09:18 CET 2015 x86_64 GNU/Linux

[root@jlive ~]# screenfetch 

                   -`

                  .o+`                 root@jlive

                 `ooo/                 OS: Arch Linux 

                `+oooo:                Kernel: x86_64 Linux 2.6.63-2-ARCH

               `+oooooo:               Uptime: 25m

               -+oooooo+:              Packages: 171

             `/:-:++oooo+:             Shell: sh

            `/++++/+++++++:            CPU: 8x Intel Core i7-4870HQ CPU @ 2.495GHz

           `/++++++++++++++:           RAM: 125MiB / 7972MiB

          `/+++ooooooooooooo/`        

         ./ooosssso++osssssso+`       

        .oossssso-````/ossssss+`      

       -osssssso.      :ssssssso.     

      :osssssss/        osssso+++.    

     /ossssssss/        +ssssooo/-    

   `/ossssso+/:-        -:/+osssso+-  

  `+sso+:-`                 `.-/+oso: 

 `++:.                           `-/+/

 .`                                 `/

posted @ 2016-01-08 21:36  李庆喜  阅读(546)  评论(0编辑  收藏  举报