Compare commits

16 Commits
main ... wip

Author SHA1 Message Date
dfbfdcd836 Update ReadMe.md
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-11-14 16:24:09 +00:00
197dc45f44 Add Scripts/Portainer-Agent.sh
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-11-14 16:21:29 +00:00
9822798064 Update Scripts/Portainer-Server.sh
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-11-14 16:18:17 +00:00
4e1231dd5f Update Tutorials/automount_drive_at_boot.md
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-11-14 16:17:08 +00:00
a9f4ba07f4 Update Scripts/USE-AIO.sh
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-11-14 15:31:40 +00:00
015ee3c6d7 Update Scripts/USE-AIO.sh
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-10-21 18:28:30 +00:00
ffe4791b5b Update Scripts/USE-AIO.sh
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-10-21 18:26:47 +00:00
ce94ce38c5 Update ReadMe.md
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-05-16 17:00:44 +00:00
0c7e4557a8 Update Tutorials/automount_drive_at_boot.md
Signed-off-by: DocRock3r <docrock3r@noreply.localhost>
2025-05-16 16:58:49 +00:00
6078f4cd8a Update Tutorials/automount_drive_at_boot 2025-05-16 13:09:43 +00:00
4b5de0d2cb Update Tutorials/Automount_drive_at_boot 2025-05-15 15:59:36 +00:00
9443f5845e Add Tutorials/Automount-drive-at-boot 2025-05-15 15:59:10 +00:00
c3a00ba0da Update ReadMe.md 2025-05-05 14:47:13 +00:00
36bf6fc096 Update ReadMe.md 2025-05-05 14:42:56 +00:00
2025c07deb Update Tutorials/expand_drive_space.md 2025-05-05 14:37:24 +00:00
cce353aed4 Add Tutorials/expand_drive_space.md 2025-05-05 14:35:14 +00:00
6 changed files with 142 additions and 11 deletions

View File

@@ -1,9 +1,14 @@
# Ubuntu Server Essentials
A collection of scripts intended to simplify setting up and maintianing an Ubuntu server
A collection of scripts and tutorials intended to simplify setting up and maintianing an Ubuntu server
## Scripts
[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
[Portainer Server](Scripts/Portainer-Server.sh) - Install Docker and Portainer Server
[Portainer Agent](Scripts/Portainer-Agent.sh) - Install Docker and Portianer Agent
[Update](Scripts/Update.sh) - Update and clean up unused packages
[Change Hostname](Scripts/change_hostname.sh) - Change the hostname for the system
[Change Hostname](Scripts/change_hostname.sh) - Change the hostname for the system
## Tutorials
[Expand Drive Space](Tutorials/expand_drive_space.md)
[Mount Drive At Boot](Tutorials/automount_drive_at_boot.md)

View File

@@ -0,0 +1,25 @@
#! /bin/bash
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 agent
echo "Installing Portainer agent..."
sudo docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes -v /:/host portainer/agent:lts 1>/dev/null
echo "Done" ;;

View File

@@ -4,11 +4,12 @@ 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 "3. Install Docker + Portianer Agent"
echo "4. Update System"
echo "5. Change Hostname"
echo "00. Exit"
echo ""
echo -n "enter your selection(1-4)(5 to exit): "
echo -n "enter your selection(1-5)(00 to exit): "
while :
do
@@ -60,7 +61,31 @@ case $choice in
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..."
3) 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 agent
echo "Installing Portainer agent..."
sudo docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes -v /:/host portainer/agent:lts 1>/dev/null
echo "Done" ;;
4) echo "Updating repository..."
sudo apt-get update 1>/dev/null
echo "Done"
echo "Installing updates..."
@@ -70,7 +95,7 @@ case $choice in
sudo apt-get autoremove -y 1>/dev/null
echo "Done" ;;
4) echo ""
5) echo ""
#get current hostname and set it as value of old_host
old_host=$(hostname)
@@ -95,7 +120,7 @@ case $choice in
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..."
00) echo "Exiting..."
exit ;;
*) echo "Invalid option" ;;
@@ -104,6 +129,6 @@ esac
echo ""
echo ""
echo -n "enter your selection(1-4)(5 to exit): "
echo -n "enter your selection(1-5)(00 to exit): "
done

View File

@@ -0,0 +1,34 @@
## 1. Find the location of the drive using `lsblk`
- ex. `/dev/sdb`
## 2. Make a new partition on the disk
1. `fdisk /dev/[location of hdd]`
- ex. `fdisk /dev/sdb`
2. `n` to make a new partiton
3. `w` to save changes
## 3. Confirm that the new partition was created
- `lsblk`
- ex. `/dev/sdb1`
## 4. Make a file system on the new partiton
- `mkfs -t ext4 /dev/[location of partition]`
- ex. `mkfs -t ext4 /dev/sdb1`
## 5. Make a directory to mount HDD to
- `sudo mkdir /mnt/hdd`
## 6. Get the UUID for the drive to be mounted
- `lsblk -fs`
## 7. Make a backup of /etc/fstab
- `sudo cp /etc/fstab /etc/fstab.bk`
- In case anything goes wrong you can restore this backup version
- `sudo cp /etc/fstab.bk /etc/fstab`
## 8. Add the new harddrive to /etc/fstab so that it is automatically mounted when the system boots
1. `sudo nano /etc/fstab`
2. add the line `UUID=[drive UUID] [mount location] ext4 defaults,auto,rw 0 0`
- ex. `UUID=4579acc6-e00d-433b-8087-0a75506e7a9c /mnt/hdd ext4 defaults,auto,rw 0 0`
## 9. Restart the system to confirm that drive mounts at boot

View File

@@ -0,0 +1,42 @@
# Add new partion and add partion to existing LVM
## 1. Add new partion using fdisk
- `sudo fdisk /dev/[drive containing partition you want to expand]`
- ex. if you want to expand partion sda3 you would use `sudo fdisk /dev/sda`
- use `p` to list partiton talble
use `F` to list free space on drive
use `n` to create a new partion
use `w` to save changes
## 2. Add new partion to existing LVM
- use `lsblk` to list all drives, partitions, and LVMs
### 2.1 Create a new physical volume (pv)
- `sudo pvcreate /dev/[partiton you want to use]`
- ex. `sudo pvcreate /dev/sda4`
### 2.2 Identify the volume group (vg) you want to use
- you can use `sudo vgs` to list all available volume groups
### 2.3 Extend volume group
- `sudo vgextend [volume group] /dev/[partition]`
- ex. `sudo vgextend ubuntu-vg /dev/sda4`
### 2.4 Identify the logical volume (lv) you want to use
- you can use `sudo lvs` to list all available logical volumes
### 2.5 Extend logical volume
- `sudo lvextend -l +100%FREE /dev/[volume group]/[logical volume]`
- ex. `sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv`
## 3. Resize filesystem so system sees changes
- `sudo resize2fs /dev/[volume group]/[logical volume]`
- ex. `sudo resize2fs/dev/ubuntu-vg/ubuntu-lv`
# Expand existing partion
1. `sudo growpart /dev/[disk] [partition number]`
- ex. `sudo growpart /dev/sda 3`
- ***note the space between disk and partion number***
2. `sudo resize2fs /dev/[partition]`
- ex. `sudo resize2fs /dev/sda3`
# Expand existing LVM to use whole partition
- `sudo lvextend -l +100%FREE /dev/[volume group]/[logical volume]`
- ex. `sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv`