把linux 装在U盘详细步骤

虽然网上也有很多教程,但是我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)=======================================================

         准备工作:
 
        |  Unetbootin http://dl.dbank.com/c0j5a8kuom:Linux系统写入U盘工具。
 
        |  BOOTICE http://dl.dbank.com/c0p0eaid5m:引导设置工具。
 
        |  你自己的Linux系统ISO镜像。
 
        |  把U盘格式化成FAT32格式,对着U盘点右键--格式化即可,不需要什么工具。
 
         第一步,使用unetbootin向U盘写入Linux系统ISO镜像。
 
        双击启动Unetbootin,看到如下界面。
 
 
        选好后点确定。出现如下界面,大约30秒就能完成。
 
 
        完成以上步骤,就把Linux系统写入U盘了。
 
        为什么要用Unetbootin写入呢?UltraISO不行吗?原因是仅仅把系统写入U盘是无法启动的,还需要用syslinux来引导,syslinux实际上是一个极小的Linux系统,只起引导作用。而Unetbootin恰恰自带了syslinux,从上图也可以看到,这样就免去了手动安装的繁琐,UltraISO不具备此功能。
 
        第二步,使用BOOTICE设置U盘引导。
 
        启动BOOTICE。选择U盘,千万别选硬盘啊。。。。然后点“主引导记录”。
 
 
        在弹出的界面配置主引导为UltraISOUSB-ZIP+。
 
 
        设置完成后关掉这个界面,回到主界面点“分区引导记录”。  www.2cto.com  
 
 
        看一下分区引导记录是不是syslinux,不是的话配置成syslinux,一般这步都没问题。为了保险起见还是看看比较好。。。。
 
 
        再次回到主界面,点击“分区管理”。
 
 
        看看U盘是否设置成了活动分区,有A标记的就是活动分区,如果没有的话,点“激活”即可。如果没有设置成活动分区,电脑从U盘启动的时候会无限弹出“Start from USB……”
 
 
        到此为止,U盘就可以成功的启动了。
 
        插上U盘,把电脑设置成从USB启动即可。
=================================================================================================================================
插上制作好的LIVE CD,重启电脑,在开机载入操作系统之前按下F12选择从U盘引导。
然后接下来的可以follow arch wiki上的内容,其实装在U盘里面和装在电脑硬盘里面之前的步骤基本没有区别。
但是arch linux有点蛋疼的地方,如果用LIVE CD做引导的话,会出现一个等待30秒的步骤,但最后失败,提示/dev/disk/by-label/ARCH_201306 not found!  其中ARCH_201306视版本的不同而不同,201306表示2013年6月发行的版本。
解决方法是做一个软链接,将LIVE CD所在的盘(如果是光盘或者iso引导,则是相应的loop区)链接到 /dev/disk/by-label/ARCH_201306,命令如下:
[plain] view plain copy
  1. ln -s /dev/sdd /dev/disk/by-label/ARCH_201306  
其中/dev/sdd是LIVE CD所在的盘

=================注:以下内容部分转自( https://wiki.archlinux.org/index.php/Installation_Guide)=====================================

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(挂载分区)

注意,挂载的是要安装linux的分区

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. Replace Zone and Subzone 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 with locale-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

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

装在电脑硬盘上的话,以上步骤就已经搞定了,卸载重启就OK。但是装在U盘上面还不行,重启开机无法引导系统启动。
需要安装grub,注意,虽然前面安装了grub但是对于安装在U盘里面,还需要再进行下列操作。注意:这些操作要在chroot的环境中进行,即在新安装的linux下执行。
   
   
[plain] view plain copy
  1. # pacman -S grub-bios os-prober  
  2.   
  3. # grub-install /dev/sdc --boot-directory=/boot  
  4.   
  5. # 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.

==================================================================================================================================
接下来的一系列操作,安装软件等视各自需求,可以参考我的下一篇博客。( http://blog.csdn.net/piasy/article/details/9071867)
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值