
Download and Install Debian Online for Dummies
If you need to install Debian on several machines, then, of course, it is better to download and install it over the network. Well, I would like the installation to take place in a fully automatic mode. This will be the article. The main part of the article is a free retelling of Wiki Debian, but a couple of nuances are also described here that are not mentioned in the wiki, but without them the installation will not be completely automatic.
To begin with, the network must have a DHCP / TFTP server. If it is not, then you can first manually install it on one of the Debian machines and raise DHCP and TFTP on it. To do this, install the dhcp3-server and tftpd-hpa packages. For DHCP, we will configure the distribution of addresses for the desired subnet (hereinafter in examples 192.168.2.0/24) and information about which image should be loaded via TFTP.
An example of a simple dhcp3-server configuration file: PS In the example, Google Public DNS is distributed as DNS. All servers are in the domain debianfarm.org, well, for each it is desirable to bind statically IP and hostname via MAC, although this is not necessary. In the example, this is done for only one host. Also, the TFTP server can be located on another host. To specify its address, add the option next-server <server>; After editing the config, you need to restart the DHCP daemon: Now you need to download the necessary files and put it in the root for TFTP (by default / srv / tftp, although during the installation of the tftpd-hpa package it will be offered to choose a different path).
We will edit the ./pxelinux.cfg/default file in the TFTP root so that the syslinux bootloader does not wait for the user’s reaction after loading, and starts the installation after a second. To do this, set the timeout option to 1.
Now you need to add a variable for debian-installer to the kernel parameters to load the preseed file. This file contains the values of variables that are usually asked by the user during installation. That is, you pre-create a file with “answers to questions” from the Debian installer (about its contents later). But there is one nuance that is not mentioned in the wiki: the preseed file is not loaded immediately after the installer is launched, but only after some questions are asked to the user, which means that using only the preseed file you can not achieve a fully automatic installation. Therefore, the answers to installer questions before preseed should be passed in with the kernel boot parameters, which the Debian installer will then pick up. However, one could pass to the kernel all the necessary “answers to the questions” of the installer,
Passing the values of these variables to the kernel, you can omit the first part of the variable name (the one that is before the slash along with the slash). But this cannot be done for such variables in which the second part of the name conflicts with another variable, for example:
console-keymaps-at / keymap must be specified completely, since there is also the variable console-keymaps-usb / keymap.
The syslinux config should now look something like this: PS You must specify the host name here, but remember that the value later obtained via DHCP will have the highest priority. The same applies to the domain. On the host 192.168.2.1, an http server must be raised. If it is not there, you can install nginx, in the configuration file in the http section add something like this:
However, the preseed file can be placed anywhere (dropbox, etc.)
Now a little about the contents of the preseed file. An example of such a file can be found here www.debian.org/releases/squeeze/example-preseed.txt . This is how the working version of the file looks: There is no point in commenting here, because each variable duplicates the installer’s extremely clear dialogs, for each you can see the comment in the example. The disk layout method was simply copied from the example, since it depends on the number of hard disks, their size and server needs. Well that's all, now it remains only to turn on those machines on which you need to install Debian, everything else will happen “by itself”.
To begin with, the network must have a DHCP / TFTP server. If it is not, then you can first manually install it on one of the Debian machines and raise DHCP and TFTP on it. To do this, install the dhcp3-server and tftpd-hpa packages. For DHCP, we will configure the distribution of addresses for the desired subnet (hereinafter in examples 192.168.2.0/24) and information about which image should be loaded via TFTP.
An example of a simple dhcp3-server configuration file: PS In the example, Google Public DNS is distributed as DNS. All servers are in the domain debianfarm.org, well, for each it is desirable to bind statically IP and hostname via MAC, although this is not necessary. In the example, this is done for only one host. Also, the TFTP server can be located on another host. To specify its address, add the option next-server <server>; After editing the config, you need to restart the DHCP daemon: Now you need to download the necessary files and put it in the root for TFTP (by default / srv / tftp, although during the installation of the tftpd-hpa package it will be offered to choose a different path).
cat /etc/dhcp/dhcpd.conf | grep -v '#'
option domain-name-servers 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.2.0 netmask 255.255.255.0
{
range 192.168.2.10 192.168.2.120;
option routers 192.168.2.1;
option domain-name "debianfarm.org";
filename "pxelinux.0";
host firstserver
{
option host-name "firstserver";
hardware ethernet 08:00:27:91:DA:57;
fixed-address 192.168.2.21;
}
}
# /etc/init.d/isc-dhcp-server restart
# cd /srv/tftp
# wget mirror.yandex.ru/debian/dists/squeeze/main/installer-i386/current/images/netboot/netboot.tar.gz
# tar -xvf netboot.tar.gz
We will edit the ./pxelinux.cfg/default file in the TFTP root so that the syslinux bootloader does not wait for the user’s reaction after loading, and starts the installation after a second. To do this, set the timeout option to 1.
Now you need to add a variable for debian-installer to the kernel parameters to load the preseed file. This file contains the values of variables that are usually asked by the user during installation. That is, you pre-create a file with “answers to questions” from the Debian installer (about its contents later). But there is one nuance that is not mentioned in the wiki: the preseed file is not loaded immediately after the installer is launched, but only after some questions are asked to the user, which means that using only the preseed file you can not achieve a fully automatic installation. Therefore, the answers to installer questions before preseed should be passed in with the kernel boot parameters, which the Debian installer will then pick up. However, one could pass to the kernel all the necessary “answers to the questions” of the installer,
Passing the values of these variables to the kernel, you can omit the first part of the variable name (the one that is before the slash along with the slash). But this cannot be done for such variables in which the second part of the name conflicts with another variable, for example:
console-keymaps-at / keymap must be specified completely, since there is also the variable console-keymaps-usb / keymap.
The syslinux config should now look something like this: PS You must specify the host name here, but remember that the value later obtained via DHCP will have the highest priority. The same applies to the domain. On the host 192.168.2.1, an http server must be raised. If it is not there, you can install nginx, in the configuration file in the http section add something like this:
cat ./debian-installer/i386/boot-screens/txt.cfg
default install
label install
menu label ^Install
menu default
kernel debian-installer/i386/linux
append vga=788 initrd=debian-installer/i386/initrd.gz locale=en_US country=BY language=en console-keymaps-at/keymap=en url=http://192.168.2.1/preseed.cfg hostname=debian domain=debianfarm.org -- quiet
server
{
listen 80;
server_name localhost;
location /
{
root /path/to/dir/with/preseed/;
}
}
However, the preseed file can be placed anywhere (dropbox, etc.)
Now a little about the contents of the preseed file. An example of such a file can be found here www.debian.org/releases/squeeze/example-preseed.txt . This is how the working version of the file looks: There is no point in commenting here, because each variable duplicates the installer’s extremely clear dialogs, for each you can see the comment in the example. The disk layout method was simply copied from the example, since it depends on the number of hard disks, their size and server needs. Well that's all, now it remains only to turn on those machines on which you need to install Debian, everything else will happen “by itself”.
d-i netcfg/choose_interface select auto
d-i netcfg/wireless_wep string
d-i mirror/country string manual
d-i mirror/http/hostname string mirror.yandex.ru
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i passwd/make-user boolean false
d-i passwd/root-password password juststrongpassword
d-i passwd/root-password-again password juststrongpassword
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server
popularity-contest popularity-contest/participate boolean false
d-i finish-install/reboot_in_progress note