雖然網上也有很多教程,但是我follow了很多還是沒有成功,最後在同學的幫助下終於成功了。
首先說明一下基本情況:我是將arch linux裝在一個16G的金士頓U盤裏,利用了另外一個4G的U盤製作了一個LIVE CD,注意,做LIVE CD的U盤在啓動linux之後是不能執行fdisk操作的,因此如果U盤A作爲LIVE CD,則系統只能裝在U盤B上或者其他硬盤上。
我是在windows下製作的LIVE CD,方法很多,這篇博客的內容很詳細,很好操作。
==================注:以下內容轉自(http://www.2cto.com/os/201207/143614.html)=======================================================
ln -s /dev/sdd /dev/disk/by-label/ARCH_201306
其中/dev/sdd是LIVE CD所在的盤Installation
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).
Partition disks(爲需要安裝linux的盤分區)
用fdisk命令,具體可以man fdisk或者fdisk --help
Format the partitions(格式化分區)
用命令mkfs.ext4之類的,如果需要格式化爲fat格式,則需要先安裝dosfstools
Mount the partitions(掛載分區)
We now must mount the root partition on /mnt
. You should also create directories for and mount any other partitions (/mnt/boot
, /mnt/home
,
...) and mount your swap partition if you want them to be detected by genfstab
.
Connect to the internet(設置聯網)
A DHCP service is already enabled for all available devices. If you need to setup a static IP or use management tools such as Netctl,
you should stop this service first: systemctl stop dhcpcd.service
. For more information read configuring
network.
Wireless
Run wifi-menu
to set up your wireless network. For details, see Wireless
Setup and Netctl.
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
Other packages can be installed by appending their names to the above command (space seperated), including the bootloader if you want.
Configure the 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
- chroot into our newly installed system:
-
# arch-chroot /mnt
- Write your hostname to
/etc/hostname
.
- Symlink
/etc/localtime
to/usr/share/zoneinfo/Zone/SubZone
. ReplaceZone
andSubzone
to your liking. For example:
-
# ln -s /usr/share/zoneinfo/Europe/Athens /etc/localtime
- Uncomment the selected locale in
/etc/locale.gen
and generate it withlocale-gen
. - Set locale preferences in
/etc/locale.conf
. - Add console keymap and font preferences
in
/etc/vconsole.conf
- Configure
/etc/mkinitcpio.conf
as needed (see mkinitcpio) and create an initial RAM disk with:
-
# mkinitcpio -p linux
- Set a root password with
passwd
. - Configure the network again for newly installed environment. See Network Configuration and Wireless Setup.
Install and configure a bootloader
You can choose GRUB or Syslinux.
GRUB
- For BIOS:
# pacman -S grub-bios
- For EFI (in rare cases you will need
grub-efi-i386
instead):
# pacman -S grub-efi-x86_64
See GRUB installation and Configuration
Syslinux
# pacman -S syslinux
# pacman -S grub-bios os-prober
# grub-install /dev/sdc --boot-directory=/boot
# grub-mkconfig > /boot/grub/grub.cfg
不出意外的話,U盤就能引導U盤裏面的系統啓動了。
Unmount and reboot
If you are still in the chroot environment type exit
or press Ctrl+D
in
order to exit. Earlier we mounted the partitions under /mnt
. In this step we will unmount them:
# umount /mnt/{boot,home,}
Now reboot and then login into the new system with the root account.
==================================================================================================================================