# Install Arch from network via PXE (Русский)

## Загрузка по сети

Ваш крошечный ноутбук поставляется без дисковода, и не позволяет загружаться с USB-накопителя? Не бойтесь, вы можете загрузить с помощью PXE.

PXE сокращение от Preboot eXecution Environment (произносится пикси) - среда находящиеся глубоко в BIOS для загрузки компьютера с помощью сетевой карты. Для того чтобы загрузить PXE проверьте опции загрузки в BIOS. Обычно используется Ethernet порт.

### Как это работает

Грубое описание процесса загрузки с помощью PXE:

- клиент (тот компьютер на который вы хотите установить) загружается в окружающую среду и просит непрерывно для аренды DHCP (IP если хотите).
- DHCP передает IP клиенту.
- затем TFTP (который очень похож на регулярный FTP) сервер обеспечивает загрузку файлов для клиента.

после этого клиент загружается. После загрузки можно довольно безопасно при необходимости убить соединение (для установки по сети, образ загружается через TFTP).

### Реквизиты

You need at least the following:

- a server capable of running DHCPD
- a server capable of running (a)tftpd
- the archboot installation iso (the official images can not be used for this)

The DHCP and tftp server can be the same computer if you only have one.

Be sure to have the ports to the client (or target) open. When in doubt consider disabling iptables or any firewall that might be active.

Also be sure that the interface (ethX usually) is up and active.

    ifconfig eth0 up
    ifconfig eth0 192.168.0.2

If you want to boot without a router between the server and the client you have to manually set an IP for ethX and a route.

    ip route add default via 192.168.0.1

a nameserver needs also to be added.

    echo nameserver 192.168.0.1 >> /etc/resolv.conf

If a router is between the server and the client disabling DHCP on the router might be necessary, else you should be able to ignore these steps.

Alternatively, if your router has dnsmasq installed (like the *WRT family) you can configure it in the router with the following option:

    dhcp-boot=pxelinux.0,<hostname-of-the-tftd-server>,<ip-of-the-tftd-server>

Here is an example for DD-WRT.

## Подготовка tftpd

Mount archboot.iso and copy the contents of the folder boot to /var/tftpboot/:

    mount -o loop,ro archboot.iso /mnt/iso
    cp -a /mnt/iso/boot/ /var/tftpboot

Move the contents of the folder isolinux (or syslinux) to tftpboot root:

    mv /var/tftpboot/boot/syslinux/* /var/tftpboot/
    rmdir /var/tftpboot/boot/syslinux

Create pxelinux configuration:

    mkdir /var/tftpboot/pxelinux.cfg
    mv /var/tftpboot/syslinux.cfg /var/tftpboot/pxelinux.cfg/default

Your Arch Linux network installer is now ready.

## Способ 1 - Использование DNSMASQ

This one is a bit easier since dnsmasq already has a tftp server builtin. Install dnsmasq on your server:

    pacman -S dnsmasq

Edit the configuration file for dnsmasq in:

    /etc/dnsmasq.conf

The configuration file comments are rather verbose and should be self-explanatory. You should at least enable the following settings:

    dhcp-range=192.168.0.50,192.168.0.150,12h
    dhcp-boot=pxelinux.0
    enable-tftp
    tftp-root=/var/tftpboot

As for the necessary files to be able to boot follow the instructions as given at "Preparing tfptd". Now run dnsmasq.

    rc.d start dnsmasq

## Способ 2 - использование DHCPD

Install the necessary programs on the existing Arch Linux computer which will act as the server for the installation on your client:

    pacman -S tftp-hpa dhcp

Replace the default /etc/dhcpd.conf with the following (adjust to your network environment):

    # /etc/dhcpd.conf
    option domain-name-servers 208.67.222.222, 208.67.220.220;
    default-lease-time 86400;
    max-lease-time 604800;
    authoritative;
    subnet 192.168.0.0 netmask 255.255.255.0 {
     range 192.168.0.10 192.168.0.49;
     filename "pxelinux.0";        # the PXELinux boot agent
     option subnet-mask 255.255.255.0;
     option broadcast-address 192.168.0.255;
     option routers 192.168.0.1;
    }

Dhcpd will not run without ipv6. If you have disabled ipv6, reload the module:

    modprobe ipv6

Be sure to static the LAN IP to the same subnet as option routers IP to get the DHCP server to start: ifconfig eth0 192.168.0.1 255.255.255.0

Now make sure the dhcpd and tftpd daemons are running on the server.

    # /etc/rc.d/tftpd start
    # /etc/rc.d/dhcpd start

Boot your destination machine over PXE (usually something like F12 (on Dells) or F11 (on Supermicro's), or enable it in the BIOS).

When you get the PXEBoot prompt, type 'arch' or hit return to start the installer. The install should now progress the same as if you booted from CD. You can continue installation by following the Beginners' guide or the Installation guide.

Category:

- Getting and installing Arch (Русский)