https://pve.proxmox.com/mediawiki/api.php?action=feedcontributions&user=Andrey+Kononov&feedformat=atom
Proxmox VE - User contributions [en]
2024-03-29T07:00:52Z
User contributions
MediaWiki 1.35.11
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8365
Unattended installation of Proxmox
2016-04-06T15:48:28Z
<p>Andrey Kononov: /* Implementation: */</p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
deb http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
deb http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/ and remove all other examples<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'sed -i '/proxmox_install/d' /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
echo -e 'reboot' >> $target/bin/proxmox_install.sh<br />
<br />
sed -i '/default/a\<br />
/bin/proxmox_install.sh' $target/etc/rc.local<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
Add to /srv/fai/nfsroot/etc/ssh/ssh_config<br />
StrictHostKeyChecking no<br />
<br />
Make sure /srv/fai/nfsroot/etc/hosts have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
fai-chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8364
Unattended installation of Proxmox
2016-04-06T15:45:34Z
<p>Andrey Kononov: /* Implementation: */</p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
deb http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
deb http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/ and remove all other examples<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'sed -i '/proxmox_install/d' /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
echo -e 'reboot' >> $target/bin/proxmox_install.sh<br />
<br />
sed -i '/default/a\<br />
/bin/proxmox_install.sh' $target/etc/rc.local<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/hosts have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
fai-chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8363
Unattended installation of Proxmox
2016-04-06T15:43:56Z
<p>Andrey Kononov: </p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
deb http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
deb http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'sed -i '/proxmox_install/d' /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
echo -e 'reboot' >> $target/bin/proxmox_install.sh<br />
<br />
sed -i '/default/a\<br />
/bin/proxmox_install.sh' $target/etc/rc.local<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/hosts have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
fai-chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8359
Unattended installation of Proxmox
2016-04-06T11:54:30Z
<p>Andrey Kononov: </p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
deb http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
deb http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'cat /dev/null > /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/hosts have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
fai-chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8358
Unattended installation of Proxmox
2016-04-06T09:45:10Z
<p>Andrey Kononov: </p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
deb http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
deb http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'cat /dev/null > /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/fai.conf have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
fai-chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8357
Unattended installation of Proxmox
2016-04-06T09:41:39Z
<p>Andrey Kononov: </p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'cat /dev/null > /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/fai.conf have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
fai-chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8356
Unattended installation of Proxmox
2016-04-06T09:40:57Z
<p>Andrey Kononov: </p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/isc-dhcp-server restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'cat /dev/null > /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/fai.conf have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8355
Unattended installation of Proxmox
2016-04-06T09:39:15Z
<p>Andrey Kononov: /* Implementation: */</p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/dhcpd restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
Create directory for tftp:<br />
mkdir -p /srv/tftp/fai/pxelinux.cfg<br />
Copy pxelinux.0, kernel and initrd to tftp root:<br />
cp /boot/vmlinuz-3.2.0-4-amd64 /srv/tftp/fai/<br />
cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/fai/<br />
cp /boot/initrd.img-3.2.0-4-amd64 /srv/tftp/fai/<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'cat /dev/null > /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/fai.conf have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov
https://pve.proxmox.com/mediawiki/index.php?title=Unattended_installation_of_Proxmox&diff=8354
Unattended installation of Proxmox
2016-04-06T09:27:26Z
<p>Andrey Kononov: </p>
<hr />
<div>== Introduction ==<br />
Remote unattended installation means installation of remote server without any human interference.<br />
This process is very useful for bare metal provisioning or automated installation on multiple servers.<br />
I have used FAI (Fully Automatic Installation) to automate remote installation of ProxmoxVE. I have used steps from "ProxmoxVE installation over Debian wheezy". So this does not install ProxmoxVE from ProxmoxVE ISO. It installs Debian wheezy first and then ProxmoxVE. <br />
FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. <br />
"FAI-Fully Automatic Installation" is used to automate headless installation of Proxmox or Debian. http://fai-project.org/<br />
<br />
== Basic Architecture ==<br />
'''Components:'''<br /><br />
This setup has following components required.<br /><br />
:fai-server<br />
:DHCP server<br />
:NFS Server<br />
:TFTP Server<br />
<br />
'''Basic Process:'''<br /><br />
:- Client machine (On which Proxmox is going to be installed.) boots from Network PXE.<br /><br />
:- It searches for DHCP Server.<br /><br />
:- DHCP Server on FAIserver provides Network Details to Client such as IP address, Netmask, Gateway, etc. It also points clients to TFTP & NFS server. <br /><br />
:- TFTP trasfers the kernel to Client Machine<br /><br />
:- NFS Server Mounts the nfsroot on Client machine<br /><br />
:- FAI Scripts starts the installation<br /><br />
<br />
'''Important Configurations files and folders of FAI:'''<br /><br />
{| class="wikitable"<br />
|-<br />
! Configuration File/Directory !! Details<br />
|-<br />
| /etc/fai/ || FAI configuration folder<br />
|-<br />
| /etc/fai/fai.conf || FAI configuration file<br />
|-<br />
| /etc/fai/nfsroot.conf || NFSroot configuration file<br />
|-<br />
| /etc/fai/apt/ || FAI repositories which will be used while installation<br />
|-<br />
| /srv/fai/config/ || FAI Client configuration space. It has scripts which will be used while installation of Client<br />
|-<br />
| /srv/fai/package_config/ || Configurations related to Package installation<br />
|-<br />
| /srv/fai/disk_config/ || Configurations related to disk partition layout<br />
|-<br />
| /srv/fai/scripts || Miscellaneous scripts required for installations<br />
|-<br />
| /srv/fai/nfsroot || NFS Root file system which will be shared by NFS and will be mounted as Root filesystem on client machine<br />
|-<br />
| /etc/dhcp/dhcpd.conf || DHCP configuration file<br />
|-<br />
| /etc/exports ||NFS configuration file<br />
|-<br />
| /etc/default/tftpd-hpa || TFTP configuration file<br />
|-<br />
| /etc/hosts || Hosts declaration file / File DNS<br />
|}<br />
<br />
<br />
== Implementation: ==<br />
<br />
'''Scenario:'''<br /><br />
To follow these steps require 2 machines Server & Client. Server is the one which has FAI Server configured on Debian Wheezy. Client is the one on which ProxmoxVE is going to be installed.<br />
Server Name: faiserver <br />
Server IPAddress: 192.168.0.1/24<br />
Client Name: demohost<br />
Client IPAddress: 192.168.0.2/24<br />
<br />
<br />
'''Steps:'''<br /><br />
'''Prepare FAI-Server:'''<br /> <br />
1. Install Debian Wheezy with net-install ISO. Just install OpenSSH server nothing else on it.<br /> <br />
2. Install Required Applications<br /><br />
<br />
apt-get -y install apache2 fai-quickstart fai-doc fai-server isc-dhcp-server tftpd-hpa nfs-kernel-server syslinux-common debmirror<br />
<br />
Create Local Debian Mirror:<br />
ln -s /files/scratch/debmirror /var/www/debmirror<br />
/usr/share/doc/fai-doc/examples/utils/mkdebmirror<br />
/etc/init.d/apache2 restart<br />
<br />
Configure /etc/hosts:<br />
Add below entries:<br />
192.168.0.1 faiserver<br />
192.168.0.2 demohost<br />
<br />
Configure /etc/fai/fai.conf:<br />
Make sure you have these entries in fai.conf<br />
SERVER=192.168.0.1<br />
FAI_CONFIG_SRC=nfs://$SERVER/srv/fai/config<br />
# Account for saving log files and calling fai-chboot.<br />
LOGUSER=fai<br />
FAI_LOGPROTO=ssh<br />
<br />
Configure /etc/fai/nfsroot.conf":<br />
Make sure nfsroot.conf looks like:<br />
FAI_DEBOOTSTRAP="wheezy http://http.debian.net/debian"<br />
FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'<br />
NFSROOT=/srv/fai/nfsroot<br />
TFTPROOT=/srv/tftp/fai<br />
NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/<br />
FAI_DEBOOTSTRAP_OPTS="--exclude=info"<br />
<br />
# Configuration space<br />
FAI_CONFIGDIR=/srv/fai/config<br />
<br />
Configure /etc/fai/apt/sources.list:<br />
sources.list should look like below:<br />
<br />
http://192.168.0.1/debmirror/debian wheezy main contrib non-free<br />
http://192.168.0.1/debmirror/debian-security wheezy/updates main contrib non-free<br />
<br />
# PVE repository provided by proxmox.com, only for installation (this repo will stay on 3.1)<br />
deb http://download.proxmox.com/debian wheezy pve<br />
<br />
# security updates<br />
deb http://security.debian.org/ wheezy/updates main contrib<br />
<br />
Prepare fai:<br />
Run fai-setup command to prepare fai<br />
$ fai-setup -v<br />
<br />
<br />
Configure /etc/dhcp/dhcpd.conf:<br />
Note down MAC address of NIC of the client machine.<br />
deny unknown-clients;<br />
option dhcp-max-message-size 2048; <br />
use-host-decl-names on;<br />
<br />
subnet 192.168.0.0 netmask 255.255.255.0 {<br />
option routers 192.168.0.1;<br />
option domain-name "<domainName>";<br />
option domain-name-servers 8.8.8.8;<br />
option time-servers 192.168.0.1;<br />
option ntp-servers 192.168.0.1;<br />
server-name faiserver;<br />
next-server faiserver;<br />
filename "pxelinux.0";<br />
}<br />
<br />
host demohost {hardware ethernet <MAC Address>;fixed-address 192.168.0.2;}<br />
<br />
Restart Dhcp server:<br />
Run below command to restart dhcp server. Note that I am using init script here.<br />
/etc/init.d/dhcpd restart<br />
<br />
Configure /etc/exports for NFS share:<br />
fai-setup command will add required entries in /etc/exports. Still you need to do some modifications so please make sure it should look like as below:<br />
/srv/fai/config 192.168.0.0/24(async,ro,no_root_squash)<br />
/srv/fai/nfsroot 192.168.0.0/24(async,ro,no_root_squash)<br />
<br />
Restart NFS service:<br />
/etc/init.d/nfs-kernel-server restart<br />
<br />
Configure TFTP Server:<br />
Config file /etc/default/tftpd-hpa should look like below.<br />
TFTP_USERNAME="tftp"<br />
TFTP_DIRECTORY="/srv/tftp/fai"<br />
TFTP_ADDRESS="0.0.0.0:69"<br />
TFTP_OPTIONS="--secure"<br />
<br />
Restart tftpd service:<br />
/etc/init.d/tftpd-hpa restart<br />
<br />
Copy Sample configuration files to fai/config directories<br />
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config<br />
<br />
Change ownership of /srv/fai/config:<br />
chown -R fai /srv/fai/config<br />
<br />
Disk Partition layout:<br />
- Remove all files from /srv/fai/config/disk_config<br />
- Create new file name DEFAULT under /srv/fai/config/disk_config/<br />
- Add below entries in it:<br />
disk_config disk1 disklabel:msdos<br />
primary / 90% ext4 rw<br />
primary swap 10% swap sw<br />
<br />
Package installation config:<br />
- Make sure your /srv/fai/config/package_config/DEFAULT look like below:<br />
PACKAGES aptitude<br />
initramfs-tools<br />
grub-pc<br />
pve-firmware<br />
pve-kernel-2.6.32-26-pve<br />
pve-headers-2.6.32-26-pve<br />
<br />
# explicitely delete these bootloaders<br />
# (just in case the base tgz contains them)<br />
PACKAGES aptitude<br />
grub-legacy-<br />
lilo-<br />
linux-image-amd64<br />
linux-base<br />
<br />
<br />
Modifying /srv/fai/config/scripts/DEBIAN/40-misc:<br />
- Add below entries in /srv/fai/config/scripts/DEBIAN/40-misc before "exit $error" line<br />
##### Add below entry to /etc/hosts of host:#####<br />
echo -e "192.168.0.2 demohost pvelocalhost" >> $target/etc/hosts<br />
###################################################################<br />
##### Add entries for /bin/proxmox_install.sh ######<br />
##### This script install proxmox after first reboot #####<br />
echo -e '#!/bin/bash' > $target/bin/proxmox_install.sh<br />
echo -e 'echo -e "Installing Proxmox" > /root/pminstall.log' >> $target/bin/proxmox_install.sh<br />
echo -e 'export DEBIAN_FRONTEND=noninteractive' >> $target/bin/proxmox_install.sh<br />
echo -e 'apt-get --force-yes -y install proxmox-ve-2.6.32 ntp ssh lvm2 postfix ksm-control-daemon vzprocps open-iscsi bootlogd' >> $target/bin/proxmox_install.sh<br />
echo -e 'cat /dev/null > /etc/rc.local' >> $target/bin/proxmox_install.sh<br />
<br />
##################################################################<br />
<br />
chmod 777 $target/bin/proxmox_install.sh<br />
chmod 777 $target/etc/rc.local<br />
<br />
##### Change Default kernel for Boot #####<br />
sed -i 's/set default="0"/set default="2"/g' $target/boot/grub/grub.cfg<br />
sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT=2/g' $target/etc/default/grub<br />
<br />
################# END #################<br />
<br />
Copy fai.conf inside nfsroot<br />
cp /etc/fai/fai.conf /srv/fai/nfsroot/etc/fai/<br />
<br />
Make sure /srv/fai/nfsroot/etc/fai.conf have below entry:<br />
192.168.0.1 faiserver<br />
<br />
Initialize Bootloader config for demohost (client)<br />
chboot -IB demohost<br />
<br />
Above command will create config file under /srv/tftp/fai/pxelinux.cfg/<br />
File Name will be something like: C0A87A64<br />
Just edit that file and make sure it should look like below:<br />
default fai-generated<br />
label fai-generated<br />
kernel vmlinuz-3.2.0-4-amd64<br />
append initrd=initrd.img-3.2.0-4-amd64 ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/fai/nfsroot:vers=3 aufs FAI_FLAGS=verbose,sshd,reboot FAI_ACTION=install<br />
<br />
<br />
'''Now reboot client machine from Network PXE boot. It will get automatically Proxmox installed.'''<br />
[[Category:HOWTO]] [[Category:Installation]]</div>
Andrey Kononov