#!/bin/bash # Update and isntall the packages unsed in my homelab # run "curl -L https://johnhgaunt.com/update.sh | bash" as root to use this script # need to be root if [ "$EUID" -ne 0 ]; then echo "Please run as root" exit fi all_distros () { # clone the homelab scripts for use later cd /root git clone https://git.johnhgaunt.com/jgaunt/homelab-scripts.git } # Debian OS if [ -f /etc/debian_version ]; then # install the apt-transport-https apt install -y apt-transport-https wget # download the gpg key for PBIS-Open wget -O - http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis | apt-key add - # download the repo for PBIS-Open for SSO and Domain wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list # update the list of available packages apt update # install the packages apt install -y pbis-open sudo nano htop nload iperf iperf3 open-vm-tools unattended-upgrades unzip git nfs-common # modify ssh to allow root login and then restart the service sed --in-place "s/^.PermitRootLogin\ prohibit-password/PermitRootLogin\ yes/" /etc/ssh/sshd_config systemctl restart sshd all_distros # CentOS OS elif [ -f /etc/redhat-release ]; then # isntall the epel for other packages and wget yum install -y epel-release yum-utils # download the repo for PBIS-Open for SSO and Domain yum-config-manager --add-repo http://repo.pbis.beyondtrust.com/yum/pbiso.repo # clean the yum cache yum clean all # install the packages yum install -y pbis-open sudo nano htop nload iperf iperf3 bind-utils open-vm-tools yum-cron unzip nfs-utils git wget # modify yum-cron config to auto install security updates and enable/start the service sed --in-place "s/^update_cmd\ =\ default/update_cmd\ =\ security/" /etc/yum/yum-cron.conf sed --in-place "s/^apply_updates\ =\ no/apply_updates\ =\ yes/" /etc/yum/yum-cron.conf systemctl enable yum-cron systemctl restart yum-cron # modify ssh to allow root login and then restart the service sed --in-place "s/^#PermitRootLogin\ yes/PermitRootLogin\ yes/" /etc/ssh/sshd_config systemctl restart sshd all_distros else echo "Unable to determine linux distro" exit fi