个人工具

UbuntuHelp:Installation/NetworkConsole

来自Ubuntu中文

跳转至: 导航, 搜索

/!\ This is a work in progress, it is not mature yet and it may break your system!

Caveat

As you may already have guessed, following the instructions may break your system and you are on your own to fix it again.

Outline

Occasionally you may have to install a system which you cannot access physically. Many server systems provide console access over the network, but if the server you have to set-up does not, things tend to become difficult. The approach outlined here starts an ssh daemon right after the network configuration of the debian installer. You can then use an ssh client to connect to the installation and proceed as if you were sitting in front of the machine. This procedure works for the standard debian ncurses installer, not for the graphical installer on the Ubuntu Desktop Live cd. There are basically two options:

  • Use the standard alternate installation CD or the netboot mini iso and ask someone to go through the network configuration
  • Modify the netboot iso and automate the installation up to the point where you can connect via SSH

The first option involved less work on your part, but the person starting the installation will need a helping hand if he/she is not familiar with the Debian Installer. The rest of the guide is split into these two parts.

Installation with stock Ubuntu iso

If you use the alternate installation CD, you have to boot the system and press escape as soon as the installer presents you the first question. Select Change debconf priority and choose low. If you use the netboot iso, simply boot by entering expert instead of the default install. That will set your debconf priority to low automatically. As soon as you come to a screen presenting you a list of installer components which can be loaded, tick network-console: Continue installation remotely using SSH and continue. One of the next steps should be a question asking for the SSH password. Choose one and then connect via ssh using the installer user and the password you have chosen. After connecting via ssh you can change the debconf priority back to 'critical' to make the installation easier by suppressing optional questions asked by the installer.

Installation with modified Netboot iso

The installation medium will be a CD / DVD containing an (optionally modified) netboot mini.iso image as found on http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/mini.iso.

Preparing the preseed file

In order to tell the debian installer to start the ssh server and wait for you to connect, it needs a preseed file (see http://wiki.debian.org/DebianInstaller/Preseed). Copy a file with the following content to a webserver which is reachable by the machine you want to set-up.

d-i debconf/priority                   select critical
d-i auto-install/enabled               boolean true
d-i netcfg/choose_interface            select auto
d-i netcfg/get_hostname                string obelix
d-i network-console/password           password SECRET123
d-i network-console/password-again     password SECRET123
d-i preseed/early_command string anna-install network-console

This preseed file assumes that you have a DHCP server on your network and sets the password for the installation user to SECRET123. You may want to adjust the password.

Modify the netboot iso

In order to make your life easier (typing URLs at the isolinux prompt is not my favourite task), you can modify the iso image to include the URL and some options which cannot be set from the preseed file in the default boot options. Download the mini.iso file of the distribution you would like to install (tested with hardy-proposed on 2008-06-19, hardy currently suffers from https://bugs.launchpad.net/ubuntu/+bug/238974) to /tmp and proceed as follows:

cd /tmp
sudo mkdir /media/isoimage
sudo mount mini.iso /media/isoimage -o loop
mkdir /tmp/miniiso_remastered
sudo cp -aR /media/isoimage/. /tmp/miniiso_remastered/
sudo vi /tmp/miniiso_remastered/isolinux.cfg
sudo mkisofs -r -V "Custom Ubuntu Netboot image" -cache-inodes -J -l -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /tmp/CustomMini.iso /tmp/miniiso_remastered/
sudo umount /media/isoimage

The steps above will start vi to edit the isolinux configuration file. At this step, apply the following changes:

--- /media/isoimage/isolinux.cfg 2007-10-15 23:59:20.000000000 +0200
+++ /tmp/miniiso_remastered/isolinux.cfg        2008-06-19 14:44:11.000000000 +0200
@@ -12,7 +12,11 @@
 F9 f9.txt
 F0 f10.txt
 
-DEFAULT install
+DEFAULT netconsole
+
+LABEL netconsole
+       kernel linux
+       append vga=normal initrd=initrd.gz preseed/url=http://YOURDOMAIN.COM/preseed/default.txt console-setup/layoutcode=us console-setup/layout="U.S. English" console-setup/variantcode=intl countrychooser/country-name=Austria debian-installer/country=AT languagechooser/language-name="English" languagechooser/language-name-fb="English" netcfg/get_hostname=NEWMACHINE mirror/http/countries=DE mirror/http/hostname=de.archive.ubuntu.com DEBCONF_PRIORITY=critical
 
 LABEL install
        kernel linux

Adjust the line starting with append to your liking. You can find the values of the variables as they have been set when you installed Ubuntu on your machine in the file /var/cache/debconf/config.dat You can then use the /tmp/CustomMini.iso instead of the mini.iso file.

Starting the installation

Burn the iso file to a CD or DVD and tell someone with physical access to the machine to boot from it. If you have modified the iso as outlined above, you just have to tell your assistant to wait until a prompt appears which basically says: You can now connect to the IP address X.X.X.X using ssh with the user installer to continue the installation. Do as it says and you should be greeted by the debian installer over ssh. It is advisable to connect to the machine from another machine within the same (reliable) network using screen. Say you want to install machine A on network X. You are working on machine M in network Y. Connect via ssh to machine B on network X, start screen and then connect to machine A. If your connection (over the internet) to machine B fails, you can simply reconnect and re-attach to screen using screen -r.