broke out ubuntu scripts into separate installs

This commit is contained in:
2023-08-21 13:05:53 -05:00
parent 3413c56d71
commit a0b0ee1103
6 changed files with 24 additions and 77 deletions

View File

@@ -1,33 +0,0 @@
# create directories
mkdir /opt/docker
chown -R akanealw:akanealw /opt/docker
ln -s /opt/docker /docker
ln -s /opt/docker /home/akanealw/docker
# install docker
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# create docker group
groupadd docker > /dev/null 2>&1
usermod -aG docker akanealw
# enable service
systemctl enable docker.service
systemctl enable containerd.service
# added aliases to bash.bashrc
echo "alias dc='docker compose'" >> /etc/bash.bashrc
echo "alias dcup='docker compose up -d'" >> /etc/bash.bashrc
echo "alias dcaup='docker compose -f admin-compose.yml up -d'" >> /etc/bash.bashrc
echo "alias dcdown='docker compose down'" >> /etc/bash.bashrc
echo "alias dcadown='docker compose -f admin-compose.yml down'" >> /etc/bash.bashrc
echo "alias dcpull='docker compose pull'" >> /etc/bash.bashrc
echo "alias dcapull='docker compose -f admin-compose.yml pull'" >> /etc/bash.bashrc
echo "alias dps='docker ps'" >> /etc/bash.bashrc
echo "alias dipaf='docker image prune -a -f'" >> /etc/bash.bashrc

View File

@@ -118,46 +118,3 @@ if [ $isInFile -eq 0 ]; then
echo "# nfs shares" >> /etc/fstab
echo "192.168.1.41:/mnt/data /mnt/truenasdata nfs defaults,nolock,soft,vers=4.2 0 0" >> /etc/fstab
fi
# ask to install samba
if [[ ! -f /etc/samba/smb.conf ]] ; then
read -r -p "Install Samba? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
apt-get install -y samba --no-install-recommends
# configure default samba share
(echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw
sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf
isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]")
if [ $isInFile -eq 0 ]; then
echo "[akanealw]" >> /etc/samba/smb.conf
echo " comment = akanealw" >> /etc/samba/smb.conf
echo " read only = no" >> /etc/samba/smb.conf
echo " path = /home/akanealw" >> /etc/samba/smb.conf
echo " guest ok = no" >> /etc/samba/smb.conf
echo "" >> /etc/samba/smb.conf
fi
fi
fi
# ask to install docker
if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then
read -r -p "Install Docker? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
# prepare for install
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -p /home/akanealw/docker/appdata
chown -R akanealw:akanealw /home/akanealw/docker
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# install docker
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# post install
groupadd docker > /dev/null 2>&1
usermod -aG docker akanealw
systemctl enable docker.service
systemctl enable containerd.service
fi
fi

View File

@@ -1,3 +1,5 @@
#!/bin/bash
# ask to install docker
if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then
read -r -p "Install Docker? <y/N> " prompt
@@ -19,4 +21,4 @@ if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then
systemctl enable docker.service
systemctl enable containerd.service
fi
fi
fi

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# ask to install samba
if [[ ! -f /etc/samba/smb.conf ]] ; then
read -r -p "Install Samba? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
apt-get install -y samba --no-install-recommends
# configure default samba share
(echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw
sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf
isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]")
if [ $isInFile -eq 0 ]; then
echo "[akanealw]" >> /etc/samba/smb.conf
echo " comment = akanealw" >> /etc/samba/smb.conf
echo " read only = no" >> /etc/samba/smb.conf
echo " path = /home/akanealw" >> /etc/samba/smb.conf
echo " guest ok = no" >> /etc/samba/smb.conf
echo "" >> /etc/samba/smb.conf
fi
fi
fi