NixOS Installation Guide/zh: Difference between revisions

Mayer (talk | contribs)
Created page with "== NixOS安装 == <syntaxhighlight lang="console"> $ cd /mnt $ sudo nixos-install </syntaxhighlight>安装完成后: 运行 <code>passwd</code> 来修改用户的密码."
Mayer (talk | contribs)
Created page with "* o (dos硬盘标签) * n new * p primary (4 primary in total) * 1 (分区编号[1/4]) * 2048 first sector (alignment for performance) * +500M last sector (引导扇区的大小) * rm signature (Y), if ex. => warning of overwriting existing system, could use wipefs * n * p * 2 * default (填满分区) * default (填满分区) * w (写入)"
Tags: Mobile edit Mobile web edit
(21 intermediate revisions by the same user not shown)
Line 25: Line 25:
== 制作安装媒介 ==
== 制作安装媒介 ==


从NixOS 14.11开始, 安装程序ISO(镜像文件)是混合型的. 这意味着它通过CD和USB驱动器都可以启动. 它也可以在EFI系统上启动, 如大多数现代主板和苹果系统. 接下来的指导将假设复制镜像文件到USB驱动器的标准方式. 当使用CD或者DVD时, 刻录到光盘的通常方式应当也适用于该iso文件.
从NixOS 14.11开始, 安装程序ISO(镜像文件)是混合型的. 这意味着它通过CD和USB驱动器都可以启动. 它也可以在EFI系统上启动, 如大多数现代主板和苹果系统. 接下来的指导将假设使用复制镜像文件到USB驱动器的标准方式. 当使用CD或者DVD时, 刻录到光盘的通常方式应当也适用于该iso文件.


<span id="&quot;Burning&quot;_to_USB_drive"></span>
<span id="&quot;Burning&quot;_to_USB_drive"></span>
Line 38: Line 38:
# 复制到设备: <code>cp nixos-xxx.iso <em>/dev/sdX</em></code>
# 复制到设备: <code>cp nixos-xxx.iso <em>/dev/sdX</em></code>


{{note|不要使用 /dev/sdX1 或硬盘的分区, 使用整块硬盘 /dev/sdX}}
{{note|不要使用 /dev/sdX1 或硬盘的分区, 使用整块硬盘 /dev/sdX}}


也可通过 <code>dd if=nixos.iso of=/dev/sdX bs=4M status=progress conv=fdatasync</code> 写入硬盘镜像
也可通过 <code>dd if=nixos.iso of=/dev/sdX bs=4M status=progress conv=fdatasync</code> 写入硬盘镜像
Line 45: Line 45:
==== 在macOS上 ====
==== 在macOS上 ====


<div lang="en" dir="ltr" class="mw-content-ltr">
# 使用<code>diskutil list</code>找到正确的设备, 比如说<code><i>diskX</i></code>.
# Find the right device with <code>diskutil list</code>, let's say <code><i>diskX</i></code>.
# 使用<code>diskutil unmountDisk <i>diskX</i></code>取消挂载.
# Unmount with <code>diskutil unmountDisk <i>diskX</i></code>.
# 使用<code>sudo dd if=<b>path_to_nixos.iso</b> of=/dev/<i>diskX</i></code>进行刻录
# Burn with: <code>sudo dd if=<b>path_to_nixos.iso</b> of=/dev/<i>diskX</i></code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{tip|使用<code>rdiskX</code>而不是<code>diskX</code>可以大幅改变速度. 你可以在另一个终端里使用<code>iostat 2</code>检查写入速度.}}
{{tip|Using <code>rdiskX</code> instead of <code>diskX</code> can makes a large speed difference. You can check the write speed with <code>iostat 2</code> in another terminal.}}
</div>


<span id="From_Windows"></span>
<span id="From_Windows"></span>
==== 在Windows上====
==== 在Windows上====


<div lang="en" dir="ltr" class="mw-content-ltr">
# 下载USBwriter.
# Download [http://sourceforge.net/projects/usbwriter/ USBwriter].
# 启动USBwriter.
# Start USBwriter.
# 选择下载的ISO文件作为'Source'
# Choose the downloaded ISO as 'Source'
# 选择USB驱动器作为'Target'
# Choose the USB drive as 'Target'
# 点击'Write'
# Click 'Write'
# 当USBWriter完成写入操作后, 安全拔出USB驱动器
# When USBwriter has finished writing, safely unplug the USB drive.
</div>


<span id="Alternative_installation_media_instructions"></span>
<span id="Alternative_installation_media_instructions"></span>
Line 85: Line 79:
因为安装媒介是混合型的, 它通过legacy bios模式和UEFI模式都可以启动.
因为安装媒介是混合型的, 它通过legacy bios模式和UEFI模式都可以启动.


无论使用哪种方式启动安装媒介, 你可能需要修改主板或者电脑的配置, 以允许从光盘驱动器(对于CD/DVD)或者一个外部的USB驱动器启动.
无论使用哪种方式启动安装媒介, 你可能需要修改主板或者电脑的配置, 以允许从光盘驱动器(对于CD/DVD)或者一个外部的USB驱动器启动.


<span id="Legacy_bios_boot"></span>
<span id="Legacy_bios_boot"></span>
Line 115: Line 109:
=== 无线网络 ===
=== 无线网络 ===


Network Manager安装在图形界面ISO文件中, 意味着可以在命令行中使用<code>nmtui</code>来连接到网络.
Network Manager安装在图形界面ISO文件中, 意味着可以在命令行中使用<code>nmtui</code>来连接到网络.


<div lang="en" dir="ltr" class="mw-content-ltr">
使用左上方的"Applications(应用)"标签页或者在底部的启动栏, 打开一个终端应用, 在那里启动 <code>nmtui</code>. 这可以让你'activate(激活)'一个(无线)连接 - 你应该可以在列表里看到你那里的SSID(无线网络名称), 除此之外你还可以添加一个新的连接. 当无线连接处于活动状态, 并且你已经测试过了时, 一开始就启动的安装程序很可能还没有检测到新的连接. 关掉安装程序, 再重新从屏幕底部的启动栏打开它. 这时它应该会检测到新的网络连接而继续.
Using the "Applications" tab at top
left or the launcher bar at bottom, choose a terminal application and from there launch <code>nmtui</code>. This will allow you to 'activate' a (wireless) connection - your local SSIDs should be visible in the list, else you can add a new connection. When the wireless connection is active and you have tested it, it is likely the install app which launched on startup has not detected the new connection. Close down the install app, and reopen it from the launcher bar at the bottom of the screen. This should then find the new connection and proceed.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
在最小化安装的ISO文件上(或者你更熟悉 <code>wpa_supplicant</code> ), 你也可以运行 <code>wpa_passphrase ESSID | sudo tee /etc/wpa_supplicant.conf</code>, 然后输入你的密码, 再运行<code>systemctl restart wpa_supplicant</code>.
On the minimal ISO, or if you are more familiar with <code>wpa_supplicant</code> then you can also run <code>wpa_passphrase ESSID | sudo tee /etc/wpa_supplicant.conf</code>, then enter your password and <code>systemctl restart wpa_supplicant</code>.
</div>


<span id="Partitioning"></span>
<span id="Partitioning"></span>
Line 134: Line 123:
=== DOS ===
=== DOS ===


<div lang="en" dir="ltr" class="mw-content-ltr">
* o (dos硬盘标签)
* o (dos disk label)
* n new
* n new
* p primary (4 primary in total)
* p primary (4 primary in total)
* 1 (partition number [1/4])
* 1 (分区编号[1/4])
* 2048 first sector (alignment for performance)
* 2048 first sector (alignment for performance)
* +500M last sector (boot sector size)
* +500M last sector (引导扇区的大小)
* rm signature (Y), if ex. => warning of overwriting existing system, could use wipefs
* rm signature (Y), if ex. => warning of overwriting existing system, could use wipefs
* n
* n
* p
* p
* 2
* 2
* default (fill up partition)
* default (填满分区)
* default (fill up partition)
* default (填满分区)
* w (write)
* w (写入)
</div>


=== UEFI ===
=== UEFI ===
Line 208: Line 195:
</syntaxhighlight>安装完成后: 运行 <code>passwd</code> 来修改用户的密码.
</syntaxhighlight>安装完成后: 运行 <code>passwd</code> 来修改用户的密码.


<div lang="en" dir="ltr" class="mw-content-ltr">
如果网络出现问题, 请尝试下面的一种方法:<syntaxhighlight lang="console">
if internet broke/breaks, try one of the following:<syntaxhighlight lang="console">
$ nixos-rebuild switch --option substitute false # 无下载
$ nixos-rebuild switch --option substitute false # no downloads
$ nixos-rebuild switch --option binary-caches "" # 无下载
$ nixos-rebuild switch --option binary-caches "" # no downloads
</syntaxhighlight>
</syntaxhighlight>
* wpa_supplicant flags to connect to wifi
* 设置wpa_supplicant标志来连接到wifi.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<hr />
<hr />
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Additional_notes_for_specific_hardware"></span>
== Additional notes for specific hardware ==
== 有关特定硬件的附加说明 ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
这些是有关特定硬件问题的收集到的说明或链接.
These are collected notes or links for specific hardware issues.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">