Compare commits
19 Commits
3a7799f500
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 92e40b866a | |||
| f3dffb2a74 | |||
| ff8001d297 | |||
| 86faa63db1 | |||
| 038edc961d | |||
| 898af8e1dd | |||
| 7b7169b3a4 | |||
| 76c4d978b4 | |||
| 5a058a6e98 | |||
| 689d99328f | |||
| 5fea4d231a | |||
| 934172ccfe | |||
| 4675c3e098 | |||
| 69f8c4b887 | |||
| 605dc40d51 | |||
| d05f65cef7 | |||
| 82c3d70358 | |||
| b9ecec7c01 | |||
| ce5ab736fe |
@@ -2,5 +2,8 @@
|
||||
A collection of scripts intended to simplify setting up and maintianing an Ubuntu server
|
||||
|
||||
## Scripts
|
||||
[Docker](Docker.sh) - Install Docker
|
||||
[Portainer](Portainer.sh) - Install Docker and Portainer Server
|
||||
[All In One](Scripts/USE-AIO.sh) - All USE scripts combined together with a menu for selecting which one to run
|
||||
[Docker](Scripts/Docker.sh) - Install Docker
|
||||
[Portainer](Scripts/Portainer.sh) - Install Docker and Portainer Server
|
||||
[Update](Scripts/Update.sh) - Update and clean up unused packages
|
||||
[Change Hostname](Scripts/change_hostname.sh) - Change the hostname for the system
|
||||
109
Scripts/USE-AIO.sh
Normal file
109
Scripts/USE-AIO.sh
Normal file
@@ -0,0 +1,109 @@
|
||||
#! /bin/bash
|
||||
|
||||
clear
|
||||
echo "What do you want to do?"
|
||||
echo "1. Install Docker"
|
||||
echo "2. Install Docker + Portainer Server"
|
||||
echo "3. Update System"
|
||||
echo "4. Change Hostname"
|
||||
echo "5. Exit"
|
||||
echo ""
|
||||
echo -n "enter your selection(1-4)(5 to exit): "
|
||||
|
||||
while :
|
||||
do
|
||||
|
||||
read choice
|
||||
|
||||
case $choice in
|
||||
1) echo "Installing Docker..."
|
||||
# Add Docker's official GPG key:
|
||||
sudo apt-get update 1>/dev/null
|
||||
sudo apt-get install ca-certificates curl -y 1>/dev/null
|
||||
sudo install -m 0755 -d /etc/apt/keyrings 1>/dev/null
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc 1>/dev/null
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc 1>/dev/null
|
||||
|
||||
# Add the repository to Apt sources:
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt-get update 1>/dev/null
|
||||
|
||||
# Install Docker
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y 1>/dev/null
|
||||
echo "Done";;
|
||||
|
||||
2) echo "Installing Docker..."
|
||||
# Add Docker's official GPG key:
|
||||
sudo apt-get update 1>/dev/null
|
||||
sudo apt-get install ca-certificates curl -y 1>/dev/null
|
||||
sudo install -m 0755 -d /etc/apt/keyrings 1>/dev/null
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc 1>/dev/null
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc 1>/dev/null
|
||||
|
||||
# Add the repository to Apt sources:
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt-get update 1>/dev/null
|
||||
|
||||
# Install Docker
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y 1>/dev/null
|
||||
echo "Done"
|
||||
|
||||
#install Portianer server
|
||||
echo "Installing Portainer..."
|
||||
sudo docker volume create portainer_data 1>/dev/null
|
||||
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:lts 1>/dev/null
|
||||
echo "Done" ;;
|
||||
|
||||
3) echo "Updating repository..."
|
||||
sudo apt-get update 1>/dev/null
|
||||
echo "Done"
|
||||
echo "Installing updates..."
|
||||
sudo apt-get upgrade -y 1>/dev/null
|
||||
echo "Done"
|
||||
echo "Cleaning up unused packages..."
|
||||
sudo apt-get autoremove -y 1>/dev/null
|
||||
echo "Done" ;;
|
||||
|
||||
4) echo ""
|
||||
|
||||
#get current hostname and set it as value of old_host
|
||||
old_host=$(hostname)
|
||||
|
||||
#make backups for hostname and hosts files
|
||||
cp /etc/hostname /etc/hostname.bk
|
||||
cp /etc/hosts /etc/hosts.bk
|
||||
|
||||
#ask user for new host name and set it as value for new_host
|
||||
printf "%s\n" "Hostname must be between 1-63 characters long"
|
||||
printf "%s\n" "Valid characters are (lower case a-z), (0-9), and (-)"
|
||||
printf "%s" "enter new hostname: "
|
||||
read new_host
|
||||
|
||||
#replace old_host with new_host in hostname and hosts files
|
||||
#set hostname to new_host
|
||||
sed -i 's/'$old_host'/'$new_host'/' /etc/hostname
|
||||
sed -i 's/'$old_host'/'$new_host'/' /etc/hosts
|
||||
hostname $new_host
|
||||
|
||||
#confirm change and tell user to restart system
|
||||
printf "%s\n" "Hostname changed from [$old_host] to [$new_host]"
|
||||
printf "%s\n" "Reboot your system for the change to take effect" ;;
|
||||
|
||||
5) echo "Exiting..."
|
||||
exit ;;
|
||||
|
||||
*) echo "Invalid option" ;;
|
||||
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo -n "enter your selection(1-4)(5 to exit): "
|
||||
|
||||
done
|
||||
6
Scripts/Update.sh
Normal file
6
Scripts/Update.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#! /bin/bash
|
||||
|
||||
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
sudo apt autoremove -y
|
||||
26
Scripts/change_hostname.sh
Normal file
26
Scripts/change_hostname.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#! /bin/bash
|
||||
|
||||
clear
|
||||
|
||||
#get current hostname and set it as value of old_host
|
||||
old_host=$(hostname)
|
||||
|
||||
#make backups for hostname and hosts files
|
||||
cp /etc/hostname /etc/hostname.bk
|
||||
cp /etc/hosts /etc/hosts.bk
|
||||
|
||||
#ask user for new host name and set it as value for new_host
|
||||
printf "%s\n" "Hostname must be between 1-63 characters long"
|
||||
printf "%s\n" "Valid characters are (lower case a-z), (0-9), and (-)"
|
||||
printf "%s" "enter new hostname: "
|
||||
read new_host
|
||||
|
||||
#replace old_host with new_host in hostname and hosts files
|
||||
#set hostname to new_host
|
||||
sed -i 's/'$old_host'/'$new_host'/' /etc/hostname
|
||||
sed -i 's/'$old_host'/'$new_host'/' /etc/hosts
|
||||
hostname $new_host
|
||||
|
||||
#confirm change and tell user to restart system
|
||||
printf "%s\n" "Hostname changed from [$old_host] to [$new_host]"
|
||||
printf "%s\n" "Reboot your system for the change to take effect"
|
||||
Reference in New Issue
Block a user