NixOS Installation Guide/ru: Difference between revisions
Created page with "==Для Windows==" Tags: Mobile edit Mobile web edit |
Created page with "* Установка с помощью Unetbootin * Ручное создание загрузочного USB накопителя * Мультизагрузочная флешка" Tags: Mobile edit Mobile web edit |
||
| Line 64: | Line 64: | ||
</div> | </div> | ||
< | <span id="Alternative_installation_media_instructions"></span> | ||
== | ==Альтернативные способы установки== | ||
Способы приведенные выше являются одними из способов создания USB накопителя для загрузки | |||
Эти методы написаны в гайде, но вы их можете использовать и для создания мультизагрузочной флешки. Этот способ не поддерживается, результат может получиться разным | |||
* [[NixOS_Installation_Guide/Unetbootin|Установка с помощью Unetbootin]] | |||
* [[NixOS_Installation_Guide/Unetbootin| | * [[NixOS_Installation_Guide/Manual USB Creation|Ручное создание загрузочного USB накопителя]] | ||
* [[NixOS_Installation_Guide/Manual USB Creation| | * [[NixOS_Installation_Guide/multibootusb|Мультизагрузочная флешка]] | ||
* [[NixOS_Installation_Guide/multibootusb| | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Revision as of 05:33, 28 July 2026
Это руководство служит вспомогательным руководством для официального руководства. Оно описывает установку NixOS как полноценной операционной системы, смотрите Nix Installation Guide.
Помимо описания действий из официального руководства, здесь приводятся проверенные инструкции для типичных сценариев использования. В случае расхождения между руководством и данным документом приоритетным считается вариант, описанный в руководстве.
Цель установки
NixOS может быть установлена на различные типы устройств:
- обычные (Intel или AMD) настольные компьютеры, ноутбуки или физически доступные сервера, представленные на этой странице
- Мини-компьютеры (как Raspberry Pi's) или другие платы на архитектуре ARM, смотрите [[NixOS on ARM][
- Облачные или удаленные сервера, смотрите NixOS friendly hosters
Методы установки
NixOS, как и многие другие Linux-базированные операционные системы, может быть установлен разными путями
- Обычный способ, загрузка с загрузочного диска. (Написано ниже.)
- Booting the media from an existing Linux installation
Создание загрузочного диска
С NixOS 14.11 установочный ISO образ гибридный. Это значит что он может загружаться как с CD так и с USB накопителя. Он может загружаться как с EFI систем, с более современных материнских плат и компьютеров Apple. Данная инструкция покажет стандартный способ копирования образа на USB накопитель. Если у вас CD или DVD накопитель, используйте способы для записи диска с ISO образа.
Запись образа на USB накопитель
Для начала, скачайте образ NixOS ISO image или create a custom ISO. Затем, вставьте USB накопитель, размер которого больше чем вес образа. Затем, следуйте инструкциям:
Для Linux
- Найдите правильное устройство с
lsblkorfdisk -l. Переместите/dev/sdXна нужное устройство по следующим шагам. - Скопируйте на устройство:
cp nixos-xxx.iso /dev/sdX
Запишите образ на диск с помощью команды: dd if=nixos.iso of=/dev/sdX bs=4M status=progress conv=fdatasync
Для macOS
- Найдите правильное устройство:
diskutil list, затем напишите:diskX. - Размонтируйте:
diskutil unmountDisk diskX. - Запишите:
sudo dd if=path_to_nixos.iso of=/dev/diskX
Для Windows
- Download USBwriter.
- Start USBwriter.
- Choose the downloaded ISO as 'Source'
- Choose the USB drive as 'Target'
- Click 'Write'
- When USBwriter has finished writing, safely unplug the USB drive.
Альтернативные способы установки
Способы приведенные выше являются одними из способов создания USB накопителя для загрузки
Эти методы написаны в гайде, но вы их можете использовать и для создания мультизагрузочной флешки. Этот способ не поддерживается, результат может получиться разным
Booting the installation media
The installation media is hybrid and is capable of booting in both legacy BIOS mode and UEFI mode.
Whatever mode is used to boot the installation media, your motherboard or computer's configuration may need to be changed to allow booting from a Optical Disk Drive (for CD/DVD) or an external USB drive.
Legacy bios boot
This is the only boot possible on machines lacking EFI/UEFI.
UEFI boot
The EFI bootloader of the installation media is not signed and is not using a signed shim to boot. This means that Secure Boot will need to be disabled to boot.
Connecting to the internet
The installation will definitely need a working internet connection. It is possible to install without one, but the available set of packages is limited.
Wired
For network interfaces supported by the kernel, DHCP resolution should already have happened once the shell is available.
Tethered (Internet Sharing)
If you can not connect to the internet via cable or wifi, you may use smartphone's tethering capability to share internet. Depending on your smartphones capabilities, only stock kernel drivers may be required which can help providing a working network connection.
Wireless
NetworkManager is installed on the graphical ISO, meaning that it is possible to use nmtui on the command line to connect to a network.
Using the "Applications" tab at top
left or the launcher bar at bottom, choose a terminal application and from there launch nmtui. 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.
On the minimal ISO, or if you are more familiar with wpa_supplicant then you can also run wpa_passphrase ESSID | sudo tee /etc/wpa_supplicant.conf, then enter your password and systemctl restart wpa_supplicant.
Partitioning
To partition the persistent storage run sudo fdisk /dev/diskX and follow instructions for MBR or (U)EFI. To determine which mode you are booted into, run:
$ [ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "Legacy"
A very simple example setup is given here.
Legacy Boot (MBR)
- o (dos disk label)
- n new
- p primary (4 primary in total)
- 1 (partition number [1/4])
- 2048 first sector (alignment for performance)
- +500M last sector (boot sector size)
- rm signature (Y), if ex. => warning of overwriting existing system, could use wipefs
- n
- p
- 2
- default (fill up partition)
- default (fill up partition)
- w (write)
UEFI
- g (gpt disk label)
- n
- 1 (partition number [1/128])
- 2048 first sector
- +500M last sector (boot sector size)
- t
- 1 (EFI System)
- n
- 2
- default (fill up partition)
- default (fill up partition)
- w (write)
Format partitions
The example below uses the ext4 filesystem format. If you wish to use other filesystem formats such as Btrfs or ZFS:
This is useful for having multiple setups and makes partitions easier to handle
$ lsblk # lists current system block devices
# mkfs.fat -F 32 -n boot /dev/sdX1
# mkfs.ext4 /dev/sdX2 -L nixos
# mount /dev/disk/by-label/nixos /mnt
# mkdir -p /mnt/boot
# mount /dev/disk/by-label/boot /mnt/boot
NixOS configuration
NixOS is configured through a declarative configuration file. To generate a default config file, run nixos-generate-config:
# nixos-generate-config --root /mnt
# nano /mnt/etc/nixos/configuration.nix
For information on working with a system configuration, see NixOS system configuration. For desktop-specific configurations, see NixOS as a desktop.
Most essential changes:
- keyboard layout, ie
services.xserver.xkb.layout - networking (wifi), see below for fix if it breaks
- install editor to edit the configuration
The self-documenting NixOS options can be searched with NixOS options search.
Swap file
For additional methods of configuring swap, see Swap. The following example demonstrates how to create and enable a swap file:
swapDevices = [{
device = "/var/lib/swapfile";
size = 16*1024; # 16 GB
}];
Bootloader
NixOS supports multiple bootloaders such as GNU GRUB and Systemd/boot.
Systemd-boot is the recommended bootloader. The following example demonstrates how to enable systemd-boot in your configuration:
boot.loader.systemd-boot.enable = true;
You may also wish to configure Secure Boot.
Users
For information on creating and managing users, see User management and the NixOS Manual: Chapter - Package Management. See an example below:
users.users.alice = {
isNormalUser = true;
initialPassword = "pw123";
};
NixOS installation
# cd /mnt
# nixos-install
after installation: Run passwd to change user password.
if internet broke/breaks, try one of the following:
# nixos-rebuild switch --option substitute false # no downloads
# nixos-rebuild switch --option binary-caches "" # no downloads
- wpa_supplicant flags to connect to wifi
Additional notes for specific hardware
These are collected notes or links for specific hardware issues.
- Blog post how to install NixOS on a Dell 9560
- Brand servers may require extra kernel modules be included into initrd (
boot.initrd.extraKernelModulesin configuration.nix) For example HP Proliant needs "hpsa" module to see the disk drive.