Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Install/Chroot/zh-cn"

From Funtoo
Jump to navigation Jump to search
(Created page with "<includeonly> == Chroot into Funtoo == </includeonly><noinclude><languages/> = 安装指南: Chroot 到 Funtoo 中 =")
 
(Updating to match new version of source page)
 
(11 intermediate revisions by 2 users not shown)
Line 6: Line 6:
{{InstallNavigation|num=9|prev=Download and Extract Stage3|next=Download Portage Tree}}</noinclude>
{{InstallNavigation|num=9|prev=Download and Extract Stage3|next=Download Portage Tree}}</noinclude>


To install Funtoo Linux, the {{c|chroot}} command is first used. The chroot command will "switch into" the new Funtoo Linux system, so the commands you execute after running "chroot" will run within your newly-extracted Funtoo Linux system.
<div class="mw-translate-fuzzy">
要安装 Funtoo Linux,首先要使用 {{c|chroot}} 命令。Chroot 命令将“切换到”新的 Funtoo Linux 系统中,所以你在运行 "chroot" 后执行的命令将在你新提取的 Funtoo Linux 系统中运行。
</div>


Before chrooting, there are a few things that need to be done to set up the chroot environment. You will need to mount {{f|/proc}}, {{f|/sys}} and {{f|/dev}} inside your new system. Use the following commands to do so:
<div lang="en" dir="ltr" class="mw-content-ltr">
{{console|body=
# ##i##fchroot /mnt/funtoo
%fchroot%
}}
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
The {{c|fchroot}} command will take care of all necessary steps to enter into your new Funtoo Linux system, as well as clean up things when you exit the fchroot by typing
{{c|exit}} or {{c|ctrl-D}}.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
If you are using another LiveCD or USB media to install Funtoo, you can manually chroot by using the following set of commands:
</div>
 
<div class="mw-translate-fuzzy">
在进行 chroot 之前,需要做一些设置 chroot 环境的工作,你需要在新系统中挂载 {{f|/proc}}{{f|/sys}} {{f|/dev}}。使用以下命令来完成:
{{console|body=
{{console|body=
# ##i##cd /mnt/funtoo
# ##i##cd /mnt/funtoo
Line 15: Line 34:
# ##i##mount --rbind /dev dev
# ##i##mount --rbind /dev dev
}}
}}
</div>


You'll also want to copy over {{f|resolv.conf}} in order to have proper resolution of Internet hostnames from inside the chroot:
{{Note|对于使用 64 位 Live CD 安装 32 位系统用户请注意:一些软件使用 {{c|uname -r}} 来检查系统是 32 位或是 64 位。你可能需要将 linux32 指令附加在 chroot 指令中执行来解决这个问题,但通常情况下是不需要的。}}
{{console|body=
{{Important|如果你得到了 "{{c|chroot: failed to run command `/bin/bash': Exec format error}}" 这个错误,多数情况是尝试在 32 位内核中执行 64 位指令。确保在启动临场 CD 时选择了正确的内核类型。}}
# ##i##cp /etc/resolv.conf /mnt/funtoo/etc/
}}
Now you can chroot into your new system. Use <code>env</code> before <code>chroot</code> to ensure that no environment settings from the installation media are pulled in to your new system:
 
{{console|body=###i## env -i HOME=/root TERM=$TERM chroot . bash -l
%chroot% }}
 
{{Note|For users of live CDs with 64-bit kernels installing 32-bit systems: Some software may use {{c|uname -r}} to check whether the system is 32 or 64-bit. You may want to append linux32 to the chroot command as a workaround, but it's generally not needed.}}
{{Important|If you receive the error "{{c|chroot: failed to run command `/bin/bash': Exec format error}}", it is most likely because you are running a 32-bit kernel and trying to execute 64-bit code. Make sure that you have selected the proper type of kernel when booting your live CD.}}


It's also a good idea to change the default command prompt while inside the chroot. This will avoid confusion if you have to change terminals. Use this command:
<div class="mw-translate-fuzzy">
chroot 中更改默认的命令提示符也是一个好主意。这样可以避免在你必须更换终端时出现混乱。使用这个命令:
{{console|body=%chroot% ##i##export PS1="(chroot) $PS1"}}
{{console|body=%chroot% ##i##export PS1="(chroot) $PS1"}}
Test internet name resolution from within the chroot:
chroot 中测试互联网名称的解析:
{{console|body=%chroot% ##i##ping -c 5 google.com}}
{{console|body=%chroot% ##i##ping -c 5 google.com}}
</div>


If you can't ping, make sure that {{f|/etc/resolv.conf}} specifies a valid IP address for a reachable nameserver in its {{c|nameserver}} setting.
如果不能 ping,请确保 {{f|/etc/resolv.conf}} 在其 {{c|nameserver}} 设置中为可到达的命名服务器指定一个有效的 IP 地址。


Congratulations! You are now chrooted inside a Funtoo Linux system. Now it's time to get Funtoo Linux properly configured so that Funtoo Linux will start successfully, without any manual assistance, when your system is restarted.
可喜可贺!你现在已经 chroot 进入了一个新的 Funtoo Linux 系统中。是时候正确地配置 Funtoo Linux ,以便在没有任何手动设置的情况下,让它能正确的重启并且运行。
<noinclude>{{InstallNavigation|num=9|prev=Download and Extract Stage3|next=Download Portage Tree|align=right}}</noinclude>
<noinclude>{{InstallNavigation|num=9|prev=Download and Extract Stage3|next=Download Portage Tree|align=right}}</noinclude>

Latest revision as of 01:00, May 26, 2023

Other languages:
English • ‎Türkçe • ‎español • ‎polski • ‎português do Brasil • ‎русский • ‎中文(中国大陆)‎

安装指南: Chroot 到 Funtoo 中

Install Guide, Chapter 9 < Prev Next >

要安装 Funtoo Linux,首先要使用 chroot 命令。Chroot 命令将“切换到”新的 Funtoo Linux 系统中,所以你在运行 "chroot" 后执行的命令将在你新提取的 Funtoo Linux 系统中运行。

root # fchroot /mnt/funtoo
fchroot #

The fchroot command will take care of all necessary steps to enter into your new Funtoo Linux system, as well as clean up things when you exit the fchroot by typing exit or ctrl-D.

If you are using another LiveCD or USB media to install Funtoo, you can manually chroot by using the following set of commands:

在进行 chroot 之前,需要做一些设置 chroot 环境的工作,你需要在新系统中挂载 /proc/sys/dev。使用以下命令来完成:

root # cd /mnt/funtoo
root # mount -t proc none proc
root # mount --rbind /sys sys
root # mount --rbind /dev dev
   Note

对于使用 64 位 Live CD 安装 32 位系统用户请注意:一些软件使用 uname -r 来检查系统是 32 位或是 64 位。你可能需要将 linux32 指令附加在 chroot 指令中执行来解决这个问题,但通常情况下是不需要的。

   Important

如果你得到了 "chroot: failed to run command `/bin/bash': Exec format error" 这个错误,多数情况是尝试在 32 位内核中执行 64 位指令。确保在启动临场 CD 时选择了正确的内核类型。

在 chroot 中更改默认的命令提示符也是一个好主意。这样可以避免在你必须更换终端时出现混乱。使用这个命令:

chroot # export PS1="(chroot) $PS1"

在 chroot 中测试互联网名称的解析:

chroot # ping -c 5 google.com

如果不能 ping,请确保 /etc/resolv.conf 在其 nameserver 设置中为可到达的命名服务器指定一个有效的 IP 地址。

可喜可贺!你现在已经 chroot 进入了一个新的 Funtoo Linux 系统中。是时候正确地配置 Funtoo Linux ,以便在没有任何手动设置的情况下,让它能正确的重启并且运行。

Install Guide, Chapter 9 < Prev Next >