- Pxe boot linux mint
- Как настроить с нуля PXE-установку Linux?
- Pxe boot linux mint
- 4.2.2.2 Configuring the TFTP Server
- 4.2.2.3 Configuring the NFS Server
- 4.2.3 Installing Linux on a Server Blade from a Linux PXE Boot Server
- 4.3.1 Files Relevant to PXE Boot Installation
- 4.3.2 Preparing to Install Linux
- 4.3.3 Configuring the PXE Boot Servers
- 4.3.3.1 Configuring the DHCP Server
- 4.3.3.2 Configuring the NFS Server
Pxe boot linux mint
Каждому, кто хоть изредка промышляет администрированием хотя бы раз нужно было установить операционку на комп. И зачастую происходит всё так: скачивается образ, записывается на диск или флешку, грузимся и ставим. Но может оказаться что ни флешки ни диска под рукой нет, а установку нужно выполнить на вчера. Тогда можно загрузится по сети, и с линуксом в этом плане особо проблем нет. Типичная конфигурация — это связка DHCP, TFTP и NFS. Но у меня под рукой не было настроенного NFS, зато была Samba. Поэтому пришлось разобраться как использовать Samba вместо NFS.
Вроде бы ничего такого, поменял настройки и всё, но что-то не работало поначалу, пришлось шаманить.
Но я тут начну с самого начала. Итак для начала нужно обзавестись дистрибутивом. Так как ставим мы Linux Mint, ищем свежий образ здесь. Скачиваем дистрибутив, подходящий именно нам (я ставил тот, что с MATE, но очевидно это не имеет особого значения). Скачав образ, нужно получить доступ к файлам образа. В некоторых руководствах рекомендуют распаковать образ, но я не вижу в этом смыла, поэтому поддерживаю мнение, которое заключается в том, чтобы смонтировать образ как loop. Чтобы не вмешиваться в существующий порядок, просто создаём новый каталог, куда и монтируем образ:
Далее нужно сделать файлы доступными по сети для чтения установщиком. Как я говорил выше, у меня для этого служит Samba. Поэтому открываем файл конфигурации и добавляем новую шару, добавив такую секцию:
Должно работать поверх дефолтных настроек Samba. Если же не работает, то скорее всего вы что-то меняли сами, а значит найдёте как решить проблему. Итак мы добавили шару mint, через которую можно с сети получить файлы для установки. Не забудьте перезапустить Samba для принятия новых настроек.
Для Archlinux:
Для Gentoo:
Далее нужно подготовить сетевой загрузчик. В этом нам поможет программа tftp-hpa. В Archlinux и в Gentoo пакет называется именно так. Нужно расположить файлы загрузчика в рабочем каталоге ftp-сервера (в арче /srv/tftp). Копируем туда ядро и initrd со смонтированного образа:
Далее нам нужен syslinux. С него нужно собственно PXE-загрузчик:
Далее нужно подготовить файл конфигурации для загрузчика. Для этого создаём файл /srv/tftp/pxelinux.cfg/default. Туда пишем такое:
Где 192.168.0.1 — наш IP-адрес относительно машины, на которую быдем ставить. Ах да, и про nfs там — это не опечатка, в режиме работы с cifs, нужно передавать опции типа как для nfs, не могу сказать почему. Особое внимание нужно обратить на опцию toram, поскольку без неё всё отваливается на полпути и загрузится мы не можем (может это особенности самбы). Но с этой опцией нужно помнить о том, что на целевой машине должно быть достаточно оперативки, чтобы скопировать туда установщик. TFTP-сервер нужно запустить. Для Archlinux:
Для Gentoo:
Теперь нужно биосу целевой машины как-то сказать откуда грузится. В этом нам поможет dnsmasq (хотя не обязательно, можно использовать и другой DHCP сервер, здесь описываю то, что было под рукой). Настраиваем раздачу IP (опция dhcp-range) на своё усмотрение, под свою «сеть» между машинами. Для установки нам важны лишь три опции:
Их нужно добавить к конфигурации dnsmasq, ну и естественно запустить его (или перезапустить).
Для Archlinux:
Для Gentoo:
Помните, чтобы всё заработало необходимо, чтобы порты на DHCP (UDP 67,68), TFTP (UDP 69), Samba (UDP 137,138, TCP 139,445) должны быть обязательно открыты, обязательно учтите это в конфигурации своего фаерволла. Если же фаерволла нет или полностью открыт интерфейс — ну и ладно, должно работать.
Вобщем далее подключаемся к сети (куда смотрят dnsmasq, tftp-hpa и samba), выбиарем Network boot и ставим систему. По завершении останавливаем серверы, размонтируем ISO.
Примечание: в связи с тем, что системы постоянно обновляются, приведённые пути файлов могут оказаться недействительными, то есть отличными от тех, что на Вашей системе. Поэтому внимательно смотрите на структуру пакетов Вашей системы.
Источник
Как настроить с нуля PXE-установку Linux?
Ничего сложного, только описывать долго, постараюсь кратко с примерами.
В конфиг DHCP добавляем настройку типа:
Ключевое это строки с передачей IP для сервера TFTP и имя файла загрузчика.
Делаем каталог для будущих образов
Устанавливаем tftp-hpa (легко найти для любой системы)
В конфиге ставим флаги:
«-p -s /usr/tftpboot -B 1024 —ipv4»
Разархивируем
tar tar xjf syslinux-4.04.tar.bz2 -C /tmp
копируем в /usr/tftpboot/ следующие файлы:
Так же если планируем использовать кириллицу в меню скачаем шрифты, например эти
ftp://ftp.itrc.hp.com/applications/experteventadmi.
Кодировка меню должна быть в CP866 он же Russian(DOS)
сконвертировать из koi8-r (тандартная кирилическая для фри) можно командой.
iconv -f koi8-r -t CP866 defaultKoi8 -o default
создаем папку с образами
mkdir images
В ней подпапки с нужными системами, в каждую подпапку кидаем нужные для загрузки систем файлы, вот пару примеров:
Далее правим фаил конфига загрузчика:
/usr/tftpboot/pxelinux.cfg/default (Ну или с привязкой к конкретным сервакам, тогда не default)
Вот пример, пути править на свои:
Для загрузки windows нужно использовать специально собранный образ WinPE, который будет монтировать нужные образы с сетевой шары, но описание сборки вменяемого образа займет еще страниц 5 и мне лень уже печатать.
Источник
Pxe boot linux mint
CODE EXAMPLE 4-1 shows a sample /etc/dhcpd.conf file
The important areas in this example are the address of the TFTP server
( next-server 172.16.11.8 ) and the filename of the stage 1 bootloader image ( filename «/
/sun/pxelinux.bin» ).
Note — Nameserver and web server software is provided with the Red Hat Enterprise Linux distribution. Installation and configuration of these applications is outside the scope of this document.
Note — If no Nameserver is configured, change get-lease-hostnames to off .
4.2.2.2 Configuring the TFTP Server
The TFTP server supplies the PXE boot with the stage 1 bootloader image. This image loads the installation kernel which performs the actual installation on the hard disk through the use of the custom initrd.img supplied by Red Hat.
Use the tftp-server package provided with your Linux distribution to provide TFTP services.
1. Create the TFTP directory. Ensure that all users have read/execute access to the TFTP directory:
2. Modify the /etc/xinetd.d/tftp file (for Red Hat) or the /etc/inetd.conf file (for SuSE) to allow TFTP services:
If you are installing Red Hat, update the /etc/xinetd.d/tftp file. You need to change the server_args entry to -s /tftp . (The /tftp path is the directory in which the PXE images are copied.)
If you are installing SuSE, update the /etc/inetd.conf file by inserting the following line:
3. If you are installing SuSE skip to Step 4. If you are installing Red Hat, configure the TFTP server to be enabled at installation.
Change the disable entry to disable= no .
Note — At installation the TFTP server is disabled by default ( disable = yes ).
4. Enable the TFTP server.
For Red Hat, type:
Note — No output is returned if the command succeeds.
5. Restart xinetd (for Red Hat) or inetd (for SuSE):
For Red Hat, type:
6. Validate the configuration:
The output should be:
Example of the tftp File for Red Hat
shows an example of the /etc/xinetd.d/tftp file for Red Hat:
Example /etc/xinetd.d/tftp file for Red Hat
4.2.2.3 Configuring the NFS Server
The NFS server is used by the installation kernel to read all of the packages necessary to the installation process. The NFS server therefore needs to provide access to the directory structure containing the PXE images.
1. Update the /etc/exports file to include the export for the NFS server.
Insert the following line into file /etc/exports :
2. Enable the NFS server.
For Red Hat, type:
Note — No output is returned if the command succeeds.
3. Restart the NFS server.
For Red Hat, type::
4. Validate the configuration:
The output should include the line:
4.2.3 Installing Linux on a Server Blade from a Linux PXE Boot Server
Note — IMPORTANT: Before installing Linux, ensure that the boot directory on the PXE server (/ tftp ) has enough space to accommodate the version of Linux you are installing. You will require about 6 Gbytes of free space.
Note — The PXE boot server should be running Enterprise Linux version AS 2.1 or EL 3.0, or SuSE Linux Enterprise Server 8, service pack 3.
|
1. If you have configured a firewall, make sure that the TFTP, NFS, and DHCP protocols are not filtered on the server to be used as the PXE boot server.
2. Alternatively, disable the firewall and prevent it from running on subsequent reboots.
To do this, for Red Hat, type:
Note — These examples assume that you are using iptable firewalls. iptable firewalls are not installed by default on SuSE.
3. Ensure that the DHCP server, NFS server and TFTP server have been configured correctly.
4. Install the PXE images onto the TFTP server:
Note — If you are running SuSE on your PXE boot server, replace /mnt/cdrom with /media/cdrom in the instructions below. For example, mount /mnt/cdrom would be mount /media/cdrom .
a. Copy the required Linux directory from the root of the Sun Fire B1600 Platform Documentation, Drivers, and Installation CD to the /tftp directory on your PXE boot server:
where Linux_dir > is as-2.1u2 , el-3.O or sles-8sp3 , depending on the version of Linux you are installing.
Note — The Linux directory contains the files required to perform a PXE installation.
b. Install the Linux installation CDs to the /tftp directory on your PXE boot server.
For Red Hat, you need to install the CDs in reverse order. If you have two Red Hat installation CDs, install Disk 2 first; if you have four, install Disk 4 first. After inserting each CD, type the following command:
where Linux_dir > is as-2.1u2 or el-3.O , depending on the version of Linux you are installing.
For SuSE Linux Enterprise Server 8 service pack 3, you need to load each image into its own directory rather than into the same directory. This allows the SuSE installer to select the correct packages from each ISO image. Use the following commands:
After inserting the SLES-8 disk:
After inserting the first UnitedLinux 1.0 disk:
After inserting the second UnitedLinux 1.0 disk:
After inserting the third UnitedLinux 1.0 disk:
After inserting the first United Linux 1.0 SP 3 disk:
Note — The first SP 3 disk contains hard-linked directories. Do not use the cp, cpio or tar commands to copy this disk as these commands will fail to copy the directories correctly. The directory hierarchy created by pax requires about 2Gb of disk space.
After inserting the second UnitedLinux 1.0 SP 3 disk:
When you have copied all the disks, tie the ISO images together:
5. Modify the configuration file to specify the address of your NFS server.
For Red Hat, modify the / tftp/ Linux_dir >/sun/install/ks.cfg file. For example:
where Linux_dir > is as-2.1u2 or el-3.O , depending on the version of Red Hat you are installing.
Note — ks.cfg is a read-only file. You must change its permissions to read-write before making modifications.
For SuSE, modify the /tftp/sles-8sp3/sun/install/autoyast.xml file to set the NFS server address. A sample command is as follows:
6. Set your own root password in the Linux configuration file.
Note — If you do not change the root password, you will be prompted to enter the root password each time you run a PXE boot installation.
For Red Hat, modify the / tftp/ Linux_dir >/sun/install/ks.cfg file by removing the comment symbol (#) in the rootpw entry and then overwriting changeme with your own password:
where nnnnnnn is your root password.
For SuSE, specify the root password in the autoyast.xml file ( /tftp/sles-8sp3/sun/install/autoyast.xml ) by scrolling to the user password section of the file, removing the existing text between the key words, typing the password you want to use:
Note — It is only possible to specify passwords for SuSE in an encrypted form.
Note — The default password is changeme .
7. Modify the /tftp/ Linux_dir /sun/pxelinux.cfg/default file to include the path to the kernel to be installed, and the location of the PXE server.
The line of the default file containing the IP address of the PXE server and the path to the kernel software is the wrapped line beginning with the word «kernel» and ending » /initrd.img «:
where Linux_dir > is as-2.1u2 or el-3.O , depending on the version of Red Hat you are installing. If you are installing SuSE Linux Enterprise Server 8 service pack 3, the Linux directory will be sles-8sp3 .
Note — By default the PXE device is eth0 ( ksdevice=eth0 ). This means that the PXE boot is performed via the SSC in slot 0. If you want to PXE boot via SSC 1, you can change this parameter to ksdevice=eth1 .
Note — The default file is a read-only file. You must change its permissions to read-write before making modifications.
8. Log into the B1600 System Controller.
See the Sun fire B1600 Blade System Chassis Software Setup Guide for further details.
Note — The following steps assume that the blade is already installed in the system chassis. For information on installing blades, see Chapter 3.
9. Boot the blade to begin the PXE boot from the SC prompt.
where n is the slot number of the server blade on which you want to install the operating system.
10. Access the blade’s console to monitor the progress of the installation.
At the SC prompt, type:
where n is the number of the slot containing the blade.
Note — If you are installing SuSE, the system will become idle for about 40 seconds during the boot and subsequent reboots. During this idle time a blank screen is displayed. This behavior is due to an old version of the bootloader that ships with SuSE, and does not indicate that there is a problem with booting the blade.
When the installation is complete the blade automatically reboots.
Note — For information on troubleshooting the PXE boot installation see Chapter 9.
This section tells you how to install Linux on a server blade from a PXE boot server running Solaris.
Note — IMPORTANT: Before installing Linux, ensure that the boot directory on the PXE server (/ tftpboot ) has enough space to accommodate the version of Linux you are installing. You will require about 6 Gbytes of free space.
4.3.1 Files Relevant to PXE Boot Installation
A summary of the files required by the Solaris PXE boot server during PXE boot installation and their purpose is provided in TABLE 4-3.