How I Deploy an RTD FOG Server git1.3.0-RC-10_svn5955
-
This document assumes the following:
A. My CentOS 7.2.1511 recipe (for solely running a FOG Server) ( https://forums.fogproject.org/topic/8231/my-centos-7-2-1511-recipe-for-solely-running-a-fog-server )
B. How I Create a Ready-to-Deploy FOG Server git1.3.0-RC-10_svn5955 on CentOS 7. ( https://forums.fogproject.org/topic/8706/how-i-create-a-ready-to-deploy-fog-server-git1-3-0-rc-10_svn5955-on-centos-7-x-vm )
C. I deploy to VM or Physical systems containing 2 HDD. One for the Server, the other for the images.
D. I format HDD2 as NTFS from a Windows machine. We’re a Windows house and this allows me to easily disconnect and push/pull images when I cannot saturate a local network with large file transfers.=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
01> Prepare DHCP & DNS for FOG Server(s)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- Create IP Reservation in DHCP Scope - Set DHCP options 66/67 for ipxe "undionly.kpxe" - Create DNS
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
02a> Prepare Physical FOG Server Box
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-i. Flash and Program BIOS ii. Set PXE Boot first iii. Attach 80+ GB HDD to Controller Port 0 iv. Attach 1 TB HDD to Controller Port 2 Pre-formatted From Windows as NTFS v. Quick Image "CentOS7_FOG...RTD" vi. Shutdown when complete vii. Program BIOS / set Boot Order to HDD ONLY
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
02b> Prepare Windows Host for Portable Oracle VirtualBox Machine FOG Server
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- On My Development FOG
i. Disk Management Create a 0.5 TB .VHD, NTFS, name: "xyzfogimages.vhd" ii. Copy Standard Images to .VHD iii. Detach .VHD
- On a Windows Host
i. Copy "xyzfogimages.vhd" to "C:\VirtualBox\" ii. Install "VirtualBox 5.0.18-106667"
- On a VirtualBox
i. Create a New Machine: xyzfog, Linux, Red Hat (64-bit), 2048 MB Memory, Create a virtual hard disk now, CREATE ii. Create Virtual Hard Disk: "xyzfog", 0.5 TB, VHD, Dynamically allocated, CREATE iii. Settings: System > Boot Order > Network ONLY iv. Settings: Audio > Disable v. Settings: Network > Attached to Bridged, Ethernet NIC, MAC Address: 01:23:45:67:89:AB (A Global MAC), OK vi. PXE Boot and QuickImage "CentOS7_FOG...RTD" vii. Shutdown when complete viii. Settings: System > Boot Order > Hard Disk ONLY ix. Settings: Storage > Controller SATA > Add Hard Disk "C:\VirtualBox\xyzfogimages.vhd" x. Settings: Storage > Controller IDE > Add Optical Drive "VBoxGuestAdditions_5.0.18.iso" to Controller IDE
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
03> Configure Oracle VirtualBox FOG Server
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- Login REMOTELY with Kitty ( http://kitty.9bis.net/ )
- Elevate Access Level
sudo su
- Install Dynamic Kernel Module Support
yum -y install dkms
- Install Linux Development Tools
yum -y groupinstall "Development Tools"
- Install VirtualBox Guest Additions
( Mount CDROM device (the VBoxGuestAdditions_…iso) )
( Run VirtualBox Guest Additions Installer )
( Unmount CDROM device )
mkdir /media/cdrom mount /dev/cdrom /media/cdrom sh /media/cdrom/VBoxLinuxAdditions.run umount /media/cdrom
- Reboot to Commit
reboot
- Eject .ISO from VirtualBox Machine
- VBox: Remove optical disk from virtual drive
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
04> Initial Configuration of Any Server
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- Login REMOTELY with Kitty ( http://kitty.9bis.net/ )
- Elevate Access Level
sudo su
- Update Clock
ntpdate ocsb.local
- Verify Disk Space Usage
cfdisk /dev/sda
- Retrieve IPv4 MAC Address
ip addr
- Change System Identity of NIC to eth0 instead of UUID
vim /etc/sysconfig/network-scripts/ifcfg-eth0 Replace line: UUID="blahblahblah" With: HWADDR="00:21:86:ed:37:c5"
- Rename the Server
( replace xyzfog with new hostname )
echo xyzfog > /proc/sys/kernel/hostname sed -i.bak 's|127.0.1.1.*|127.0.1.1\t'"xyzfog"'|g' /etc/hosts echo xyzfog > /etc/hostname sysctl kernel.hostname=xyzfog
- Display the current File System Table
cat /etc/fstab sleep 3
- Backup File System Table
cp -f /etc/fstab /etc/fstab.bak
- Append Persistent AutoMount Entry for Windows NTFS formatted HDD2 as /images
- This /images Mount Point shadows the root directory of /images at next reboot
if [ -b /dev/sdb1 ]; then mount /dev/sdb1 /mnt/temp echo -e "/dev/sdb1\t/images\tntfs\tdefaults\t0\t0" >> /etc/fstab ls -la /mnt/temp sleep 3 umount /mnt/temp fi
- Display the current File System Table
cat /etc/fstab sleep 3
- Reboot to Commit
reboot
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
03> Install FOG here
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- Login REMOTELY with Kitty ( http://kitty.9bis.net/ )
- Elevate Access Level
sudo su
- Set Permissions on Images directory that is now AutoMounted
chmod -R 777 /images
- Display Build of each FOG Repository
grep FOG_VERSION /opt/trunkgit/fogproject/packages/web/lib/fog/system.class.php | sed "s/^[ \t]*define(.FOG_VERSION., .\([0-9\.]*\).);/FOG Version in GIT: \1/" grep FOG_VERSION /opt/trunksvn/fogproject/packages/web/lib/fog/system.class.php | sed "s/^[ \t]*define(.FOG_VERSION., .\([0-9\.]*\).);/FOG Version in SVN: \1/"
- Install FOG from either the SVN or GIT repository
cd /opt/trunkgit/fogproject/bin ./installfog.sh
- or
cd /opt/trunksvn/fogproject/bin ./installfog.sh
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Installer Responses for a FOG-Only Installation
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-@ What version of Linux would you like to run the installation for? (1) Redhat Based Linux (Redhat, CentOS) @ What type of installation would you like to do? (N)ormal Server @ Would you like DHCP to handle DNS? N @ Would you like to use the FOG server for DHCP service? N @ ... Would you like to install the additional language packs? N @ Would you like to donate computer resources to the FOG Project? N @ Are you sure you wish to continue? Y @ Is the MySQL password blank? Y @ Press [Enter} key when database is updated/installed Browser visit http://x.x.x.x/fog/management Install/Upgrade Now @ Install / Update Successful! <enter - in terminal session> @ Setup complete! ... the initial Installation is complete
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
04> Post-Install Configurations
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- Login REMOTELY with Kitty ( http://kitty.9bis.net/ )
- Elevate Access Level
sudo su
- Create script /bin/make_fog_portable and set Permissions
echo '#!/bin/bash' > /bin/make_fog_portable echo '#' >> /bin/make_fog_portable echo '# make_fog_portable &' >> /bin/make_fog_portable echo '#' >> /bin/make_fog_portable echo '# This script is expected to be run as a job from /etc/rc.local' >> /bin/make_fog_portable echo '# It will wait until an IP address is found, then use that IP' >> /bin/make_fog_portable echo '# address to configure the FOG Server for that site.' >> /bin/make_fog_portable echo '#' >> /bin/make_fog_portable echo ' ' >> /bin/make_fog_portable chmod 755 /bin/make_fog_portable vim /bin/make_fog_portable
- Add the following at the end; [ESC]:wq to write/quit
- Change ThePassword to a password of your choice
# Wait for IPv4 address IP=`ip addr list eth0 | grep "inet " |cut -d" " -f6|cut -d/ -f1` while [ -z $IP ] do echo "Waiting :05 for an IP Address" > /dev/kmsg sleep 5 IP=`ip addr list eth0 | grep "inet " |cut -d" " -f6|cut -d/ -f1` done # Update FOG-relevant MySQL entries with current IP address sleep 6 echo "Updating IP address for FOG_TFTP_HOST to be $IP [`date`]" > /dev/kmsg mysql --user=root --password=ThePassword -e "UPDATE \`globalSettings\` SET \`settingValue\` = '$IP' WHERE \`settingKey\` ='FOG_TFTP_HOST';" fog echo "Updating IP address for FOG_WEB_HOST to be $IP [`date`]" > /dev/kmsg mysql --user=root --password=ThePassword -e "UPDATE \`globalSettings\` SET \`settingValue\` = '$IP' WHERE \`settingKey\` ='FOG_WEB_HOST';" fog echo "Updating IP address for FOG_WOL_HOST to be $IP [`date`]" > /dev/kmsg mysql --user=root --password=ThePassword -e "UPDATE \`globalSettings\` SET \`settingValue\` = '$IP' WHERE \`settingKey\` ='FOG_WOL_HOST';" fog echo "Updating IP address for Storage Node DefaultMember to be $IP [`date`]" > /dev/kmsg mysql --user=root --password=ThePassword -e "UPDATE \`nfsGroupMembers\` SET \`ngmHostname\` = '$IP' WHERE \`ngmMemberName\` ='DefaultMember';" fog # - Update FOG Host Configuration file generated at Install echo "Updating IP address in file .fogsettings to be $IP [`date`]" > /dev/kmsg sed -i.bak "s|ipaddress='.*\'|ipaddress='$IP'|g" /opt/fog/.fogsettings # - Update default.ipxe with current IP address echo "Updating IP address in file default.ipxe to be $IP [`date`]" > /dev/kmsg sed -i.bak "s|http://\([^/]\+\)/|http://$IP/|" /tftpboot/default.ipxe # CentOS 7+ # echo "Restarting Critical FOG Services [`date`]" > /dev/kmsg # systemctl restart FOGImageReplicator FOGMulticastManager FOGPingHosts FOGScheduler FOGSnapinReplicator mariadb vsftpd httpd echo "Sleeping 10 seconds before releasing script [`date`]" > /dev/kmsg sleep 10
-
- Create FOG-mandatory files for imaging
touch /images/{,dev/}.mntcheck
- Update NFS Share Settings ( /etc/exports )
- change /images entry from RO to RW for manual sync of images using rsync
- change /images/dev entry from async to preferred safer sync
sed -i.bak "s|ro,sync|rw,sync|g" /etc/exports sed -i "s|rw,async|rw,sync|g" /etc/exports
- Set Timezone
- ( see http://php.net/manual/en/timezones.php )
sed -i.bak "s|;date.timezone =|date.timezone = Canada/Eastern|g" /etc/php.ini
- Make Apache Default Web Page default to <servername>/ instead of <servername>/fog/
- ie: use url http://xyzfog/
- *if no reboot then: systemctl restart httpd.service
sed -i.bak "s|DirectoryIndex index.html|DirectoryIndex /fog/index.php index.html|g" /etc/httpd/conf/httpd.conf sed -i.bak "s|/management|/fog/management|g" /var/www/html/fog/index.php
- Make Fog IP blind
- Replace fixed IP entries with System Variable
- ‘DATABASE_HOST’,‘TFTP_HOST’,‘PXE_IMAGE_DNSADDRESS’,‘STORAGE_HOST’,‘WEB_HOST’,‘WOL_HOST’
sed -i.bak "s|\".*\..*\..*\..*\"|\$_SERVER['SERVER_ADDR']|" /var/www/html/fog/lib/fog/config.class.php
- Add Startup JOB call to /etc/rc.local for make_fog_portable and set Permissions
cp -f /etc/rc.local /etc/rc.local.bak echo ' ' >> /etc/rc.local echo 'make_fog_portable' >> /etc/rc.local echo ' ' >> /etc/rc.local chmod 755 /etc/rc.local
- Secure MySQL Database & Set Password
- The password you use here is ThePassword you chose at “Update FOG-relevant MySQL entries with current IP address”
mysql_secure_installation
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Responses- Use ThePassword you defined at Create script /bin/make_fog_portable and set Permissions
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Enter current password for root: <enter> - Set root password? Y - New password: <The_Password> - Remove anonymous users? Y - Disallow root login remotely? Y - Remove test database and access to it? Y - Reload privilege tables now? Y
- Change FOG References to MySQL Password
sed -i.bak "s|snmysqlpass=''|snmysqlpass='ThePassword'|g" /opt/fog/.fogsettings sed -i.bak "s|DATABASE_PASSWORD', \"\"|DATABASE_PASSWORD', \"ThePassword\"|g" /var/www/html/fog/lib/fog/config.class.php
- Establish PhP 7.x Repository
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php70 php -v
- Clean & Update the OS (includes PhP 7.x installation)
yum clean all yum makecache yum update -y
- Clear history of typed commands
history -c
- Reboot to Commit
reboot
… and that is my FOG Server.
-
If you see something that I’ve done as blatantly wrong, not contrary to what you do but dead wrong, or you can expand upon what I’m doing, please do toss it up here.
-
The reason I created the make_fog_portable script is because we have about 70 sites serviced by VirtualBox servers.
The Oracle VirtualBox VM has a fixed MAC address.
Each of these sites is on its own IP subnet with its own scope properties.
That particular MAC address has an IP reservation, bootfile configuration and a DNS entry at every one of those sites/subnets. This allows any OVB VM to work at any site.
The same goes with the physical servers. If we change the subnet for that site, the script would automatically reconfigure the server at next reboot.
This has the added benefit of my being able to create a FOG server in my DEV environment, on my private scope and not have to worry about configuring the server with the IP of a foreign subnet; I just configure the name.