个人工具

“UbuntuHelp:Installation/FromUSBStick/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
isotostick.sh (命令行方式的shell脚本,从Linux中运行)
 
(未显示同一用户的21个中间版本)
第1行: 第1行:
{{Translation}}
+
{{Copyedit translation}}
 
{{From|https://help.ubuntu.com/community/Installation/FromUSBStick}}{{Translator|A2128}}
 
{{From|https://help.ubuntu.com/community/Installation/FromUSBStick}}{{Translator|A2128}}
 
{{Languages|UbuntuHelp:Installation/FromUSBStick}}
 
{{Languages|UbuntuHelp:Installation/FromUSBStick}}
 
== 从USB记忆棒安装Ubuntu ==
 
== 从USB记忆棒安装Ubuntu ==
 +
<pre><nowiki>
 +
本文描述的安装版本是6.10以前的版本,请阅读者注意。
 +
同时原文中有一些英文wiki读者之间的注释和问答,例如条目1.6,并没有进行翻译,
 +
有兴趣的读者可以自行阅读,或者可以跳过阅读。谢谢! 
 +
-- A2128(译者)
 +
</nowiki></pre>
 
本页描述了如何利用拷贝安装光盘的相关文件到USB驱动器,如U盘(或者闪存卡)等,并使其成为引导盘的方法来安装Ubuntu。这种方法对于那些超轻超小的没有光盘驱动器,但是又可以从USB启动的笔记本电脑来说是非常方便的。
 
本页描述了如何利用拷贝安装光盘的相关文件到USB驱动器,如U盘(或者闪存卡)等,并使其成为引导盘的方法来安装Ubuntu。这种方法对于那些超轻超小的没有光盘驱动器,但是又可以从USB启动的笔记本电脑来说是非常方便的。
 
主要的步骤包括:
 
主要的步骤包括:
第27行: 第33行:
 
==== Live USB creator (图形界面,从Live CD中运行) ====
 
==== Live USB creator (图形界面,从Live CD中运行) ====
 
Live USB creator可以自动完成从运行的Ubuntu Live CD创建可引导的USB记忆棒的过程。非常简单,运行Live CD,安装该工具,从系统管理菜单中启动USB的安装。
 
Live USB creator可以自动完成从运行的Ubuntu Live CD创建可引导的USB记忆棒的过程。非常简单,运行Live CD,安装该工具,从系统管理菜单中启动USB的安装。
 +
 
https://launchpad.net/liveusb -- probono
 
https://launchpad.net/liveusb -- probono
 +
 
{{http://klik.atekon.de/liveusb/screenshot.png}}
 
{{http://klik.atekon.de/liveusb/screenshot.png}}
 +
 
''注:无法工作,说是我只能从Live CD中运行???''
 
''注:无法工作,说是我只能从Live CD中运行???''
 +
 
==== isotostick.sh (命令行方式的shell脚本,从Linux中运行) ====
 
==== isotostick.sh (命令行方式的shell脚本,从Linux中运行) ====
 
''警告:'' 从不被信任的网站运行脚本是非常非常危险的!
 
''警告:'' 从不被信任的网站运行脚本是非常非常危险的!
最简单的方法,该方法也可以用于桌面安装,是使用 isotostick.sh script from http://www.startx.ro/sugar/ 提供的isotostick.sh脚本。可以通过以下方法下载该脚本,改变运行模式并运行它:
+
最简单的方法,该方法也可以用于桌面安装,是使用http://www.startx.ro/sugar/ 提供的isotostick.sh脚本。可以通过以下方法下载该脚本,改变运行模式并运行它:
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install syslinux mtools
 
sudo apt-get install syslinux mtools
第42行: 第52行:
 
当脚本试图拷贝symlinks /dists/stable 和 /dists/unstable的时候,你可能会看到“operation not permitted”,没有关系,那是因为FAT16文件系统不能处理symlinks。
 
当脚本试图拷贝symlinks /dists/stable 和 /dists/unstable的时候,你可能会看到“operation not permitted”,没有关系,那是因为FAT16文件系统不能处理symlinks。
 
现在你可以像从安装光盘启动那样从USB记忆棒启动来安装Ubuntu了。
 
现在你可以像从安装光盘启动那样从USB记忆棒启动来安装Ubuntu了。
 +
 
''注: 不能工作在ubuntu-8.10-server-amd64.iso - 说是a common cdrom drive could not be found and won't proceed with installation - 有什么建议?''
 
''注: 不能工作在ubuntu-8.10-server-amd64.iso - 说是a common cdrom drive could not be found and won't proceed with installation - 有什么建议?''
 +
 
''注: Trying to use this on a Feisty machine to copy a Gutsy (livecd) iso. The script does not appear to copy all of the folders. It also looks for /usr/bin/syslinux/mbr -- which is not present with syslinux from the Feisty repos. --JulesTheMisfit''
 
''注: Trying to use this on a Feisty machine to copy a Gutsy (livecd) iso. The script does not appear to copy all of the folders. It also looks for /usr/bin/syslinux/mbr -- which is not present with syslinux from the Feisty repos. --JulesTheMisfit''
 +
 
''注:  Seems to work, hardy.iso on a hardy machine. ---Bas''
 
''注:  Seems to work, hardy.iso on a hardy machine. ---Bas''
  
==== ubuntu-server-flashdrive-installer.sh (Command-line shell script, runs from Linux) ====
+
==== ubuntu-server-flashdrive-installer.sh (命令行方式的shell脚本,从Linux中运行) ====
The [[UbuntuHelp:UbuntuServerFlashDriveInstaller|UbuntuServerFlashDriveInstaller]] was developed from the instructions at [http://ubuntuforums.org/showthread.php?p=4404569 this forum post].
+
[[UbuntuHelp:UbuntuServerFlashDriveInstaller|UbuntuServerFlashDriveInstaller]] 是从[http://ubuntuforums.org/showthread.php?p=4404569 这个帖子里]开始并继续完善的。
''Comment: Does not work with ubuntu-8.10-server-amd64.iso - says no usable ISO found - any ideas?''
+
 
=== Manual Approach ===
+
''注: 不能工作在 ubuntu-8.10-server-amd64.iso - 说是 no usable ISO found - 有什么建议吗?''
In short here's what you have to do:
+
 
* Make the USB flash drive bootable using SYSLINUX.
+
=== 手动安装 ===
* Copy the contents of the Ubuntu CD to your flash drive (make sure you include hidden files/directories).
+
简单来说,下面是你需要做的事情:
* Rename the <code><nowiki>isolinux</nowiki></code> directory to <code><nowiki>syslinux</nowiki></code> and the file <code><nowiki>isolinux.cfg</nowiki></code> to <code><nowiki>syslinux.cfg</nowiki></code>
+
* 用SYSLINUX创建可引导的USB记忆棒
* ''only for old versions of syslinux:'' Copy some files from sub-directories to the root directory and edit <code><nowiki>syslinux.cfg</nowiki></code> a bit.
+
* 拷贝Ubunut光盘上的内容到USB记忆棒(确认包括隐藏的目录和文件)
* Boot the computer from your USB flash drive.
+
* 将目录<code><nowiki>isolinux</nowiki></code> 更名为 <code><nowiki>syslinux</nowiki></code> ,并将文件 <code><nowiki>isolinux.cfg</nowiki></code> 更名为 <code><nowiki>syslinux.cfg</nowiki></code>
* ''only for the Alternate installer CD and pre-7.04 versions:'' Create a fake CD-ROM drive and mount the flash drive to <code><nowiki>/cdrom</nowiki></code> during the Ubuntu installation process.
+
* ''如果是老版本的syslinux的话'' ,需要从子目录拷贝一些文件到根目录中并编辑一下 <code><nowiki>syslinux.cfg</nowiki></code>  
* ''only for the Alternate installer CD and Ubuntu 8.04:'' See [http://ubuntuforums.org/showthread.php?p=4404569 a forum post] on a file system support issue.  
+
* 从你的USB记忆棒启动电脑
==== Make your USB stick bootable with SYSLINUX ====
+
* ''如果是使用Alternate CD且7.04以前的版本的话'', 需要在Ubuntu的安装过程中创建一个虚拟的光驱,并将USB记忆棒mount到 <code><nowiki>/cdrom</nowiki></code>
SYSLINUX is a boot loader that operates off an MS-DOS/Windows FAT filesystem. Most USB flash drives come with a FAT filesystem. Here's how you can add a SYSLINUX bootblock to your USB stick:
+
* ''如果是使用Alternate CD且是Ubuntu 8.04的话'',请参考[http://ubuntuforums.org/showthread.php?p=4404569 这个帖子] 中关于文件系统的部分  
<ol><li>Make sure that "syslinux" is installed. SYSLINUX is available for both Linux and MS Windows (the executable is in the archive under \win32\syslinux.exe). For more information check the SYSLINUX homepage: http://www.syslinux.org/. On Ubuntu Linux, install it with:</li></ol>
+
==== 用SYSLINUX创建可引导的USB记忆棒 ====
 +
SYSLINUX是一个Linux系统的系统引导器,工作在MS-DOS/Windows FAT文件系统下。大部分USB记忆棒缺省的文件系统就是FAT。下面介绍怎样在你的USB记忆棒上添加SYSLINUX引导区:
 +
<ol><li>确认"syslinux"已经安装。在Linux和MS Windows(可执行文件在\win32\syslinux.exe)都可以找到SYSLINUX。从SYSLINUX的网页 http://www.syslinux.org/ 可以获得更多信息。在Ubuntu Linux下面,用下面的命令安装:</li>
  
 
<pre><nowiki>
 
<pre><nowiki>
 
  sudo apt-get install syslinux mtools</nowiki></pre>
 
  sudo apt-get install syslinux mtools</nowiki></pre>
<ol><li>Attach your USB stick to your computer and mount it. This may happen automatically. If you are using Linux and it does not get mounted automatically, you can mount it by using a command such as <code><nowiki>mount -t vfat /dev/sda1 /mnt </nowiki></code>. Note the mountpoint (i.e. <code><nowiki>/mnt</nowiki></code> in the example. If you are using Windows, it should get mounted automatically. (If it doesn't your version of Windows is probably pretty old, and you'll need to install a driver for the USB stick first. Check the vendor's homepage.) Note the drive letter that Windows assigns to it (for example <code><nowiki>F:</nowiki></code>).
+
<li>将USB记忆棒插入电脑并挂载它,这应该自动完成。如果你的电脑运行的是Linux而且没有自动挂载,你可以用命令手动挂载,比如 <code><nowiki>mount -t vfat /dev/sda1 /mnt </nowiki></code>。注意在命令中所使用的挂载点(比如例子中的/mnt)。如果你用的是windows,它应该被自动识别。(如果没有的话,可能你的windows比较老,你需要先安装一个USB的驱动程序,请到USB记忆棒的厂家网页上查询。) 注意windows分配给USB记忆棒的盘符(比如<code><nowiki>F:</nowiki></code>)。
</li><li>Make the USB stick bootable. If you're using Linux and your USB stick is mounted as in the above example, use: <code><nowiki>syslinux -s /dev/sda1</nowiki></code>. If you are using Windows and the flash drive has the letter <code><nowiki>F:</nowiki></code> assigned to it as in the above example, use: <code><nowiki>syslinux -s -m F:</nowiki></code>
+
</li><li>创建可引导的USB记忆棒。如果你使用的是Linux并且按照上面的方法完成挂载,则使用命令: <code><nowiki>syslinux -s /dev/sda1</nowiki></code>。如果你使用的是windows且系统分配的盘符比如说是<code><nowiki>F:</nowiki></code> ,则使用命令: <code><nowiki>syslinux -s -m F:</nowiki></code>
</li><li>You should see a new file called <code><nowiki>ldlinux.sys</nowiki></code> in the root directory of your flash drive. (Note that it is a hidden file, you might not see it in Windows Explorer; try <code><nowiki>dir /a F:</nowiki></code> from a command prompt). Now you can boot from your USB stick. Read on once you get a SYSLINUX message and a ""boot:"" prompt.</li></ol>
+
</li><li>你应该能在USB记忆棒的根目录下看到一个文件名为 <code><nowiki>ldlinux.sys</nowiki></code> 的文件。(注意,这是一个隐藏文件,用windows的资源管理器可能看不到它;在DOS窗口下用命令<code><nowiki>dir /a F:</nowiki></code> )。这是你应该可以从USB记忆棒启动了,不过你只能看到SYSLINUX的提示符“boot:"</li></ol>
  
 
''Regarding the IDE disk: When in the USB cradle, the disk is sda,
 
''Regarding the IDE disk: When in the USB cradle, the disk is sda,
第75行: 第90行:
 
to <code><nowiki>pumount</nowiki></code> any device you intend to do any low-level operations on,
 
to <code><nowiki>pumount</nowiki></code> any device you intend to do any low-level operations on,
 
and then <code><nowiki>mount</nowiki></code> and <code><nowiki>unmount</nowiki></code> as root as necessary.'' -- Ubuntu:Era
 
and then <code><nowiki>mount</nowiki></code> and <code><nowiki>unmount</nowiki></code> as root as necessary.'' -- Ubuntu:Era
 +
 
''Make sure to include the -m option with the Windows version of syslinux, to
 
''Make sure to include the -m option with the Windows version of syslinux, to
 
ensure that it copies a fresh ISOLINUX master boot record (MBR.) Otherwise
 
ensure that it copies a fresh ISOLINUX master boot record (MBR.) Otherwise
 
the preexisting MBR may be used, which therefore may not point to
 
the preexisting MBR may be used, which therefore may not point to
 
your syslinux.cfg file.''
 
your syslinux.cfg file.''
==== Copy the Ubuntu CD to your USB stick ====
+
 
Copy the ''contents'' of the Ubuntu installation CD to your USB stick (i.e. all files and directories that are on the installation CD). Please do ''not'' copy an ISO image of the installation CD. Note that you don't have to burn the iso to copy it's contents, from linux it can be mounted like so:
+
==== 拷贝Ubuntu光盘文件到USB记忆棒 ====
 +
将Ubunut安装光盘的“内容”拷贝到USB记忆棒上(比如,所有光盘上文件和目录)。但是请“不”要拷贝安装光盘的iso镜像文件。实际上,你不需要刻张光盘在拷贝“内容”,在Linux下面可以通过挂载的方式实现:
 
<pre><nowiki>
 
<pre><nowiki>
 
mount -o loop /path/to/ubuntu.iso /path/to/mount/point</nowiki></pre>
 
mount -o loop /path/to/ubuntu.iso /path/to/mount/point</nowiki></pre>
Make sure you also copy hidden files and directories (eg. ones with names beginning with a "."). In Gnome, press ctrl-H to see hidden files. In MS Windows you can use the following command, assuming that D: is your CD-ROM drive and F: is the USB stick:
+
确认你同时拷贝了那些隐藏的文件和目录(例如那些以“."开头的文件和目录)。在Gnome下,可以用ctrl+H键看到隐藏文件。在MS Windows下面可以用这样的命令(假设D:是你的光驱而F:是你的USB记忆棒):
 
<pre><nowiki>
 
<pre><nowiki>
 
xcopy /e /h /k d:\*.* f:</nowiki></pre>
 
xcopy /e /h /k d:\*.* f:</nowiki></pre>
==== Move files to the root directory ====
+
 
'' This step is not needed if you prepared the flash drive with syslinux 3.35 or newer (Ubuntu 7.10).''
+
==== 向根目录下拷贝文件 ====
Copy (or move) the files stated from the following directories to the root directory of your USB stick:
+
'' 如果你使用的是syslinux 3.5或者更新的版本(Ubuntu 7.10),请忽略此步。''
* isolinux (all files)
+
从下面提到的USB记忆棒目录里面拷贝(或者移动)文件到根目录下:
* casper (vmlinuz and initrd.gz)
+
* isolinux (所有文件)
* install (all files)
+
* casper (vmlinuz和initrd.gz)
==== Move dapper to stable ====
+
* install (所有文件)
''Only needed for Ubuntu 6.06 Alternate install CD''
+
 
Rename the directory <code><nowiki>dists/dapper</nowiki></code> to <code><nowiki>dists/stable</nowiki></code>.
+
==== 将dapper更名为stable ====
 +
''仅适用于Ubuntu 6.06 Alternate CD''
 +
 
 +
<code><nowiki>dists/dapper</nowiki></code> 更名为 <code><nowiki>dists/stable</nowiki></code>
 +
 
 
''I think this depends slightly on which CD and which installer you're using.
 
''I think this depends slightly on which CD and which installer you're using.
 
I've had problems when <code><nowiki>dists/dapper</nowiki></code> was missing and when <code><nowiki>dists/stable</nowiki></code>
 
I've had problems when <code><nowiki>dists/dapper</nowiki></code> was missing and when <code><nowiki>dists/stable</nowiki></code>
第103行: 第124行:
 
If you have spare disk space and a little patience, you could copy
 
If you have spare disk space and a little patience, you could copy
 
one to the other for the total belt and suspenders solution.)'' -- Ubuntu:Era
 
one to the other for the total belt and suspenders solution.)'' -- Ubuntu:Era
 +
 
''For anyone trying to install the new Ubuntu 7.04 (Feisty) with this guide: You can
 
''For anyone trying to install the new Ubuntu 7.04 (Feisty) with this guide: You can
 
skip this step. In fact, it doesn't matter if you delete the file named <code><nowiki>dists/stable</nowiki></code>
 
skip this step. In fact, it doesn't matter if you delete the file named <code><nowiki>dists/stable</nowiki></code>
 
and rename the <code><nowiki>dists/feisty</nowiki></code> to <code><nowiki>dists/stable</nowiki></code>.'' -- Boo
 
and rename the <code><nowiki>dists/feisty</nowiki></code> to <code><nowiki>dists/stable</nowiki></code>.'' -- Boo
==== Adjust SYSLINUX.CFG ====
+
 
For recent versions of syslinux, you just need to rename the <code><nowiki>isolinux</nowiki></code> directory to <code><nowiki>syslinux</nowiki></code> and rename the file <code><nowiki>isolinux.cfg</nowiki></code> inside this directory to <code><nowiki>syslinux.cfg</nowiki></code> .
+
==== 修改 SYSLINUX.CFG ====
''For older versions:'' Copy (or rename) the file <code><nowiki>isolinux.cfg</nowiki></code> to <code><nowiki>syslinux.cfg</nowiki></code>. Then edit the file and remove the <code><nowiki>/casper/</nowiki></code> or <code><nowiki>/install/</nowiki></code> reference in all paths.  For example you would change the line containing <code><nowiki>DEFAULT /casper/vmlinuz</nowiki></code> to <code><nowiki>DEFAULT vmlinuz</nowiki></code>. Save the file, and make sure it is called <code><nowiki>syslinux.cfg</nowiki></code>. It does not matter whether the line breaks are in DOS or Linux format.
+
如果使用较新版本的syslinux, 你只需要将目录<code><nowiki>isolinux</nowiki></code> 更名为<code><nowiki>syslinux</nowiki></code>,并且将目录内的文件<code><nowiki>isolinux.cfg</nowiki></code> 更名为<code><nowiki>syslinux.cfg</nowiki></code>
 +
''使用老版本的syslinux的话'' 拷贝(或者更名)文件 <code><nowiki>isolinux.cfg</nowiki></code> <code><nowiki>syslinux.cfg</nowiki></code>。然后编辑文件,删除文件中所有路径参考中的<code><nowiki>/casper/</nowiki></code> <code><nowiki>/install/</nowiki></code> 字样。例如,你需要将包含 <code><nowiki>DEFAULT /casper/vmlinuz</nowiki></code> 的语句修改为 <code><nowiki>DEFAULT vmlinuz</nowiki></code>。保存文件并确认文件名为 <code><nowiki>syslinux.cfg</nowiki></code>.。文件中的换行符是linux格式还是DOS格式都没有关系。
 +
 
 
''Again, for anyone installing Ubuntu 7.04 (Feisty):
 
''Again, for anyone installing Ubuntu 7.04 (Feisty):
 
Just remove the <code><nowiki>/install/</nowiki></code> reference. The only line it is found is
 
Just remove the <code><nowiki>/install/</nowiki></code> reference. The only line it is found is
 
<code><nowiki>kernel /install/mt86plus</nowiki></code>, which must be changed to <code><nowiki>kernel /mt86plus</nowiki></code>. -- Boo''
 
<code><nowiki>kernel /install/mt86plus</nowiki></code>, which must be changed to <code><nowiki>kernel /mt86plus</nowiki></code>. -- Boo''
 +
 
''no, it is not. there were 23 entries on isolinux.cfg'' -- capi
 
''no, it is not. there were 23 entries on isolinux.cfg'' -- capi
 +
 
''I found twenty one, with Feisty, and syslinux 3.51'' -- Gedanken
 
''I found twenty one, with Feisty, and syslinux 3.51'' -- Gedanken
==== Boot from the USB stick ====
+
 
Boot the computer from the USB stick. The installation can now be done as if you would be booting from the installation CD.
+
==== 从USB记忆棒引导启动 ====
==== Mounting the USB stick as /cdrom ====
+
现在从USB记忆棒引导启动电脑,然后可以完成象从安装光盘启动一样的安装工作。
''This step is only needed for the Alternate install CD and Ubuntu 6.10 or older.''
+
 
Switch to the second virtual console during the first couple of dialogs (when asked about your preferred language for the installation etc.) by pressing the ""ALT-2"". Do the following:
+
==== 将USB记忆棒挂载为/cdrom ====
 +
''这一步仅在Alternate CD安装Ubuntu 6.10,或者更早的版本的安装时才需要。''
 +
 
 +
在启动最初的对话过程中(比如询问你愿意采用的安装语言时),按""ALT-2""切换到第二个虚拟命令行窗口。然后完成以下操作:
 
* <code><nowiki>mkdir /cdrom /dev/cdroms</nowiki></code>
 
* <code><nowiki>mkdir /cdrom /dev/cdroms</nowiki></code>
 
* <code><nowiki>cd /dev/cdroms</nowiki></code>
 
* <code><nowiki>cd /dev/cdroms</nowiki></code>
* <code><nowiki>ln -s ../sda1 cdrom0</nowiki></code> (where sda1 is your USB stick)
+
* <code><nowiki>ln -s ../sda1 cdrom0</nowiki></code> (这里假设sda1是你的USB记忆棒)
 
* <code><nowiki>mount -t vfat /dev/cdroms/cdrom0 /cdrom</nowiki></code>
 
* <code><nowiki>mount -t vfat /dev/cdroms/cdrom0 /cdrom</nowiki></code>
Then switch back to the first virtual console by pressing ""ALT-1"". Continue installing Ubuntu as if you were running from CD.
+
然后按""ALT-1""切换回第一个虚拟窗口,可以继续象从光盘安装Ubuntu那样继续安装。
 +
 
 
''This was a bit tricky until I got the hang of it.
 
''This was a bit tricky until I got the hang of it.
 
You need to have the hardware detection detect your <code><nowiki>hda</nowiki></code> before you can mount it!
 
You need to have the hardware detection detect your <code><nowiki>hda</nowiki></code> before you can mount it!
第134行: 第164行:
 
(Remember, I'm talking about the text-only installer. It might be different in the GTK install.)
 
(Remember, I'm talking about the text-only installer. It might be different in the GTK install.)
 
-- Ubuntu:Era''
 
-- Ubuntu:Era''
 +
 
''I think just ran into https://launchpad.net/distros/ubuntu/+source/casper/+bug/63277'' -- Ubuntu:SvenHerzberg
 
''I think just ran into https://launchpad.net/distros/ubuntu/+source/casper/+bug/63277'' -- Ubuntu:SvenHerzberg
 +
 
''When installing Ubuntu 7.04 (Feisty), there was no need for me to mount the flash.'' -- Boo
 
''When installing Ubuntu 7.04 (Feisty), there was no need for me to mount the flash.'' -- Boo
 +
 
''This is does not work for me using the alternate gutsy iso - i.e. mount -t vfat usbdev target fails with "no such device". There is a forum thread here: http://ubuntuforums.org/showthread.php?t=405008  Currently I know of no solution but to use the regular iso.'' -- Stenico
 
''This is does not work for me using the alternate gutsy iso - i.e. mount -t vfat usbdev target fails with "no such device". There is a forum thread here: http://ubuntuforums.org/showthread.php?t=405008  Currently I know of no solution but to use the regular iso.'' -- Stenico
=== After Installing ===
+
 
After finishing the installation, edit <code><nowiki>/etc/fstab</nowiki></code> and make sure that /media/cdrom0 points to the CD drive and not to the USB stick. If you don't, you might get this error when trying to mount a USB stick: "Cannot mount volume. Invalid mount option when attempting to mount the volume."
+
=== 安装完成之后 ===
This is because the installer believes it is installing from a CD drive ([https://launchpad.net/bugs/150872 bug 150872]).  
+
安装完成之后,编辑<code><nowiki>/etc/fstab</nowiki></code>,确认 /media/cdrom0 指向光驱而不是USB记忆棒。如果你不做确认,那么有可能下一次你挂载USB硬件的时候会得到以下信息: "Cannot mount volume. Invalid mount option when attempting to mount the volume."
Open /etc/fstab for editing, e.g.
+
这是因为安装程序认为你是从一个光驱中安装的系统 ([https://launchpad.net/bugs/150872 bug 150872]).  
 +
 
 +
打开并编辑/etc/fstab:
 +
 
 
<code><nowiki>sudo gedit /etc/fstab</nowiki></code>
 
<code><nowiki>sudo gedit /etc/fstab</nowiki></code>
Find a line like this (usually at the end):
+
 
 +
找到这一行(通常都在结尾):
 +
 
 
<code><nowiki>/dev/sdb1      /media/cdrom0  udf,iso9660 user,noauto,exec,utf8 0      0</nowiki></code>
 
<code><nowiki>/dev/sdb1      /media/cdrom0  udf,iso9660 user,noauto,exec,utf8 0      0</nowiki></code>
and comment it out by placing a # at the beginning:
+
 
 +
在前面加上#号作为注释:
 +
 
 
<code><nowiki>#/dev/sdb1      /media/cdrom0  udf,iso9660 user,noauto,exec,utf8 0      0</nowiki></code>
 
<code><nowiki>#/dev/sdb1      /media/cdrom0  udf,iso9660 user,noauto,exec,utf8 0      0</nowiki></code>
You can also rename the real cdrom mount point to <code><nowiki>/media/cdrom0</nowiki></code> if you like.
+
 
Save the file, and you're done.
+
如果你愿意的话,当然可以把真正的光驱挂载到<code><nowiki>/media/cdrom0</nowiki></code> 上。
=== See also ===
+
 
 +
保存文件,搞定。
 +
 
 +
=== 参考 ===
 
* https://wiki.ubuntu.com/LiveUsbPendrivePersistent
 
* https://wiki.ubuntu.com/LiveUsbPendrivePersistent
 +
 
=== Comments and Troubleshooting ===
 
=== Comments and Troubleshooting ===
 
- ''For an alternative method that works with Feisty see: https://help.ubuntu.com/7.04/installation-guide/i386/boot-usb-files.html)'' -- Monkeymind
 
- ''For an alternative method that works with Feisty see: https://help.ubuntu.com/7.04/installation-guide/i386/boot-usb-files.html)'' -- Monkeymind
 +
 
- ''The instructions there work great with gutsy as well, but on my machine i needed to add "vesa vga=771" to the "append=" line in syslinux.cfg.  After that the process was completely unproblematic'' -- Matt Price
 
- ''The instructions there work great with gutsy as well, but on my machine i needed to add "vesa vga=771" to the "append=" line in syslinux.cfg.  After that the process was completely unproblematic'' -- Matt Price
 +
 
- ''I also succeeded in installing on a Libretto 100CT by using a 2.5" IDE disk in one of those cheap USB cradles. This machine has no CD-ROM, no floppy (on my unit), no USB. I've taken the liberty to annotate my experiences in an indented style, like this.'' -- Ubuntu:Era
 
- ''I also succeeded in installing on a Libretto 100CT by using a 2.5" IDE disk in one of those cheap USB cradles. This machine has no CD-ROM, no floppy (on my unit), no USB. I've taken the liberty to annotate my experiences in an indented style, like this.'' -- Ubuntu:Era
 +
 
- ''I installed on an IBM X40 using the contents of the mini.iso for edgy on a USB stick instead of using the iso for the bulkier alternate CD. I only had to install syslinux and rename isolinux.cfg to syslinux.cfg (I didn't have to change the contents of the file). It was very easy. I didn't have to try fooling the installer into thinking the stick was the CD and mess with symlinks etc.'' -- [[UbuntuHelp:MikkelErup|MikkelErup]]
 
- ''I installed on an IBM X40 using the contents of the mini.iso for edgy on a USB stick instead of using the iso for the bulkier alternate CD. I only had to install syslinux and rename isolinux.cfg to syslinux.cfg (I didn't have to change the contents of the file). It was very easy. I didn't have to try fooling the installer into thinking the stick was the CD and mess with symlinks etc.'' -- [[UbuntuHelp:MikkelErup|MikkelErup]]
- ''I succeeded installing Ubuntu 7.04 (Feisty) with this guide and just a few changes I added. Ubuntu is running stable and without any problems'' -- Boo
+
 
 +
 
 +
- ''I succeeded installing Ubuntu 7.04 (Feisty) with this guide and just a fewchanges I added. Ubuntu is running stable and without any problems'' -- Boo
 +
 
 
- ''Short guide (to get the idea):
 
- ''Short guide (to get the idea):
 
mkfs.vfat /dev/<usbstick>; fdisk /dev/<usbstick> (make bootable); ./isostick.sh ubuntu-7.10-desktop-i386.iso /dev/<usbstick>;'' -- Syke
 
mkfs.vfat /dev/<usbstick>; fdisk /dev/<usbstick> (make bootable); ./isostick.sh ubuntu-7.10-desktop-i386.iso /dev/<usbstick>;'' -- Syke
 +
 
- ''Thanks for the advice guys, it also worked on my laptop: got it installed with 7.10 (and the encrypted LVM partitions I needed). I needed''
 
- ''Thanks for the advice guys, it also worked on my laptop: got it installed with 7.10 (and the encrypted LVM partitions I needed). I needed''
 
''a) a network link and install mini.iso http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/mini.iso,''  
 
''a) a network link and install mini.iso http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/mini.iso,''  

2008年12月22日 (一) 12:46的最新版本

从USB记忆棒安装Ubuntu

本文描述的安装版本是6.10以前的版本,请阅读者注意。
同时原文中有一些英文wiki读者之间的注释和问答,例如条目1.6,并没有进行翻译,
有兴趣的读者可以自行阅读,或者可以跳过阅读。谢谢!  
-- A2128(译者)

本页描述了如何利用拷贝安装光盘的相关文件到USB驱动器,如U盘(或者闪存卡)等,并使其成为引导盘的方法来安装Ubuntu。这种方法对于那些超轻超小的没有光盘驱动器,但是又可以从USB启动的笔记本电脑来说是非常方便的。 主要的步骤包括:

  • 准备USB记忆棒
  • 从USB记忆棒启动电脑
  • 从可启动光盘中安装Ubuntu

“注:” 强烈建议使用最新版本的Ubuntu来准备USB记忆棒。 还可以参考来自官方安装指导的文档instructions for USB sticks

检查你的USB记忆棒

从USB记忆棒启动会非常方便,但是否能成功对于你使用的特定电脑和USB记忆棒的组合是没有保证的。即使你能用你的USB记忆棒在一台电脑上成功启动,这部代表它能够正常工作在另外一台电脑上。如果出现这种情况,你需要在你的电脑上用各种不同的BIOS的设置来试验。 确认所选用的记忆棒有足够大的容量来存储来自安装CD的内容(大约700兆),推荐使用1G的记忆棒。SYSLINUX 3.00以前的版本需要使用FAT16文件系统,大多数USB记忆棒自动格式化为这种文件系统。FAT16是最兼容的文件系统,也是最推荐的。而在3.00版本,SYSLINUX也支持FAT32的文件系统。 将你想用做安装引导的USB记忆棒插入电脑,几秒钟之后运行命令“dmesg”,或者命令“sudo fdisk -l”来查找系统给USB记忆棒指定的盘符。下面的指导里将使用“/dev/sdX1”,记住用刚才查到的盘符来替换X。

自动安装

UNetbootin (图形界面,可以从Windows或者Linux中运行)

UNetbootin 可以通过提供图形界面的方式从ISO文件自动创建可引导的Ubuntu UBS驱动盘,它可以从Windows系统,Linux系统或者从Ubuntu Live CD中执行。 模板:Http://sourceforge.net/dbimage.php?id=167328

(可选项)如果你想激活Ubuntu Live CD的初始启动菜单,比如你想禁止framebuffer或者想读取Ubuntu Live CD的帮助屏幕和cheatcodes,请在UNetbootin安装完成之按照以下方法对你的USB记忆棒做修改: 1)删除SYSLINUX.CFG或者将其更名为SYSLINUX.OLD 2)进入ISOLINUX文件夹将ISOLINUX.CFG更名为SYSLINUX.CFG 3)返回上一级文件夹,将ISOLINUX文件夹更名为SYSLINUX

注:无法工作在8.10 intrepid的网络安装 - fails to detect available hard drives - 有什么办法吗?

Live USB creator (图形界面,从Live CD中运行)

Live USB creator可以自动完成从运行的Ubuntu Live CD创建可引导的USB记忆棒的过程。非常简单,运行Live CD,安装该工具,从系统管理菜单中启动USB的安装。

https://launchpad.net/liveusb -- probono

模板:Http://klik.atekon.de/liveusb/screenshot.png

注:无法工作,说是我只能从Live CD中运行???

isotostick.sh (命令行方式的shell脚本,从Linux中运行)

警告: 从不被信任的网站运行脚本是非常非常危险的! 最简单的方法,该方法也可以用于桌面安装,是使用http://www.startx.ro/sugar/ 提供的isotostick.sh脚本。可以通过以下方法下载该脚本,改变运行模式并运行它:

sudo apt-get install syslinux mtools
wget http://www.startx.ro/sugar/isotostick.sh
chmod +x isotostick.sh
sudo ./isotostick.sh ubuntu-7.10-desktop-i386.iso /dev/sdX1

别忘了用前面章节查到的你的USB记忆棒的盘符替换/dev/sdX1! 当脚本试图拷贝symlinks /dists/stable 和 /dists/unstable的时候,你可能会看到“operation not permitted”,没有关系,那是因为FAT16文件系统不能处理symlinks。 现在你可以像从安装光盘启动那样从USB记忆棒启动来安装Ubuntu了。

注: 不能工作在ubuntu-8.10-server-amd64.iso - 说是a common cdrom drive could not be found and won't proceed with installation - 有什么建议?

注: Trying to use this on a Feisty machine to copy a Gutsy (livecd) iso. The script does not appear to copy all of the folders. It also looks for /usr/bin/syslinux/mbr -- which is not present with syslinux from the Feisty repos. --JulesTheMisfit

注: Seems to work, hardy.iso on a hardy machine. ---Bas

ubuntu-server-flashdrive-installer.sh (命令行方式的shell脚本,从Linux中运行)

UbuntuServerFlashDriveInstaller 是从这个帖子里开始并继续完善的。

注: 不能工作在 ubuntu-8.10-server-amd64.iso - 说是 no usable ISO found - 有什么建议吗?

手动安装

简单来说,下面是你需要做的事情:

  • 用SYSLINUX创建可引导的USB记忆棒
  • 拷贝Ubunut光盘上的内容到USB记忆棒(确认包括隐藏的目录和文件)
  • 将目录isolinux 更名为 syslinux ,并将文件 isolinux.cfg 更名为 syslinux.cfg
  • 如果是老版本的syslinux的话 ,需要从子目录拷贝一些文件到根目录中并编辑一下 syslinux.cfg
  • 从你的USB记忆棒启动电脑
  • 如果是使用Alternate CD且7.04以前的版本的话, 需要在Ubuntu的安装过程中创建一个虚拟的光驱,并将USB记忆棒mount到 /cdrom
  • 如果是使用Alternate CD且是Ubuntu 8.04的话,请参考这个帖子 中关于文件系统的部分

用SYSLINUX创建可引导的USB记忆棒

SYSLINUX是一个Linux系统的系统引导器,工作在MS-DOS/Windows FAT文件系统下。大部分USB记忆棒缺省的文件系统就是FAT。下面介绍怎样在你的USB记忆棒上添加SYSLINUX引导区:

  1. 确认"syslinux"已经安装。在Linux和MS Windows(可执行文件在\win32\syslinux.exe)都可以找到SYSLINUX。从SYSLINUX的网页 http://www.syslinux.org/ 可以获得更多信息。在Ubuntu Linux下面,用下面的命令安装:
  2.  sudo apt-get install syslinux mtools
  3. 将USB记忆棒插入电脑并挂载它,这应该自动完成。如果你的电脑运行的是Linux而且没有自动挂载,你可以用命令手动挂载,比如 mount -t vfat /dev/sda1 /mnt 。注意在命令中所使用的挂载点(比如例子中的/mnt)。如果你用的是windows,它应该被自动识别。(如果没有的话,可能你的windows比较老,你需要先安装一个USB的驱动程序,请到USB记忆棒的厂家网页上查询。) 注意windows分配给USB记忆棒的盘符(比如F:)。
  4. 创建可引导的USB记忆棒。如果你使用的是Linux并且按照上面的方法完成挂载,则使用命令: syslinux -s /dev/sda1。如果你使用的是windows且系统分配的盘符比如说是F: ,则使用命令: syslinux -s -m F:
  5. 你应该能在USB记忆棒的根目录下看到一个文件名为 ldlinux.sys 的文件。(注意,这是一个隐藏文件,用windows的资源管理器可能看不到它;在DOS窗口下用命令dir /a F: )。这是你应该可以从USB记忆棒启动了,不过你只能看到SYSLINUX的提示符“boot:"。

Regarding the IDE disk: When in the USB cradle, the disk is sda, whereas when I mount it in the Libretto as the primary IDE disk, it is of course hda. (I shot myself in the foot a couple of times because of this ...) The automatic mounting is a bit distracting at times. My recommendation would be to pumount any device you intend to do any low-level operations on, and then mount and unmount as root as necessary. -- Ubuntu:Era

Make sure to include the -m option with the Windows version of syslinux, to ensure that it copies a fresh ISOLINUX master boot record (MBR.) Otherwise the preexisting MBR may be used, which therefore may not point to your syslinux.cfg file.

拷贝Ubuntu光盘文件到USB记忆棒

将Ubunut安装光盘的“内容”拷贝到USB记忆棒上(比如,所有光盘上文件和目录)。但是请“不”要拷贝安装光盘的iso镜像文件。实际上,你不需要刻张光盘在拷贝“内容”,在Linux下面可以通过挂载的方式实现:

mount -o loop /path/to/ubuntu.iso /path/to/mount/point

确认你同时拷贝了那些隐藏的文件和目录(例如那些以“."开头的文件和目录)。在Gnome下,可以用ctrl+H键看到隐藏文件。在MS Windows下面可以用这样的命令(假设D:是你的光驱而F:是你的USB记忆棒):

xcopy /e /h /k d:\*.* f:

向根目录下拷贝文件

如果你使用的是syslinux 3.5或者更新的版本(Ubuntu 7.10),请忽略此步。 从下面提到的USB记忆棒目录里面拷贝(或者移动)文件到根目录下:

  • isolinux (所有文件)
  • casper (vmlinuz和initrd.gz)
  • install (所有文件)

将dapper更名为stable

仅适用于Ubuntu 6.06 Alternate CD

dists/dapper 更名为 dists/stable

I think this depends slightly on which CD and which installer you're using. I've had problems when dists/dapper was missing and when dists/stable was missing and I'm not sure what the circumstances were. When it happens, just switch to a shell and rename it on the fly, then return to the installer and ask it to retry. (The vfat filesystem doesn't support symlinks, unfortunately. If you have spare disk space and a little patience, you could copy one to the other for the total belt and suspenders solution.) -- Ubuntu:Era

For anyone trying to install the new Ubuntu 7.04 (Feisty) with this guide: You can skip this step. In fact, it doesn't matter if you delete the file named dists/stable and rename the dists/feisty to dists/stable. -- Boo

修改 SYSLINUX.CFG

如果使用较新版本的syslinux, 你只需要将目录isolinux 更名为syslinux,并且将目录内的文件isolinux.cfg 更名为syslinux.cfg使用老版本的syslinux的话 拷贝(或者更名)文件 isolinux.cfgsyslinux.cfg。然后编辑文件,删除文件中所有路径参考中的/casper//install/ 字样。例如,你需要将包含 DEFAULT /casper/vmlinuz 的语句修改为 DEFAULT vmlinuz。保存文件并确认文件名为 syslinux.cfg.。文件中的换行符是linux格式还是DOS格式都没有关系。

Again, for anyone installing Ubuntu 7.04 (Feisty): Just remove the /install/ reference. The only line it is found is kernel /install/mt86plus, which must be changed to kernel /mt86plus. -- Boo

no, it is not. there were 23 entries on isolinux.cfg -- capi

I found twenty one, with Feisty, and syslinux 3.51 -- Gedanken

从USB记忆棒引导启动

现在从USB记忆棒引导启动电脑,然后可以完成象从安装光盘启动一样的安装工作。

将USB记忆棒挂载为/cdrom

这一步仅在Alternate CD安装Ubuntu 6.10,或者更早的版本的安装时才需要。

在启动最初的对话过程中(比如询问你愿意采用的安装语言时),按""ALT-2""切换到第二个虚拟命令行窗口。然后完成以下操作:

  • mkdir /cdrom /dev/cdroms
  • cd /dev/cdroms
  • ln -s ../sda1 cdrom0 (这里假设sda1是你的USB记忆棒)
  • mount -t vfat /dev/cdroms/cdrom0 /cdrom

然后按""ALT-1""切换回第一个虚拟窗口,可以继续象从光盘安装Ubuntu那样继续安装。

This was a bit tricky until I got the hang of it. You need to have the hardware detection detect your hda before you can mount it! But just wait until it complains about a missing CD-ROM, then don't try to helpfully tell it where to look. Just accept the dialog where it says that this stage failed, then switch over to the virtual console and mount -t vfat /dev/hda3 /cdrom. (I skipped the gyrations with /dev/cdroms, they don't seem to be necessary.) Back in the installer, you should now be able to proceed from the next point in the dialog. (Remember, I'm talking about the text-only installer. It might be different in the GTK install.) -- Ubuntu:Era

I think just ran into https://launchpad.net/distros/ubuntu/+source/casper/+bug/63277 -- Ubuntu:SvenHerzberg

When installing Ubuntu 7.04 (Feisty), there was no need for me to mount the flash. -- Boo

This is does not work for me using the alternate gutsy iso - i.e. mount -t vfat usbdev target fails with "no such device". There is a forum thread here: http://ubuntuforums.org/showthread.php?t=405008 Currently I know of no solution but to use the regular iso. -- Stenico

安装完成之后

安装完成之后,编辑/etc/fstab,确认 /media/cdrom0 指向光驱而不是USB记忆棒。如果你不做确认,那么有可能下一次你挂载USB硬件的时候会得到以下信息: "Cannot mount volume. Invalid mount option when attempting to mount the volume." 这是因为安装程序认为你是从一个光驱中安装的系统 (bug 150872).

打开并编辑/etc/fstab:

sudo gedit /etc/fstab

找到这一行(通常都在结尾):

/dev/sdb1 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0

在前面加上#号作为注释:

#/dev/sdb1 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0

如果你愿意的话,当然可以把真正的光驱挂载到/media/cdrom0 上。

保存文件,搞定。

参考

Comments and Troubleshooting

- For an alternative method that works with Feisty see: https://help.ubuntu.com/7.04/installation-guide/i386/boot-usb-files.html) -- Monkeymind

- The instructions there work great with gutsy as well, but on my machine i needed to add "vesa vga=771" to the "append=" line in syslinux.cfg. After that the process was completely unproblematic -- Matt Price

- I also succeeded in installing on a Libretto 100CT by using a 2.5" IDE disk in one of those cheap USB cradles. This machine has no CD-ROM, no floppy (on my unit), no USB. I've taken the liberty to annotate my experiences in an indented style, like this. -- Ubuntu:Era

- I installed on an IBM X40 using the contents of the mini.iso for edgy on a USB stick instead of using the iso for the bulkier alternate CD. I only had to install syslinux and rename isolinux.cfg to syslinux.cfg (I didn't have to change the contents of the file). It was very easy. I didn't have to try fooling the installer into thinking the stick was the CD and mess with symlinks etc. -- MikkelErup


- I succeeded installing Ubuntu 7.04 (Feisty) with this guide and just a fewchanges I added. Ubuntu is running stable and without any problems -- Boo

- Short guide (to get the idea): mkfs.vfat /dev/<usbstick>; fdisk /dev/<usbstick> (make bootable); ./isostick.sh ubuntu-7.10-desktop-i386.iso /dev/<usbstick>; -- Syke

- Thanks for the advice guys, it also worked on my laptop: got it installed with 7.10 (and the encrypted LVM partitions I needed). I needed a) a network link and install mini.iso http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/mini.iso, b) a working 7.10 system with syslinux and mtools (On feisty: apt-get install syslinux). c) cat /etc/mtab to find out my usb was at /dev/sdb1, mounted as /media/Flashdisk:

  • syslinux -s /dev/sdb1
  • mount -o loop /home/stilus/Desktop/mini.iso /media/cdrom0/
  • cp -r /media/cdrom0/* /media/Flashdisk
  • cd /media/Flashdisk
  • mv isolinux.cfg syslinux.cfg
  • cd /
  • umount /media/Flashdisk

Plugged this Flashdisk in my to-be-installed system, and that was that: let the netinstall begin!! -- stilus - This does not work, at least for me. Boot fails in syslinux already: selecting "install" boot menu option shows a dialog "install./vm" with button "Start", which does nothing. It seems it somehow tries to interpret the path "install/vmlinuz" as a single 8.3 filename, resulting in the nonsense "install./vm". Same happens for all other boot options. After booting manually, I got further errors later on when trying to find the packages to install. - What about a howto or tutorial about use Grub instead of syslinux ? - (Hardy) I had to toggle the bootable status of the USB stick using parted, as per the instructions isotostick.sh prints out: Partition isn't marked bootable! You can mark the partition as bootable with # /sbin/parted /dev/sdc (parted) toggle N boot (parted) quit

On Partitioning the Flash drive

- I partitioned the disk for installation with room for several boot images. I created hda1 for /boot (in retrospect, maybe not necessary), hda2 for swap (again in retrospect, could go in an extended partition; if I do it again I'll add the good old Woody installer rescue288 disk image -- still viable and valuable as a rescue disk!), hda3 for the Dapper 6.06 server install CD filesystem (this is a low-memory system which can't boot the regular live CD, I have been told), and hda4 as an extended partition for the remaining BIOS hibernation and actual root filesystem partitions. At this stage, I only marked the installer partition as bootable. It's a FAT16 partition (partition type 06). Since there is no filesystem yet, the newly created partition needs to be formatted. mkfs -t vfat /dev/sdXY ... and be real careful to not format the wrong disk by mistake. (So in my case, this would be sda3 here.) No need to mount any other partitions than hda3/sda3) although Ubuntu will in fact automatically try to mount all the ones which have a filesystem on them. Actually, I momentarily unplugged and then replugged the USB cable at this point to make sure the partition table was synced OK, and then the new partition was automatically mounted on /media/usbdisk (and usbdisk-1, usbdisk-2 etc for additional partitions or devices ... mount with no arguments will tell you what's where, if you're unsure).