ubuntu tools misc

This commit is contained in:
2025-03-19 19:08:19 +08:00
parent b70b89433b
commit 021db1064e
5 changed files with 8 additions and 31 deletions

39
tools/ubuntu/desktop-upgrade.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# https://dev.to/chefgs/upgrading-an-end-of-life-eol-ubuntu-os-to-lts-version-3a36
# https://changelogs.ubuntu.com/meta-release
# shellcheck disable=SC1091
source /etc/os-release
echo "Loading..."
mapfile -t codenames < <(curl -s https://changelogs.ubuntu.com/meta-release | grep -oP '(?<=Dist:\s).*')
thisCodename="$VERSION_CODENAME"
for idx in "${!codenames[@]}"; do
if [ "${codenames[idx]}" = "$thisCodename" ]; then
nextCodename=${codenames[((idx+1))]}
fi
done
targetDownloadPath="$(pwd)/upgrade-$nextCodename"
targetToolPath="$targetDownloadPath/unpacked"
targetToolFile="$targetDownloadPath/$nextCodename.tar.gz"
echo "Current dist: $thisCodename"
echo "Next dist: $nextCodename"
echo "Target path: $targetToolFile"
rm -rf "$targetToolPath"
mkdir -p "$targetToolPath"
echo "Downloading..."
cd "$targetDownloadPath" || exit 1
wget "http://archive.ubuntu.com/ubuntu/dists/${nextCodename}-updates/main/dist-upgrader-all/current/${nextCodename}.tar.gz"
echo "Unpacking..."
tar -xaf "$targetToolFile" -C "$targetToolPath"
echo "Starting..."
cd ./unpacked || exit 1
# shellcheck disable=SC2086
sudo ./$nextCodename

33
tools/ubuntu/lemp.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
apt update && apt upgrade -y --autoremove
apt install -y \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
dialog \
gettext \
gnupg \
htop \
libaio1 \
libcurl4-gnutls-dev \
libexpat1-dev \
libghc-zlib-dev \
libssl-dev \
make \
mc \
nano \
net-tools \
nmap \
p7zip-full \
software-properties-common \
unzip \
inotify-tools \
git \
mariadb-server \
mariadb-client \
nginx \
certbot \
python3-certbot-nginx

114
tools/ubuntu/mediasrv.sh Normal file
View File

@@ -0,0 +1,114 @@
#!/usr/bin/env bash
sudo apt update && sudo apt upgrade -y --autoremove
sudo apt install -y \
alien \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
dconf-editor \
default-jdk \
dialog \
gettext \
gnupg \
gparted \
hardinfo \
htop \
libaio1 \
libcurl4-gnutls-dev \
libexpat1-dev \
libghc-zlib-dev \
libssl-dev \
lsb-release \
lsp-plugins \
make \
mc \
nano \
neofetch \
net-tools \
nmap \
p7zip-full \
easyeffects \
software-properties-common \
ubuntu-restricted-extras \
unzip \
vlc \
ffmpeg \
xclip \
inotify-tools \
notify-osd \
fonts-open-sans \
libnotify-bin \
samba \
dkms
# https://selectel.ru/blog/tutorials/how-to-install-and-configure-samba-on-ubuntu-20-04/
# https://linuxconfig.org/how-to-configure-samba-server-share-on-ubuntu-22-04-jammy-jellyfish-linux
# https://phoenixnap.com/kb/ubuntu-samba
# https://computingforgeeks.com/install-and-configure-samba-server-share-on-ubuntu/
# https://linux.how2shout.com/how-to-install-samba-on-ubuntu-22-04-lts-jammy-linux/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo bash -c 'grep -v -E "^#|^;" /etc/samba/smb.conf.bak | grep . > /etc/samba/smb.conf'
sudo systemctl enable --now smbd
sudo usermod -aG sambashare $USER
sudo smbpasswd -a $USER
sudo add-apt-repository -y ppa:agornostal/ulauncher && \
sudo apt install -y --autoremove ulauncher
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o "${HOME}/.local/bin/youtube-dl" && \
sudo chmod +rx "${HOME}/.local/bin/youtube-dl"
wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \
sudo dpkg -i google-chrome-stable_current_amd64.deb
git clone https://github.com/aircrack-ng/rtl8812au.git && \
cd rtl8812au && \
sudo make dkms_install
sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg && \
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list && \
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list && \
sudo apt update && sudo apt install -y --autoremove syncthing && \
wget "https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-desktop/syncthing-start.desktop" -O $HOME/.local/share/applications/syncthing-start.desktop && \
wget "https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-desktop/syncthing-ui.desktop" -O $HOME/.local/share/applications/syncthing-ui.desktop && \
ln -sf $HOME/.local/share/applications/syncthing-start.desktop $HOME/.config/autostart/syncthing-start.desktop
#####################################################################
sudo apt install -y kodi kodi-pvr-iptvsimple

51
tools/ubuntu/server.sh Normal file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
sudo apt install -y ca-certificates curl && \
sudo install -m 0755 -d /etc/apt/keyrings && \
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
sudo chmod a+r /etc/apt/keyrings/docker.asc && \
source /etc/os-release && \
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 update && \
sudo apt upgrade -y --autoremove && \
sudo apt install -y \
apt-transport-https \
build-essential \
ca-certificates \
git \
cmake \
curl \
dialog \
gettext \
gnupg \
htop \
libcurl4-gnutls-dev \
libexpat1-dev \
libghc-zlib-dev \
libssl-dev \
lsb-release \
make \
mc \
meld \
nano \
neofetch \
net-tools \
nmap \
p7zip-full \
unzip \
ffmpeg \
inotify-tools \
notify-osd \
fonts-open-sans \
libnotify-bin \
tree \
nginx \
certbot \
python3-certbot-nginx \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin