#!/bin/bash # Ubuntu 22.04 postinstall script # Run it as wget -O - | sh , because | bash works incorrectly BASEURL=https://ukr.pw export DEBIAN_FRONTEND=noninteractive apt-get update echo "Europe/Kiev" > /etc/timezone rm -f /etc/localtime ; ln -s /usr/share/zoneinfo/Europe/Kiev /etc/localtime DEBIAN_FRONTEND=noninteractive apt-get -y install screen vim-nox lynx telnet ftp mc whois traceroute pigz pbzip2 p7zip mlocate psmisc lsof strace binutils apt-get -y purge nano updatedb & wget -O - $BASEURL/vimrc.txt > /etc/vim/vimrc cat /etc/vim/vimrc > /root/.vimrc cp -f /root/.vimrc /etc/skel wget -O - $BASEURL/ub/c-s.txt > /etc/default/console-setup wget -O - $BASEURL/lynx.cfg.txt > /etc/lynx/lynx.cfg wget -O - $BASEURL/ub/50-default.txt > /etc/rsyslog.d/50-default.conf systemctl restart rsyslog wget -O - $BASEURL/ub/rsyslog.logrotate.txt > /etc/logrotate.d/rsyslog sed -i -e 's/^weekly/monthly/' -e '/^monthly/a minsize 1M' -e 's/rotate 4/rotate 1/' /etc/logrotate.conf # Iptables-persistent: apt-get -y install iptables-persistent rm -f /etc/iptables/rules.v6 /usr/share/netfilter-persistent/plugins.d/25-ip6tables # configure color prompt with clock: PUSHD=`pwd` cd /root wget -O - $BASEURL/ub/dotbashrc.txt > .bashrc cp -f .bashrc /etc/skel cd /home for i in `ls -1`; do cp -f /root/.bashrc $i chown $i: $i/.bashrc done sed -i -e 's/^PS1/#PS1/' /etc/bash.bashrc wget -O - $BASEURL/ub/prompt.txt >> /etc/bash.bashrc wget -O /bin/gp $BASEURL/gp.txt wget -O - $BASEURL/ub/top.cron.txt >> /etc/crontab chmod 755 /bin/gp echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config sed -i -e '/ssh_host_ed25519/a HostKeyAlgorithms +ssh-rsa,ssh-dss' /etc/ssh/sshd_config chmod 644 /etc/sudoers echo "root ALL=(ALL:ALL) ALL" > /etc/sudoers echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers chmod 440 /etc/sudoers 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 cd /usr/share/locales ./install-language-pack ru_RU.KOI8-R echo 'LANG="C"' > /etc/default/locale wget -O - $BASEURL/ipl.txt >> /etc/bash.bashrc wget -O - $BASEURL/6off.txt >> /etc/sysctl.conf echo echo ==== Run dpkg-reconfigure console-setup now to make lynx on console show bash.im ==== echo cd $PUSHD #useradd -u 250 -g 27 -d /home/apl -c "Sasha Polonsky" -s /bin/bash -m -p '$6$Trc/XYUt$ZPYySNm19KcdUAuFuQJQ6kAI0RhZCq/4HRh2.ipfpo314NyNUkzoRXJMD2Aj8Yepn0CAskwWl5WYKRegzYKHE.' apl