Custom Suit
The standard Raspbian is too bulky for some projects. You can use Netinstaller to set up a pre-defined customized version.
The standard Raspbian is too bulky for some projects. You can use Netinstaller to set up a pre-defined customized version.
Ready-made systems are not for everybody. If you like Raspbian, but you don't like the bulky full version, you might be ready for the "minimal Raspbian unattended netinstaller" [1]. Netinstaller offers a network installation option for Raspbian. Instead of the standard full version, you'll get a minimal system with a custom package list and other custom files.
Netinstaller is modeled on the automated network installation tools used with conventional computers on local networks. In this case, a minimal system boots from the SD card then connects to the Internet to install additional packages from online sources. Custom scripts configure the system and perform postinstallation tasks.
Netinstaller is designed to run the installation unattended, and because it grabs packages directly from the Internet, it will automatically install the latest versions of the software packages.
You have the choice of building your system around three preset package collections. The default server preset option installs a base system with NTP and OpenSSH support. The minimal system includes even fewer package with "no logging, no text editor, no cron," and the barebones base system doesn't even providing networking.
You can start with any of these presets and adapt it using the configuration files.
Netinstaller won't work without a minimal system. The original project does not currently support the Raspberry Pi 3 (RPi3), but an RPi3-ready fork is available [2] as a ZIP archive or an XZ compressed image file [3]. The 36MB image gets decompressed directly on the (micro)SD card. (See Listing 1; replace /dev/sdd
with the device name for your SD card reader.) Be sure you have the right name for the device: If you address the command to the wrong drive, you could lose all your data.
Listing 1
Decompressing the XZ Image File
$ sudo xzcat raspberrypi-ua-netinst-v1.1.0.img.xz > /dev/sdd
If you're using Windows, format an SD card with FAT32 and copy the contents to the ZIP file. Afterward, insert the card into the Raspberry Pi. You'll need to use an Ethernet cable for an Internet connection. The developers are working on the first WiFi-based installation, but it was not ready at the time of this article. As soon as the Rasp Pi is hooked up to the power, the minimal system will boot. The installer downloads, decompresses, and installs all of the necessary packages. Then, the Pi restarts, and the system is ready to go.
If the Rasp Pi is connected to a monitor, you can follow the boot messages (Figure 1), which primarily consist of warnings, most of which you can ignore. If you aren't using a monitor, wait a bit before trying to log in to the system via SSH. The username is root and the password is raspbian. You can find the IP address for the Rasp Pi via the router web interface, or with arp-scan
(Listing 2). To find your Pi's hostname, enter hostname
at the command line. The default is raspberrypi; my Rasp Pi hostname is pi3net. You can also rename your Pi by editing the hosts
file (see also the "Optimization" section).
Listing 2
Finding the IP Address
$ sudo arp-scan --localnet | grep Raspberry
After you log in, configure the system according to your own wishes. (See the info box entitled "Retrofitting.")
Retrofitting
Once you complete the installation, you'll have only a spartan system on the memory card. You might want to customize a bit more after installation. The first thing that needs attention is localization for language, keyboard layout, and time zone (see Listing 3). You should also change the default password for root via the configuration variable rootpw
.
Lines 4 to 7 in Listing 3 generate a swap file that is automatically integrated during startup. This swap file doesn't provide as much benefit on a Rasp Pi because of the limited data throughput rate of the SD card; however, a swap file might still be useful to optimize for a specific application or in the event of an emergency.
The last two commands in Listing 3 are no longer needed for the RPi3-ready fork. If you need to use the original installer for the RPi2, these commands can improve the system speed in certain situations. (The Netinstaller project page explains these commands in detail.) You can perform the adaptations in Listing 3 using the post-install script and prepared configuration files.
The last thing missing is the standard user, like the Raspbian default user pi. The adduser
command sets up an account. Users who need sudo
have to install the sudo package at this point and equip the user with these rights.
Listing 3
Customizing
01 # apt-get install console-data keyboard-configuration 02 # dpkg-reconfigure locales 03 # dpkg-reconfigure tzdata 04 # dd if=/dev/zero of=/swap bs=1M count=512 05 # mkswap /swap 06 # chmod 600 /swap 07 # echo -e '\n#\n/swap none swap sw 0 0' >> /etc/fstab 08 # apt-get install raspi-copies-and-fills rng-tools 09 # echo 'bcm2708-rng' >> /etc/modules
The time required for installation can vary depending on the microSD card you are using. With one card, the process lasted 30 minutes, and with another, 90 minutes. It takes only 15 minutes with a USB stick as a root system. The numerous write and read processes involving small blocks that occur during installation can stress out an SD card. Cheaper cards sometimes work better than cards that are significantly more expensive. You'll need to try out different alternatives if you want to optimize for fast installation.
Pages: 4
Price $15.99
(incl. VAT)