#!/bin/bash # CentOS postinstall script BASEURL="http://ukr.pw" echo echo "Installing minimal set of software..." echo yum -y install screen lynx mc jwhois telnet ftp ntpdate traceroute mlocate lsof tcpdump openssh-clients vim-enhanced bind-utils tcpdump xz man echo echo "Performing postinstall configuration..." echo updatedb & wget -O - $BASEURL/wgetrc.txt > /etc/wgetrc wget -O - $BASEURL/vimrc.txt > /etc/vimrc wget -O - $BASEURL/lynx.cfg.txt > /etc/lynx.cfg wget -O - $BASEURL/screenrc.txt > /etc/screenrc echo LANG=\"C\" > /etc/sysconfig/i18n sed -i -e 's/\[1-6\]/1/' /etc/sysconfig/init sed -i -e 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config sed -i -e '11,44d' /etc/bashrc wget -O - $BASEURL/cs/prompt.txt >> /etc/bashrc wget -O - $BASEURL/ipl.txt >> /etc/bashrc sed -e "s/^uucp/#uucp/" -i /etc/rsyslog.conf service rsyslog restart sed -i -e 's/^weekly/monthly/' -e '/^monthly/a minsize 1M' -e 's/rotate 4/rotate 1/' /etc/logrotate.conf sed -i '/spooler/d' /etc/logrotate.d/syslog rm -rf /var/log/spooler /var/log/tallylog /var/log/anaconda* wget -O - $BASEURL/6off.txt >> /etc/sysctl.conf wget -O /bin/gp $BASEURL/gp.txt chmod 755 /bin/gp echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config sed -i -e 's/^GSSAPIAuthentication yes/GSSAPIAuthentication no/' -e 's/^#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config service sshd restart ntpdate pool.ntp.org SWAP=`free | grep Swap: | awk '{ print $2 }'` if [ $SWAP -eq 0 ]; then MEM=`free | grep Mem: | awk '{ print $2 }'` SWAPSIZE=$(($MEM/2)) if [ $SWAPSIZE -gt 3100000 ]; then SWAPSIZE=3100000; fi echo echo "No swap found, creating swap file $SWAPSIZE megabytes" echo swapoff -a rm -f /pagefile.sys dd if=/dev/zero of=/pagefile.sys bs=100M count=$(($SWAPSIZE/100000)) chmod 600 /pagefile.sys mkswap -f /pagefile.sys grep -v swap /etc/fstab > /tmp/fstab mv -f /tmp/fstab /etc echo "/pagefile.sys none swap sw 0 0" >> /etc/fstab swapon -a fi echo echo "Cleaning up..." echo for i in INPUT OUTPUT FORWARD; do iptables -P $i ACCEPT; iptables -F $i ; done service iptables save for i in netfs auditd iptables; do chkconfig --level 2345 $i off; done