#!/bin/bash # CentOS 8 postinstall script BASEURL="http://ukr.pw" echo echo "Installing minimal set of software from CentOS repository..." echo yum -y install iptables-services mc mlocate tcpdump vim-enhanced wget telnet ftp lsof bind-utils traceroute echo echo "Installing extra of software from EPEL repository..." echo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm yum -y --enablerepo=PowerTools install screen lynx whois wget -O /sbin/busybox https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-x86_64 chmod 755 /sbin/busybox echo echo "Performing postinstall configuration..." echo updatedb & wget -O - $BASEURL/vimrc.txt > /root/.vimrc cp -f /root/.vimrc /etc/skel wget -O - $BASEURL/lynx.cfg.txt > /etc/lynx.cfg wget -O - $BASEURL/screenrc.txt > /etc/screenrc cd /home for i in `ls -1`; do cp -f /root/.vimrc $i chown $i: $i/.vimrc done 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) NOPASSWD: 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 wget -O - $BASEURL/cs/top.cron.txt >> /etc/crontab service chronyd stop busybox ntpd -nqp pool.ntp.org hwclock -w service chronyd start 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 ssd-common yum -y install iptables-services wget -O - $BASEURL/6off.txt >> /etc/sysctl.conf wget -O /bin/gp $BASEURL/gp.txt chmod 755 /bin/gp sed -i -e "s/rhgb quiet/rhgb quiet nomodeset/" /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg systemctl stop tuned.service systemctl disable tuned.service echo kernel-`uname -r` > /root/kernel.txt yum -y update echo 'KERNELS=`rpm -qa | grep kernel-4 | 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