Setup a base almalinux server with my system scripts
swap_file="os.swap"
swap_dir="/var/lib/swap"
kilobit="1000000"
mem="$(free|grep ':'|awk '{print $2}'|head -n1||echo "1")"
if [ $mem -le $kilobit ] && [ ! -f "$swap_dir/$swap_file" ]; then
echo "Setting up swap in $swap_dir/$swap_file"
echo "This may take a few minutes so enjoy your coffee"
sudo mkdir -p "$swap_dir"
if sudo dd if=/dev/zero of=$swap_dir/$swap_file bs=2048 count=1048576 >/dev/null; then
sudo chmod 600 $swap_dir/$swap_file
sudo mkswap $swap_dir/$swap_file
sudo swapon $swap_dir/$swap_file
if ! grep -qs "$swap_dir/$swap_file" /etc/fstab; then
echo "$swap_dir/$swap_file swap swap defaults 0 0" |sudo tee -a /etc/fstab >/dev/null
fi
fi
fi
hostnamectl set-hostname host
passwd
yum install -yy epel-release && yum install -y vnstat && systemctl enable --now vnstat && reboot
rpm -ev --nodeps initscripts
yum update -y && \
yum -yy install initscripts net-tools && \
#yum install -y NetworkManager-initscripts-updown && \
reboot
yum install -y git curl wget bash bash-completion glibc-all-langpacks
bash -c "$(curl -q -LSsf "https://github.com/casjay-base/centos/raw/main/root/.local/bin/fetch-repo-file")" && reboot
curl -q -LSsf "https://github.com/casjay-base/centos/raw/main/root/.local/bin/run-os-update" | bash -s -- --kernel-ml && reboot
PHP_VER="7.4"
dnf module -y reset php
dnf module -y install php:remi-$PHP_VER
yum install -yy php-cli php-cgi php-fpm httpd nginx && reboot
[ ! -d "/usr/local/share/CasjaysDev/scripts" ] && \
echo cloning "https://github.com/casjay-dotfiles/scripts >/usr/local/share/CasjaysDev/scripts" &&
sudo git clone -q https://github.com/casjay-dotfiles/scripts "/usr/local/share/CasjaysDev/scripts" && \
sudo /usr/local/share/CasjaysDev/scripts/install.sh && reboot
git clone -q "url_to_dotfiles" "$HOME/dotfiles_dir"
sudo bash -c "$(curl -q -LSsf "https://github.com/pkmgr/centos/raw/main/scripts/min.sh")"
OR for oracle cloud almalinux
sudo bash -c "$(curl -q -LSsf "https://github.com/pkmgr/centos/raw/main/scripts/min.oci.sh")"
sudo bash -c "$(curl -q -LSsf "https://github.com/casjay-base/centos/raw/main/root/.local/bin/run-os-update")"