Skip to content

Instantly share code, notes, and snippets.

@ssmythe
Last active March 4, 2016 19:12
Show Gist options
  • Save ssmythe/f88142c80076df5fac9b to your computer and use it in GitHub Desktop.
Save ssmythe/f88142c80076df5fac9b to your computer and use it in GitHub Desktop.
Fedora/RHEL6/CentOS6 install base: Registers FQDN with DHCP, sets local time zone, and updates system packages
#!/usr/bin/env bash
echo "base: updating system packages"
yum -y update
echo "base: cleaning YUM metadata"
yum clean all
yum clean metadata
echo "base: registering hostname with DHCP server"
cat >> /etc/dhcp/dhclient.conf <<EOF
send fqdn.fqdn "$(hostname).local.tld";
send fqdn.encoded on
send fqdn.server-update off;
also request fqdn, dhcp6.fqdn;
EOF
/sbin/service network restart
echo "base: display hostname FQDN"
hostname -f
echo "base: setting local timezone"
if [ ! -L /etc/localtime ]; then
sed -i '/ZONE/c \ZONE="America\/Los_Angeles"' /etc/sysconfig/clock
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
fi
echo "base: display date and time"
date
echo "base: disable ip6tables"
if [ `chkconfig --list | grep -c "^ip6tables "` -eq 1 ]; then
echo "base: Deleting ip6tables service"
service ip6tables stop
chkconfig --del ip6tables
fi
echo "base: disable iptables"
if [ `chkconfig --list | grep -c "^iptables "` -eq 1 ]; then
echo "base: Deleting iptables service"
service iptables stop
chkconfig --del iptables
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment