Difference between revisions of "Diskless image configuration - manual setup"
(Created page with "This article explains how to setup '''MANUALLY''' a netboot image. Instead of manual operations you can use some config managers such as ''Puppet'' or ''Chef''. =Access di...") |
(No difference)
|
Revision as of 16:45, 3 June 2014
This article explains how to setup MANUALLY a netboot image.
Instead of manual operations you can use some config managers such as Puppet or Chef.
Access distribution
This will "mount" the system:
# Debian 7.x
chroot /tftpboot/nfs/images/wheezy/
# Ubuntu 14.04
chroot /tftpboot/nfs/images/trusty/
From here you can perform operation as if you were on a separate machine.
Only the current distribution (= the client one) will be affected.
Setup
Adjust default login/password
First of all, you have to create / adjust the default user.
# Add new user
adduser <username>
# Add user to sudoers group
usermod -a -G sudo <username>
Now you can use that user:
su <username>
sudo -s
You can check that you really are in the "Virtual machine" by checking "/srv/". It should be empty !
Update sources.list and install key packages
Your client need to have some key packages in order to work. Without these package even the NetBoot will fail !!
First of all: edit your sources.list
apt-get install vim
vim /etc/apt/sources.list
Put the following:
### Custom repositories list
#
# May 2014 - Guillaume Diaz
# This is an ajdustement of the default "debootstrap" sources.list
# This is required to provided update, security and advanced tools to all our clients
#
# Official repositories
deb http://se.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://se.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
# Official updates
deb http://se.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
# Canonical partners
deb http://archive.canonical.com/ubuntu trusty partner
# Community partners
deb http://extras.ubuntu.com/ubuntu trusty main
Update your package list:
apt-get update && apt-get upgrade
Now, you can install the basic programs:
# NFS client. This is ABSOLUTELY MANDATORY ! That's the only way to mount the /root
apt-get install nfs-common
apt-get install initramfs-tools
# NFS is a bit low, and if you're using many client it might result in time faults.
# You must install NTP to overcome this !!
apt-get install ntp ntpdate
# Basic set of utilities
apt-get install unzip zip
apt-get install make autoconf automake cpp gcc build-essential
apt-get install htop
apt-get install python3
# Advanced APT manager (require to add repository from command line)
apt-get install software-properties-common python-software-properties
# JAVA (that is required for my application)
# Depending on your target usage you might not need it.
add-apt-repository ppa:webupd8team/java
apt-get update && apt-get upgrade
apt-get install oracle-java7-installer oracle-jdk7-installer
Adjust bash and vim configuration
Edit your VIM configuration:
vim /etc/vim/vimrc
Enable dark background, set nu, set ruler
Edit your bash configuration files to adjust the alias and enable auto-completion:
vim /etc/bash.bashrc
vim /home/<username>/.bashrc
vim /root/.bashrc
Install a local kernel
--- TO BE CHECKED --- IS IT MANDATORY ??
To install a local kernel, you have to:
- mount /proc
- unpack linux-headers-generic
- unpack linux-image-generic
mount /proc
apt-get install -y linux-headers-generic
apt-get install -y linux-image-generic
Check that you have some symlinks in /, either create them:
ln -s /boot/vmlinuz-3.5.0-21-generic /vmlinuz
ln -s /boot/initrd.img-3.5.0-21-generic /initrd.img
!! Don't forget to adjust the number to your actual version !!
Edit mount points (/etc/fstab)
You must edit the mount points to get the client working!
vim /etc/fstab
/proc /proc proc defaults 0 0
/sys /sys sysfs defaults 0 0
/dev/nfs / nfs defaults 1 1
Adjust network configuration
Up to this point the client will already have got a DHCP address through the NetBoot process.
Therefore, you should prevent users / services from changing that automatic configuration.
Edit the config file:
vim /etc/network/interfaces
Put:
## Manual override of the debootstrap shipped configuration
#
# Version 1.0 - May 2014 - Guillaume Diaz
#
# Loopback
auto lo
iface lo inet loopback
# Keep the NetBoot configuration
iface eth0 inet manual
# Intel NUC trick - as the NUC uses "em1" instead of "eth0"
iface em1 inet manual
Run clients in diskless NFS mode
Now you are (finally) ready to tell the client to run in diskless mode! Edit the config file:
vim /etc/initramfs-tools/initramfs.conf
Set the following values:
MODULES = netboot
BOOT = nfs
Apply changes:
update-initramfs -u
Exit client distro
umount /proc
exit
- Numbered list item