FOG

Setup

Basic guide (the official docs are the same, this is just condensed): http://khmerdigital.net/2017/12/11/how-to-install-fog-in-centos-7/

  1. Prepare The System

Configure firewalld

yum install firewalld -y
systemctl start firewalld
systemctl enable firewalld 
for service in http https tftp ftp mysql nfs mountd rpc-bind proxy-dhcp samba; do firewall-cmd --permanent --zone=public --add-service=$service; 
done

echo "Open UDP port 49152 through 65532, the possible used ports for fog multicast" 
firewall-cmd --permanent --add-port=49152-65532/udp
echo "Allow IGMP traffic for multicast"
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p igmp -j ACCEPT
systemctl restart firewalld.service
echo "Done."   

Add firewalld exceptions for DHCP and DNS (In case, you are going to run DHCP in FOG server)

for service in dhcp dns; do firewall-cmd --permanent --zone=public --add-service=$service; done
firewall-cmd --reload
echo Additional firewalld config done.
Set SELinux to permissive on boot
sed -i.bak 's/^.*\SELINUX=enforcing\b.*$/SELINUX=permissive/' /etc/selinux/config  
  1. Setup FOG

To install latest version of the FOG by using git, it can be found here.

yum install git -y
cd ~
mkdir git
cd git
git clone https://github.com/FOGProject/fogproject.git
cd fogproject/bin
./installfog.sh
echo "Congratulation! FOG is installed in your server"

Settings

Here are the settings FOG will use:

  • Base Linux: Redhat

  • Detected Linux Distribution: CentOS Linux

  • Server IP Address:######

  • Server Subnet Mask:######

  • Interface: eth0

  • Installation Type: Normal Server

  • Internationalization: 0

  • Image Storage Location: /images

  • Using FOG DHCP: No

  • DHCP will NOT be setup but you must setup your

  • current DHCP server to use FOG for PXE services.

  • On a Linux DHCP server you must set: next-server and filename

  • On a Windows DHCP server you must set options 066 and 067

  • Option 066/next-server is the IP of the FOG Server:

  • Option 067/filename is the bootfile: (e.g. undionly.kpxe)

If you would like to backup your FOG database you can do so using MySQL Administrator or by running the following command in a terminal window (Applications->System Tools->Terminal), this will save the backup in your home directory.

mysqldump --allow-keywords -x -v fog > fogbackup.sql

Imaging

Linux

Boot linux, register it with FOG then click capture twice under hosts. The first will make a image association and the second will schedule the capture.

https://wiki.fogproject.org/wiki/index.php?title=Booting_into_FOG_and_Capturing_your_first_Image

Windows

Changes

I added in a seperate disk for images. You just mount it to /images.

https://wiki.fogproject.org/wiki/index.php?title=Adding_Storage_to_a_FOG_Server

Issues

FOG isnt connecting if IPTABLES are in place, regardless of rules

  • I ran the firewalld things instead, it works. I will deal with that for this host.

FOG isnt responding to a hostanme, only IP, in browser

  • I think this is a browser issue, IE loaded it fine.

FOG was failing during capture, this was because I made the image resizeable disk, instead of non-resizable disk

Maintenance

Database Maintenance Commands

Sometimes, a host will be created with an ID of 0 (zero). Sometimes, there are MAC addresses that loose their association with a host, and in a sense become orphaned. Sometimes there are tasks that just need cleared out. Sometimes there are hosts without MACs. Sometimes groups of ID 0 get made, sometimes snapins of ID 0 get made. Sometimes snapins are associated with hosts that don't exist anymore. Other things go wrong sometimes. These things cause problems with FOG's operation and need cleared out in order to have a clean & healthy database. The below commands are intended to run on FOG 1.3, 1.4, and 1.5 series, they will clear these problems for you. This also fixes problems with multicast occasionally, where the partclone screen just sits there doing nothing.

https://wiki.fogproject.org/wiki/index.php/Troubleshoot_MySQL

# No password:
mysql -D fog

# The following chunk of commands will clean out most problems and are safe:
DELETE FROM `hosts` WHERE `hostID` = '0';
DELETE FROM `hostMAC` WHERE hmID = '0' OR `hmHostID` = '0';
DELETE FROM `groupMembers` WHERE `gmID` = '0' OR `gmHostID` = '0' OR `gmGroupID` = '0';
DELETE FROM `snapinGroupAssoc` WHERE `sgaID` = '0' OR `sgaSnapinID` = '0' OR `sgaStorageGroupID` = '0';
DELETE FROM `snapinAssoc` WHERE `saID` = '0' OR `saHostID` = '0' OR `saSnapinID` = '0';
DELETE FROM `hosts` WHERE `hostID` NOT IN (SELECT `hmHostID` FROM `hostMAC` WHERE `hmPrimary` = '1');
DELETE FROM `hosts` WHERE `hostID` NOT IN (SELECT `hmHostID` FROM `hostMAC`);
DELETE FROM `hostMAC` WHERE `hmhostID` NOT IN (SELECT `hostID` FROM `hosts`);
DELETE FROM `snapinAssoc` WHERE `saHostID` NOT IN (SELECT `hostID` FROM `hosts`);
DELETE FROM `groupMembers` WHERE `gmHostID` NOT IN (SELECT `hostID` FROM `hosts`);
DELETE FROM `tasks` WHERE `taskStateID` IN ("1","2","3");
DELETE FROM `snapinTasks` WHERE `stState` in ("1","2","3");
TRUNCATE TABLE multicastSessions; 
TRUNCATE TABLE multicastSessionsAssoc; 
DELETE FROM tasks WHERE taskTypeId=8;

# This one clears the history table which can get pretty large:
TRUNCATE TABLE history;
   
# This one will clear the userTracking table, This table is where user login/logout (for host computers, not the fog server) is stored. This table can also get pretty large.
TRUNCATE TABLE userTracking;
    
quit