#!/bin/bash # # running this script assumes # networking is already set up #----------------------------------------------------------------------------------- # install snapd (needed for certbot) #----------------------------------------------------------------------------------- echo " " read -p "install snapd (nneded for certbot)?" yn case $yn in [Yy]* ) read -p "Will now install epel for RHEL8, Press any key to continue..." dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm read -p "Will now update, Press any key to resume ..." dnf -y update echo " " echo "fix squashfs problem that messes up snapd..." cp /etc/modprobe.d/cis.conf /etc/modprobe.d/cis.conf.orig echo "comment out squashfs: #install squashfs /bin/true" vim /etc/modprobe.d/cis.conf echo "Installing snapd" echo "With the EPEL repository added to your RHEL installation, simply install the snapd package:" read -p "Will now install snapd for RHEL8, Press any key to continue..." dnf -y install snapd echo " " echo "Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:" echo "systemctl enable --now snapd.socket" systemctl enable --now snapd.socket echo "To enable classic snap support, need to create a symbolic link between /var/lib/snapd/snap and /snap:" read -p "Press any key to continue..." ln -s /var/lib/snapd/snap /snap echo " " echo "Either log out and back in again or restart your system to ensure snap’s paths are updated correctly." echo " " ;; [Nn]* ) exit;; * ) echo "Please answer y or n.";; esac #----------------------------------------------------------------------------------- # set up certbot #----------------------------------------------------------------------------------- read -p "Setup Certbot?" yn case $yn in [Yy]* ) echo "Ensure that your version of snapd is up to date" echo "snap install core; sudo snap refresh core" snap install core; sudo snap refresh core echo " " echo "dnf remove certbot" dnf remove certbot echo " " echo "Install Certbot..." echo "snap install --classic certbot" snap install --classic certbot echo " " echo "Prepare the Certbot command" echo "ln -s /snap/bin/certbot /usr/bin/certbot" ln -s /snap/bin/certbot /usr/bin/certbot echo " " echo "make certbot dry run..." echo "certbot certonly --apache --dry-run" certbot certonly --apache --dry-run ;; [Nn]* ) exit;; * ) echo "Please answer yes or no.";; esac