Tyleo-Scripts/irp-alp-dck

62 lines
2.1 KiB
Text
Raw Normal View History

2024-02-18 18:06:30 +00:00
clear
echo ===========================================
echo = Server Node Installation as Docker Host =
echo ===========================================
echo '[cli] Patching Repos to Latest Stable...'
cp /etc/apk/repositories /etc/apk/repositories.backup
echo https://dl-cdn.alpinelinux.org/alpine/latest-stable/main > /etc/apk/repositories
echo https://dl-cdn.alpinelinux.org/alpine/latest-stable/community >> /etc/apk/repositories
echo '[apk] Updating Index...'
apk update
echo '[apk] Upgrading Packages to latest version before setup...'
apk upgrade
echo '[apk] Installing Base Packages...'
apk add curl wget aria2 screen sudo shadow htop btop nano vim fish bash zsh openssh bat fd ack ncdu exa
echo '[orc] Enabling OpenSSH Server Daemon...'
rc-update add sshd
service sshd start
echo '[apk] Installing Docker Packages and LZD & VI Patch...'
apk add docker docker-compose lazydocker ctop
ln -s -f /usr/bin/nano /usr/bin/vi
ln -s -f /usr/bin/lazydocker /usr/bin/lzd
echo '[orc] Enabling Docker Containers Daemon...'
rc-update add docker
service docker start
sleep 5
# Setup Service Account
clear
echo ===========================================
echo = Server Node Installation as Docker Host =
echo ===========================================
echo = Patching Sudo with Ruby Group Patch...
groupadd --gid 50000 ruby
echo "%ruby ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ruby-root
echo = Service Account Creation...
echo -n "= Username (lowercase): "
read Suid
echo = Creating $Suid...
useradd -d /home/service-$Suid -m $Suid
echo = Defining Shell to FiSH...
usermod --shell /usr/bin/fish $Suid
usermod --shell /usr/bin/fish root
echo = Adding to Groups Wheel, Ruby and Docker...
usermod -aG wheel $Suid
usermod -aG ruby $Suid
usermod -aG docker $Suid
echo = Set Password for $Suid Account...
passwd $Suid
echo = Setup $Suid Quick Sudo...
# Setup DNS Client to Server
clear
echo ===========================================
echo = Server Node Installation as Docker Host =
echo ===========================================
mkdir -p /etc/udhcpc
echo RESOLV_CONF=no >> /etc/udhcpc/udhcpc.conf
setup-dns