Welcome 微信登录

首页 / 操作系统 / Linux / 将ArchLinux安装到U盘上

最近可能比较蛋疼,想在笔记本上安装Archlinux,但是又不敢把硬盘格式化掉,怕原来配置好的Ubuntu13.04废了,Archlinux也没装好,那就白费了。
 
所以就打算把Archlinux安装到U盘上,感谢https://wiki.archlinux.org/,还有Google和度娘帮了不少忙,有点遗憾的是UEFI没配好,不怎么明白,希望路过的大神点播下.
 
接下来,Let"s begin:
 
#
# Program:
 #    Install archlinux to Flash-disk
 # History:
 #    2014/04/05 Potter version 1.01
 #
 #
#
 # 第8-9步至关重要,否则无法从usb启动
 #
 # 1.Partition
 fdisk -l # Here"s /dev/sdc is my Flash-disk ( 8G )
 fdisk /dev/sdc
 # need 3 partitions
 #    boot    100M
 #    /    6G
 #    /home    ..
 
# 2、mkfs
 mkfs.ext4 /dev/sdc1    # /boot
 mkfs.ext4 /dev/sdc2    # /
 mkfs.ext4 /dev/sdc3    # /home
 
# 3、mount
mount /dev/sdc2 /mnt
 mkdir /mnt/boot
 mount /dev/sdc1 /mnt/boot
 mkdir /mnt/home
 mount /dev/sdc3 /mnt/home
 
# 4、Modify /etc/pacman.d/mirrorlist
 vi /etc/pacman.d/mirrorlist
 #  Speed First (China)
    Server = http://ftp.tku.edu.tw/Linux/ArchLinux/$repo/os/$arch
    Server = http://mirrors.163.com/archlinux/$repo/os/$arch
    Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
 # 5、pacstrap base system
 pacstrap /mnt base base-devel
 
# 6、chroot
 arch-chroot /mnt /bin/bash
 
# 7、download vim
 pacman -S vim
 
# 8、
 #Here you need to set the right hooks if the root is on a USB drive , if you use RAID , LVM , or if / usr is on a separate partition .
 #
 # Modify /etc/mkinitcpio.conf. Make my flash-disk can be supported
 # Add "usb" to "HOOKS" (Maybe in line 52)
 # 因为这是U盘,要修改一下 /etc/ mkinitcpio .conf,找到 HOOKS= 这行,然后在等号后面加入 usb 。这样才会支持usb设备启动
 # Like the following:
 HOOKS="base udev usb block autodetect modconf filesystems keyboard fsck"
 
# 9、Renew mkinitcpio
 mkinitcpio -p linux
 
# 10、Passwd root
 passwd root
 
# 11、Something
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # time zone
 echo we > /etc/hostname # Hostname
 # locale configure
 vim /etc/locale.gen
   en_US.UTF-8 UTF-8
   zh_CN.GBK GBK
   zh_CN.UTF-8 UTF-8
   zh_CN GB2312
 #
 locale-gen
 
# 12、Install Grub
 pacman -S grub
 
# 13、Install Grub On flash-disk (Here is /dev/sdc)
 grub-install --target=i386-pc --no-floppy --recheck --debug /dev/sdc
 # If Something errors , Run the follow commands
 #That"s add options "--force"
 #    grub-install --target=i386-pc --no-floppy --recheck --force --debug /dev/sdc
 
# 14、Generate "grub.cfg"
 grub-mkconfig -o /boot/grub/grub.cfg
 
# 15、Reboot to Your flash-disk. Congratulations!
 exit
 umount -R /mnt
 reboot
 Linux 文件权限相关命令为ArchLinux安装桌面和一些必要软件相关资讯      Archlinux  ArchLinux安装 
  • ArchLinux下的wifi(无线)问题解  (04/08/2014 18:57:43)
  • ArchLinux上已经可以运行Unity桌面  (02/11/2013 21:28:58)
  • Linux 发行版 Archlinux  (03/14/2012 13:35:06)
  • 为ArchLinux安装桌面和一些必要软  (04/08/2014 18:56:03)
  • 生日快乐!Archlinux 10 周年  (03/14/2012 13:38:10)
  • ArchLinux 的CPU和显卡的节能设置  (01/02/2012 08:31:02)
本文评论 查看全部评论 (0)
表情: 姓名: 字数