#!/bin/bash # CentOS postinstall script BASEURL="http://ukr.pw" echo echo "Installing minimal set of software..." echo yum -y install wget screen lynx mc whois 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/vimrc.txt > /etc/vimrc wget -O - $BASEURL/lynx.cfg.txt > /etc/lynx.cfg wget -O - $BASEURL/screenrc.txt > /etc/screenrc echo "LANG=C" > /etc/locale.conf echo "KEYMAP=us" > /etc/vconsole.conf echo FONT=cp866-8x16 >> /etc/vconsole.conf sed -i -e 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config echo 'root ALL=(ALL) ALL' > /etc/sudoers echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers chmod 440 /etc/sudoers sed -i -e '11,50d' /etc/bashrc wget -O - $BASEURL/cs/prompt.txt >> /etc/bashrc wget -O - $BASEURL/ipl.txt >> /etc/bashrc ntpdate pool.ntp.org hwclock -w 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 yum -y remove firewalld yum -y install iptables-services wget -O - $BASEURL/6off.txt >> /etc/sysctl.conf wget -O /bin/gp $BASEURL/gp.txt chmod 755 /bin/gp for i in avahi-daemon.socket avahi-daemon.service; do systemctl stop $i systemctl disable $i done echo kernel-`uname -r` > /root/kernel.txt yum -y update echo 'KERNELS=`rpm -qa | grep kernel-3 | grep -v devel | wc -l`' >> /etc/rc.d/rc.local echo 'if [ $KERNELS -gt 1 ]; then yum -y remove `cat /root/kernel.txt`; fi' >> /etc/rc.d/rc.local echo 'rm -f /root/kernel.txt /root/install*' >> /etc/rc.d/rc.local echo 'head -n -4 /etc/rc.d/rc.local > /tmp/rc.local && mv -f /tmp/rc.local /etc/rc.d/rc.local' >> /etc/rc.d/rc.local chmod 755 /etc/rc.d/rc.local # useradd -u 100 -g 10 -d /home/apl -c "Sasha Polonsky" -m -p '$6$Trc/XYUt$ZPYySNm19KcdUAuFuQJQ6kAI0RhZCq/4HRh2.ipfpo314NyNUkzoRXJMD2Aj8Yepn0CAskwWl5WYKRegzYKHE.' apl