-
Notifications
You must be signed in to change notification settings - Fork 3
/
dockerhost-basic-debian-11-non-root.sh
49 lines (37 loc) · 1.83 KB
/
dockerhost-basic-debian-11-non-root.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
set -e
clear
function get_latest_github_release_number() {
# curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
curl --silent "https://api.github.com/repos/$1/releases/latest" | jq -r '.name'
}
read -e -p $'Update && Upgrade System first [y/n]? : ' -i "y" if_update_first
# Change System timezone
read -e -p $'Set Default System Timezone : ' -i "Europe/Istanbul" system_default_timezone
sudo timedatectl set-timezone $system_default_timezone
if [[ $if_update_first =~ ^([Yy])$ ]]
then
sudo apt --yes update && sudo apt -q --yes upgrade
fi
sudo apt --yes install wget curl git nano lsb-release sqlite3 p7zip gnupg-agent apt-transport-https ca-certificates software-properties-common jq systemd-timesyncd cron htop zstd
sudo systemctl enable --now cron
sudo systemctl enable --now systemd-timesyncd
bash <(curl -sSL -fsSL https://get.docker.com)
sudo usermod -aG docker $USER
sudo systemctl enable --now docker
sudo chmod 666 /var/run/docker.sock
curl -fL https://raw.githubusercontent.com/docker/compose-switch/master/install_on_linux.sh | sudo bash
# docker_compose_latest_version="$(get_latest_github_release_number docker/compose)"
# sudo curl -L "https://github.com/docker/compose/releases/download/$docker_compose_latest_version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
# sudo chmod +x /usr/bin/docker-compose
echo "alias dc='docker compose'" >> ~/.bashrc
sudo apt --yes update && sudo apt -q --yes upgrade && sudo apt --yes autoremove
clear
echo -e $'\n=====================================\n\e[32mDockerHost successfully installed.\033[0m\n=====================================\n'
## reboot at the end
read -e -p $'Do you want to \e[31mreboot now\033[0m ? : ' -i "y" if_reboot_at_end
if [[ $if_reboot_at_end =~ ^([Yy])$ ]]
then
sudo reboot
exit
fi