Skip to content

Instantly share code, notes, and snippets.

@danhively
Forked from ruzickap/rhel7_customization.sh
Created September 14, 2016 19:48
Show Gist options
  • Save danhively/e3bc34e0116f271f6458665c724bf68e to your computer and use it in GitHub Desktop.
Save danhively/e3bc34e0116f271f6458665c724bf68e to your computer and use it in GitHub Desktop.
RHEL7 customizations
umount /home
sed -i '/\/home/d' /etc/fstab
lvremove -f /dev/mapper/rhel-home
lvextend --resizefs -l +100%FREE /dev/mapper/rhel-root
curl http://10.0.0.141:6809/fusion/rhel-server-7.0-x86_64-dvd.iso > /var/tmp/rhel-server-7.0-x86_64-dvd.iso
mkdir /mnt/iso
echo "/var/tmp/rhel-server-7.0-x86_64-dvd.iso /mnt/iso iso9660 loop,ro 0 0" >> /etc/fstab
mount /mnt/iso
cp /mnt/iso/media.repo /etc/yum.repos.d/
chmod u+w /etc/yum.repos.d/media.repo
cat >> /etc/yum.repos.d/media.repo << EOF
enabled=1
baseurl=file:///mnt/iso
EOF
yum install -y http://ftp.fi.muni.cz/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
yum install -y bash-completion bind-utils bridge-utils dstat htop httpd ipmitool iotop lftp lsof mailx man mc mlocate mutt net-snmp net-snmp-utils net-tools nmap ntp ntpdate openssh-clients postfix rsync sos smartmontools screen strace sysstat telnet tcpdump traceroute unzip vim wget wireshark xz yum-utils
sed -i 's@^\*/10 \*@\*/1 \*@' /etc/cron.d/sysstat
echo "PS1='\[\033[01;31m\]\h\[\033[01;34m\] \w #\[\033[00m\] '" >> /root/.bashrc
echo -e "\nalias sar='LANG=C sar'" >> /etc/bashrc
cat >> /etc/vimrc << \EOF
set laststatus=2
set statusline=%F%m%r%h%w\ (%{&ff}){%Y}[%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
EOF
cat >> /etc/screenrc << EOF
defscrollback 10000
startup_message off
termcapinfo xterm ti@:te@
hardstatus alwayslastline '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
vbell off
EOF
IP=`ip a s br1169 | sed -n 's@[[:space:]]*inet \([^/]*\)/.*@\1@p'`
echo -e "${IP}\t\t$HOSTNAME" >> /etc/hosts
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=1/;s/quiet//;s/rhgb//' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
chkconfig firewalld off
#chkconfig rhsmcertd off
#chkconfig rhnsd off
#chmod a-x /etc/cron.daily/rhsmd
systemctl disable avahi-daemon.socket avahi-daemon.service
systemctl disable iprdump iprinit iprupdate
chkconfig ntpd on
sed -i.orig "s/^\(SYNC_HWCLOCK\)=no/\1=yes/" /etc/sysconfig/ntpdate
chkconfig snmpd on
mkdir -p /etc/skel/.mc/
chmod 700 /etc/skel/.mc
cat > /etc/skel/.mc/ini << EOF
[Midnight-Commander]
auto_save_setup=0
drop_menus=1
use_internal_edit=1
confirm_exit=0
[Layout]
menubar_visible=0
message_visible=0
EOF
cp -r /etc/skel/.mc /root/
test -f /usr/libexec/mc/mc-wrapper.sh && sed -i 's/mc-wrapper.sh/mc-wrapper.sh --nomouse/' /etc/profile.d/mc.sh
cat > /etc/yum.repos.d/hp.repo << \EOF
[HP-SPP]
name=HP Software Delivery Repository for SPP $releasever - $basearch
baseurl=http://downloads.linux.hp.com/SDR/repo/spp/RHEL/$releasever/$basearch/current/
enabled=1
gpgcheck=0
EOF
yum install -y hponcfg hp-snmp-agents hp-ams hpssacli hp-smh-templates hpsmh
hpsnmpconfig --a --rws my_write --ros my_read --rwmips 127.0.0.1 my_write --romips 127.0.0.1 my_read --tcs private --tdips 127.0.0.1 public --sci $HOSTNAME --sli My_Servers
/opt/hp/hpsmh/sbin/smhconfig --autostart=true
postconf -e 'relayhost = yum.example.com'
postconf -e 'inet_interfaces = all'
cat >> /etc/aliases << EOF
root: [email protected]
EOF
newaliases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment