From cce353aed43f48bb6e885aa5993bc2fc0aa96456 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Mon, 5 May 2025 14:35:14 +0000 Subject: [PATCH 01/16] Add Tutorials/expand_drive_space.md --- Tutorials/expand_drive_space.md | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Tutorials/expand_drive_space.md diff --git a/Tutorials/expand_drive_space.md b/Tutorials/expand_drive_space.md new file mode 100644 index 0000000..c1527c7 --- /dev/null +++ b/Tutorials/expand_drive_space.md @@ -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` \ No newline at end of file -- 2.49.1 From 2025c07debc745c8212940a0486aae893435298c Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Mon, 5 May 2025 14:37:24 +0000 Subject: [PATCH 02/16] Update Tutorials/expand_drive_space.md --- Tutorials/expand_drive_space.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tutorials/expand_drive_space.md b/Tutorials/expand_drive_space.md index c1527c7..ae7881d 100644 --- a/Tutorials/expand_drive_space.md +++ b/Tutorials/expand_drive_space.md @@ -7,17 +7,17 @@ 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) +## 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 +### 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 +### 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]` @@ -37,6 +37,6 @@ use `w` to save changes 2. `sudo resize2fs /dev/[partition]` - ex. `sudo resize2fs /dev/sda3` -# Expand existing lvm to use whole partition +# 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` \ No newline at end of file -- 2.49.1 From 36bf6fc096a020657cd8ca044655472500e48b84 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Mon, 5 May 2025 14:42:56 +0000 Subject: [PATCH 03/16] Update ReadMe.md --- ReadMe.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index cce72e4..843ecff 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -6,4 +6,7 @@ A collection of scripts intended to simplify setting up and maintianing an Ubunt [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 \ No newline at end of file +[Change Hostname](Scripts/change_hostname.sh) - Change the hostname for the system + +## Tutorials +[Expand Drive Space](Tutorials/expand_drive_space.md) \ No newline at end of file -- 2.49.1 From c3a00ba0da711e37749195868307bb2c4aeb57fe Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Mon, 5 May 2025 14:47:13 +0000 Subject: [PATCH 04/16] Update ReadMe.md --- ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 843ecff..64500fd 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,5 @@ # 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 -- 2.49.1 From 9443f5845ea7f93263bad82f9c3f3121c72e7786 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Thu, 15 May 2025 15:59:10 +0000 Subject: [PATCH 05/16] Add Tutorials/Automount-drive-at-boot --- Tutorials/Automount-drive-at-boot | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Tutorials/Automount-drive-at-boot diff --git a/Tutorials/Automount-drive-at-boot b/Tutorials/Automount-drive-at-boot new file mode 100644 index 0000000..e69de29 -- 2.49.1 From 4b5de0d2cb60aab7243f6b7b0406032d56d4c4be Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Thu, 15 May 2025 15:59:36 +0000 Subject: [PATCH 06/16] Update Tutorials/Automount_drive_at_boot --- Tutorials/{Automount-drive-at-boot => Automount_drive_at_boot} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Tutorials/{Automount-drive-at-boot => Automount_drive_at_boot} (100%) diff --git a/Tutorials/Automount-drive-at-boot b/Tutorials/Automount_drive_at_boot similarity index 100% rename from Tutorials/Automount-drive-at-boot rename to Tutorials/Automount_drive_at_boot -- 2.49.1 From 6078f4cd8a3d6eff542461d8545b5423fbcc6451 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 16 May 2025 13:09:43 +0000 Subject: [PATCH 07/16] Update Tutorials/automount_drive_at_boot --- Tutorials/{Automount_drive_at_boot => automount_drive_at_boot} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Tutorials/{Automount_drive_at_boot => automount_drive_at_boot} (100%) diff --git a/Tutorials/Automount_drive_at_boot b/Tutorials/automount_drive_at_boot similarity index 100% rename from Tutorials/Automount_drive_at_boot rename to Tutorials/automount_drive_at_boot -- 2.49.1 From 0c7e4557a82ed9e9a0cbfc2ebbf02b170192a006 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 16 May 2025 16:58:49 +0000 Subject: [PATCH 08/16] Update Tutorials/automount_drive_at_boot.md Signed-off-by: DocRock3r --- Tutorials/automount_drive_at_boot | 0 Tutorials/automount_drive_at_boot.md | 32 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) delete mode 100644 Tutorials/automount_drive_at_boot create mode 100644 Tutorials/automount_drive_at_boot.md diff --git a/Tutorials/automount_drive_at_boot b/Tutorials/automount_drive_at_boot deleted file mode 100644 index e69de29..0000000 diff --git a/Tutorials/automount_drive_at_boot.md b/Tutorials/automount_drive_at_boot.md new file mode 100644 index 0000000..2a3a06d --- /dev/null +++ b/Tutorials/automount_drive_at_boot.md @@ -0,0 +1,32 @@ +## find the location of the drive using `lsblk` +- ex. `/dev/sdb` + +## make a new partition on the disk +- `fdisk /dev/[location of hdd]` + - ex. `fdisk /dev/sdb` +- `n` to make a new partiton +`w` to save changes + +## confirm that new partition was created +- `lsblk` + - ex. `/dev/sdb1` + +## make a file system on the partiton +- `mkfs -t ext4 /dev/[location of partition]` + - ex. `mkfs -t ext4 /dev/sdb1` + +## make directory to mount HDD + - `sudo mkdir /mnt/hdd` + +## get uuid for drive to be mounted +- `lsblk -fs` + +## make a backup of /etc/fstab +- `sudo cp /etc/fstab /etc/fstab.bk` + +## add new harddrive to /etc/fstab +- `sudo nano /etc/fstab` +- 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` + +## restart system to confirm that drive mounts at boot -- 2.49.1 From ce94ce38c51dffd970745ed02084ece67c0ea6fa Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 16 May 2025 17:00:44 +0000 Subject: [PATCH 09/16] Update ReadMe.md Signed-off-by: DocRock3r --- ReadMe.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 64500fd..65e7058 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -9,4 +9,5 @@ A collection of scripts and tutorials intended to simplify setting up and mainti [Change Hostname](Scripts/change_hostname.sh) - Change the hostname for the system ## Tutorials -[Expand Drive Space](Tutorials/expand_drive_space.md) \ No newline at end of file +[Expand Drive Space](Tutorials/expand_drive_space.md) +[Mount Drive At Boot](Tutorials/automount_drive_at_boot.md) \ No newline at end of file -- 2.49.1 From ffe4791b5b3593744acc0beb54f182de0ed55613 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Tue, 21 Oct 2025 18:26:47 +0000 Subject: [PATCH 10/16] Update Scripts/USE-AIO.sh Signed-off-by: DocRock3r --- Scripts/USE-AIO.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Scripts/USE-AIO.sh b/Scripts/USE-AIO.sh index ad68219..d8228d4 100644 --- a/Scripts/USE-AIO.sh +++ b/Scripts/USE-AIO.sh @@ -60,7 +60,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:2.21.5 1>/dev/null + echo "Done" ;; + +4) echo "Updating repository..." sudo apt-get update 1>/dev/null echo "Done" echo "Installing updates..." @@ -70,7 +94,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 +119,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" ;; -- 2.49.1 From 015ee3c6d7e5a96c1b80c11e2008fafe233d5336 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Tue, 21 Oct 2025 18:28:30 +0000 Subject: [PATCH 11/16] Update Scripts/USE-AIO.sh Signed-off-by: DocRock3r --- Scripts/USE-AIO.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Scripts/USE-AIO.sh b/Scripts/USE-AIO.sh index d8228d4..c445dca 100644 --- a/Scripts/USE-AIO.sh +++ b/Scripts/USE-AIO.sh @@ -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 @@ -128,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 \ No newline at end of file -- 2.49.1 From a9f4ba07f419035a9f5bff754c46f61578a73ed5 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 14 Nov 2025 15:31:40 +0000 Subject: [PATCH 12/16] Update Scripts/USE-AIO.sh Signed-off-by: DocRock3r --- Scripts/USE-AIO.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/USE-AIO.sh b/Scripts/USE-AIO.sh index c445dca..6b49b46 100644 --- a/Scripts/USE-AIO.sh +++ b/Scripts/USE-AIO.sh @@ -82,7 +82,7 @@ case $choice in #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:2.21.5 1>/dev/null + 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..." -- 2.49.1 From 4e1231dd5fe548407b51187903dd2816fd5c5463 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 14 Nov 2025 16:17:08 +0000 Subject: [PATCH 13/16] Update Tutorials/automount_drive_at_boot.md Signed-off-by: DocRock3r --- Tutorials/automount_drive_at_boot.md | 30 +++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Tutorials/automount_drive_at_boot.md b/Tutorials/automount_drive_at_boot.md index 2a3a06d..2164396 100644 --- a/Tutorials/automount_drive_at_boot.md +++ b/Tutorials/automount_drive_at_boot.md @@ -1,32 +1,34 @@ -## find the location of the drive using `lsblk` +## 1. Find the location of the drive using `lsblk` - ex. `/dev/sdb` -## make a new partition on the disk -- `fdisk /dev/[location of hdd]` +## 2. Make a new partition on the disk +1. `fdisk /dev/[location of hdd]` - ex. `fdisk /dev/sdb` -- `n` to make a new partiton -`w` to save changes +2. `n` to make a new partiton +3. `w` to save changes -## confirm that new partition was created +## 3. Confirm that the new partition was created - `lsblk` - ex. `/dev/sdb1` -## make a file system on the partiton +## 4. Make a file system on the new partiton - `mkfs -t ext4 /dev/[location of partition]` - ex. `mkfs -t ext4 /dev/sdb1` -## make directory to mount HDD +## 5. Make a directory to mount HDD to - `sudo mkdir /mnt/hdd` -## get uuid for drive to be mounted +## 6. Get the UUID for the drive to be mounted - `lsblk -fs` -## make a backup of /etc/fstab +## 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` -## add new harddrive to /etc/fstab -- `sudo nano /etc/fstab` -- add the line `UUID=[drive UUID] [mount location] ext4 defaults,auto,rw 0 0` +## 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` -## restart system to confirm that drive mounts at boot +## 9. Restart the system to confirm that drive mounts at boot -- 2.49.1 From 9822798064a224281270aba6377fd248a3fb25ff Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 14 Nov 2025 16:18:17 +0000 Subject: [PATCH 14/16] Update Scripts/Portainer-Server.sh Signed-off-by: DocRock3r --- Scripts/{Portainer.sh => Portainer-Server.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Scripts/{Portainer.sh => Portainer-Server.sh} (100%) diff --git a/Scripts/Portainer.sh b/Scripts/Portainer-Server.sh similarity index 100% rename from Scripts/Portainer.sh rename to Scripts/Portainer-Server.sh -- 2.49.1 From 197dc45f44457956665bde54d477ee4863909a24 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 14 Nov 2025 16:21:29 +0000 Subject: [PATCH 15/16] Add Scripts/Portainer-Agent.sh Signed-off-by: DocRock3r --- Scripts/Portainer-Agent.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Scripts/Portainer-Agent.sh diff --git a/Scripts/Portainer-Agent.sh b/Scripts/Portainer-Agent.sh new file mode 100644 index 0000000..78db965 --- /dev/null +++ b/Scripts/Portainer-Agent.sh @@ -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" ;; \ No newline at end of file -- 2.49.1 From dfbfdcd836e574eb1fef70667fdf81f8b70bf4d8 Mon Sep 17 00:00:00 2001 From: DocRock3r Date: Fri, 14 Nov 2025 16:24:09 +0000 Subject: [PATCH 16/16] Update ReadMe.md Signed-off-by: DocRock3r --- ReadMe.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 65e7058..5e80380 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -4,7 +4,8 @@ A collection of scripts and tutorials intended to simplify setting up and mainti ## 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 -- 2.49.1