initial commit

This commit is contained in:
2026-03-18 03:29:25 +08:00
commit 146c2c5f35
37 changed files with 1445 additions and 0 deletions

119
scripts/docker/install.sh Normal file
View File

@@ -0,0 +1,119 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Docker Installation"
echo "================================="
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Detect OS
if [[ -f /etc/os-release ]]; then
. /etc/os-release
else
echo "Cannot detect operating system."
exit 1
fi
echo "Detected OS: $ID"
echo "Running Docker installer for this distro..."
case "$ID" in
ubuntu)
bash "$BASE_DIR/os/ubuntu.sh"
;;
debian)
bash "$BASE_DIR/os/debian.sh"
;;
fedora|centos|rocky|almalinux|rhel)
bash "$BASE_DIR/os/rhel.sh"
;;
arch|manjaro)
bash "$BASE_DIR/os/arch.sh"
;;
alpine)
bash "$BASE_DIR/os/alpine.sh"
;;
opensuse*|suse|opensuse-leap|opensuse-tumbleweed)
bash "$BASE_DIR/os/opensuse.sh"
;;
*)
echo "Unsupported distribution: $ID"
exit 1
;;
esac
echo "Docker installation completed successfully."
echo "================================="
echo " Mirror Configuration"
echo "================================="
read -rp "Configure Docker mirror? (y/n): " DOCKER_MIRROR
if [[ "$DOCKER_MIRROR" == "y" ]]; then
echo "Select Docker mirror provider:"
echo "1) Liara"
echo "2) ArvanCloud"
echo "3) Runflare"
read -rp "Choice [1-3]: " DM
case "$DM" in
1)
echo "Applying Liara Docker mirror..."
bash "$BASE_DIR/mirrors/liara.sh"
;;
2)
echo "Applying ArvanCloud Docker mirror..."
bash "$BASE_DIR/mirrors/arvancloud.sh"
;;
3)
echo "Applying Runflare Docker mirror..."
bash "$BASE_DIR/mirrors/runflare.sh"
;;
*)
echo "Invalid choice. Skipping mirror configuration."
;;
esac
else
echo "Skipping Docker mirror configuration."
fi
echo "================================="
echo "Starting Docker service..."
systemctl enable docker
systemctl restart docker
if [[ -n "$SUDO_USER" ]]; then
echo "Adding $SUDO_USER to docker group..."
usermod -aG docker "$SUDO_USER" 2>/dev/null || true
fi
echo "================================="
echo "Verifying Docker installation..."
docker --version
if systemctl is-active --quiet docker; then
echo "Docker service is running."
else
echo "Docker service is NOT running."
fi
echo "================================="
echo "Docker setup finished successfully"
echo "================================="

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
echo "============================================"
echo "=== Configuring ArvanCloud Docker mirror ==="
echo "============================================"
mkdir -p /etc/docker
if [[ -f /etc/docker/daemon.json ]]; then
cp /etc/docker/daemon.json /etc/docker/daemon.json.bak
echo "Backup created: /etc/docker/daemon.json.bak"
fi
cat > /etc/docker/daemon.json <<EOF
{
"insecure-registries": ["https://docker.arvancloud.ir"],
"registry-mirrors": ["https://docker.arvancloud.ir"]
}
EOF
echo "Docker mirror configured."
docker logout || true
systemctl daemon-reexec || true
systemctl restart docker
echo "ArvanCloud Docker mirror applied."

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
echo "======================================="
echo "=== Configuring Liara Docker mirror ==="
echo "======================================="
mkdir -p /etc/docker
if [[ -f /etc/docker/daemon.json ]]; then
cp /etc/docker/daemon.json /etc/docker/daemon.json.bak
echo "Backup created: /etc/docker/daemon.json.bak"
fi
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://docker-mirror.liara.ir"
]
}
EOF
systemctl daemon-reload
systemctl restart docker
echo "Liara Docker mirror applied."

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
echo "=========================================="
echo "=== Configuring Runflare Docker mirror ==="
echo "=========================================="
mkdir -p /etc/docker
if [[ -f /etc/docker/daemon.json ]]; then
cp /etc/docker/daemon.json /etc/docker/daemon.json.bak
echo "Backup created: /etc/docker/daemon.json.bak"
fi
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://mirror-docker.runflare.com"
]
}
EOF
systemctl daemon-reload
systemctl restart docker
echo "Runflare Docker mirror applied."

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
echo "Installing Docker for Alpine..."
apk update
apk add \
docker \
docker-cli-compose

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
echo "Installing Docker for Arch-based systems..."
pacman -Sy --noconfirm docker docker-compose

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
echo "Installing Docker for Debian..."
apt-get update -y
apt-get install -y ca-certificates curl gnupg lsb-release
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://archive.ito.gov.ir/docker-ce/linux/debian/gpg \
-o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://archive.ito.gov.ir/docker-ce/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
echo "Installing Docker for OpenSUSE..."
zypper refresh
zypper install -y \
docker \
docker-compose

16
scripts/docker/os/rhel.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
echo "Installing Docker for RHEL-based systems..."
dnf install -y dnf-plugins-core
dnf config-manager --add-repo \
https://archive.ito.gov.ir/docker-ce/linux/centos/docker-ce.repo
dnf install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
echo "Installing Docker for Ubuntu..."
apt-get update -y
apt-get install -y ca-certificates curl gnupg lsb-release
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://archive.ito.gov.ir/docker-ce/linux/ubuntu/gpg \
-o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://archive.ito.gov.ir/docker-ce/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin

130
scripts/installer.sh Normal file
View File

@@ -0,0 +1,130 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " System Installer"
echo "================================="
OS="unknown"
if [[ -f /etc/os-release ]]; then
source /etc/os-release
OS="$ID"
elif [[ -f /etc/debian_version ]]; then
OS="debian"
elif [[ -f /etc/redhat-release ]]; then
OS="rhel"
fi
echo "Detected OS: $OS"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MIRROR_DIR="$BASE_DIR/mirrors/os"
# Normalize distro name to match mirror scripts
case "$OS" in
ubuntu) DISTRO="ubuntu" ;;
debian) DISTRO="debian" ;;
alpine) DISTRO="alpine" ;;
arch) DISTRO="archlinux" ;;
manjaro) DISTRO="manjaro" ;;
fedora) DISTRO="fedora" ;;
rocky) DISTRO="rocky" ;;
centos) DISTRO="centos" ;;
opensuse*|opensuse-leap|opensuse-tumbleweed) DISTRO="opensuse" ;;
kali) DISTRO="kali" ;;
almalinux) DISTRO="almalinux" ;;
*) DISTRO="$OS" ;;
esac
read -rp "Set custom DNS servers? (y/n): " SET_DNS
if [[ "$SET_DNS" == "y" ]]; then
read -rp "Enter DNS server (example 1.1.1.1): " DNS
if systemctl is-active --quiet systemd-resolved 2>/dev/null; then
echo "Configuring DNS via systemd-resolved..."
if grep -q "^DNS=" /etc/systemd/resolved.conf; then
sed -i "s/^DNS=.*/DNS=$DNS/" /etc/systemd/resolved.conf
else
sed -i "/^\[Resolve\]/a DNS=$DNS" /etc/systemd/resolved.conf
fi
systemctl restart systemd-resolved
else
echo "Configuring DNS via /etc/resolv.conf..."
echo "nameserver $DNS" > /etc/resolv.conf
fi
fi
# Mirror configuration
read -rp "Configure package mirror? (y/n): " MIRROR_SETUP
if [[ "$MIRROR_SETUP" == "y" ]]; then
echo "Select mirror provider:"
echo "1) Liara"
echo "2) ArvanCloud"
echo "3) Runflare"
read -rp "Choice [1-3]: " PROVIDER
case "$PROVIDER" in
1) MIRROR_PROVIDER="liara" ;;
2) MIRROR_PROVIDER="arvancloud" ;;
3) MIRROR_PROVIDER="runflare" ;;
*) echo "Invalid mirror provider"; exit 1 ;;
esac
MIRROR_SCRIPT="$MIRROR_DIR/$MIRROR_PROVIDER/$DISTRO.sh"
if [[ -f "$MIRROR_SCRIPT" ]]; then
echo "Applying $MIRROR_PROVIDER mirror for $DISTRO..."
bash "$MIRROR_SCRIPT"
else
echo "No mirror script found for $DISTRO with provider $MIRROR_PROVIDER"
fi
fi
if [[ "$OS" == "debian" || "$OS" == "ubuntu" ]]; then
echo "Updating package lists..."
apt update
echo "Installing development packages..."
apt install -y \
git \
curl \
wget \
vim \
htop \
build-essential \
ca-certificates \
gnupg \
lsb-release \
software-properties-common
read -rp "Enable automatic security updates? (y/n): " AUTOUP
if [[ "$AUTOUP" == "y" ]]; then
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
fi
fi
read -rp "Install Docker using docker/install.sh? (y/n): " INSTALL_DOCKER
if [[ "$INSTALL_DOCKER" == "y" ]]; then
if [[ -f "$BASE_DIR/docker/install.sh" ]]; then
bash "$BASE_DIR/docker/install.sh"
else
echo "$BASE_DIR/docker/install.sh not found"
fi
fi
echo "Installer complete"

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud Alpine Mirror Setup"
echo "================================="
if [[ ! -f /etc/alpine-release ]]; then
echo "This script only supports Alpine."
exit 1
fi
echo "[1/3] Backing up repositories..."
cp /etc/apk/repositories /etc/apk/repositories.bak
ALPINE_VERSION=$(cut -d'.' -f1,2 /etc/alpine-release)
echo "[2/3] Writing mirror..."
cat > /etc/apk/repositories <<EOF
https://mirror.arvancloud.ir/alpine/v${ALPINE_VERSION}/main
https://mirror.arvancloud.ir/alpine/v${ALPINE_VERSION}/community
EOF
echo "[3/3] Updating package index..."
apk update
echo "Alpine mirror configured."

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud Arch Mirror Setup"
echo "================================="
if [[ ! -f /etc/arch-release ]]; then
echo "This script only supports Arch."
exit 1
fi
echo "[1/3] Backing up mirrorlist..."
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
echo "[2/3] Commenting existing mirrors..."
sed -i 's/^Server/#Server/g' /etc/pacman.d/mirrorlist
echo "[3/3] Adding ArvanCloud mirror..."
echo "Server = https://mirror.arvancloud.ir/archlinux/\$repo/os/\$arch" \
>> /etc/pacman.d/mirrorlist
pacman -Syyu
echo "Arch mirror configured."

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud CentOS Mirror Setup"
echo "================================="
source /etc/os-release
echo "[1/3] Updating repo files..."
for f in /etc/yum.repos.d/*.repo; do
sed -i 's/^mirrorlist/#mirrorlist/g' "$f"
sed -i 's/^#baseurl/baseurl/g' "$f"
done
if [[ "$VERSION_ID" == "7" ]]; then
echo "[2/3] Setting ArvanCloud mirror for CentOS 7..."
sed -i 's|^baseurl=.*|baseurl=http://mirror.arvancloud.ir/centos/\$releasever/os/\$basearch/|' /etc/yum.repos.d/*.repo
elif [[ "$VERSION_ID" == "8" ]]; then
echo "[2/3] Setting ArvanCloud mirror for CentOS 8..."
sed -i 's|^baseurl=.*|baseurl=http://mirror.arvancloud.ir/\$contentdir/\$releasever/BaseOS/\$basearch/os/|' /etc/yum.repos.d/*.repo
echo "[3/3] Fixing releasever..."
echo "8-stream" > /etc/yum/vars/releasever
dnf update --allowerasing
fi
echo "CentOS mirror configured."

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud Debian Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "debian" ]]; then
echo "This script only supports Debian."
exit 1
fi
CODENAME="$VERSION_CODENAME"
echo "[1/3] Backing up sources.list..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "[2/3] Writing ArvanCloud mirror..."
cat > /etc/apt/sources.list <<EOF
deb http://mirror.arvancloud.ir/debian ${CODENAME} main
deb http://mirror.arvancloud.ir/debian-security ${CODENAME}-security main
EOF
echo "[3/3] Updating package index..."
apt update
echo "Debian mirror configured."

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud Manjaro Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "manjaro" ]]; then
echo "This script only supports Manjaro."
exit 1
fi
echo "[1/3] Backing up mirrorlist..."
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
echo "[2/3] Commenting existing mirrors..."
sed -i 's/^Server/#Server/g' /etc/pacman.d/mirrorlist
echo "[3/3] Adding ArvanCloud mirror..."
echo "Server = https://mirror.arvancloud.ir/manjaro/stable/\$repo/\$arch" \
>> /etc/pacman.d/mirrorlist
pacman -Syyu
echo "Manjaro mirror configured."

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud OpenSUSE Mirror Setup"
echo "================================="
if ! command -v zypper &> /dev/null; then
echo "This script only supports OpenSUSE."
exit 1
fi
source /etc/os-release
VERSION="$VERSION_ID"
echo "[1/2] Adding ArvanCloud repositories..."
for i in \
"http://mirror.arvancloud.ir/opensuse/debug/distribution/leap/${VERSION}/repo/oss/ Arvancloud-Debug" \
"http://mirror.arvancloud.ir/opensuse/distribution/leap/${VERSION}/repo/non-oss/ Arvancloud-Non-Oss" \
"http://mirror.arvancloud.ir/opensuse/distribution/leap/${VERSION}/repo/oss/ Arvancloud-Oss" \
"http://mirror.arvancloud.ir/opensuse/source/distribution/leap/${VERSION}/repo/oss/ Arvancloud-Source" \
"http://mirror.arvancloud.ir/opensuse/update/leap/${VERSION}/oss Arvancloud-Update"
do
zypper addrepo --priority 1 -f $i
done
echo "[2/2] Refreshing repositories..."
zypper refresh
echo "OpenSUSE mirror configured."

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " ArvanCloud Ubuntu Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "ubuntu" ]]; then
echo "This script only supports Ubuntu."
exit 1
fi
CODENAME="$VERSION_CODENAME"
echo "[1/3] Backing up sources.list..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "[2/3] Writing ArvanCloud mirror..."
cat > /etc/apt/sources.list <<EOF
deb http://mirror.arvancloud.ir/ubuntu ${CODENAME} universe
EOF
echo "[3/3] Updating package index..."
apt update
echo "Ubuntu mirror configured."

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Alpine Mirror Setup"
echo "================================="
if [[ ! -f /etc/alpine-release ]]; then
echo "This script only supports Alpine Linux."
exit 1
fi
echo
echo "[1/3] Backing up repositories..."
cp /etc/apk/repositories /etc/apk/repositories.bak
echo
echo "[2/3] Detecting Alpine version..."
ALPINE_VERSION=$(cut -d'.' -f1,2 /etc/alpine-release)
echo "Detected Alpine version: $ALPINE_VERSION"
echo
echo "[3/3] Writing Liara mirror..."
cat > /etc/apk/repositories <<EOF
https://linux-mirror.liara.ir/repository/alpine/v${ALPINE_VERSION}/main
https://linux-mirror.liara.ir/repository/alpine/v${ALPINE_VERSION}/community
EOF
echo
echo "Updating package index..."
apk update
echo
echo "Alpine mirror configured successfully."

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Arch Mirror Setup"
echo "================================="
if [[ ! -f /etc/arch-release ]]; then
echo "This script only supports Arch Linux."
exit 1
fi
echo
echo "[1/3] Backing up mirrorlist..."
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
echo
echo "[2/3] Writing Liara mirror..."
echo "Server = https://linux-mirror.liara.ir/repository/arch/\$repo/os/\$arch" \
> /etc/pacman.d/mirrorlist
echo
echo "[3/3] Refreshing package databases..."
pacman -Syy
echo
echo "Arch mirror configured successfully."

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara CentOS Mirror Setup"
echo "================================="
echo "[1/4] Creating backup directory..."
mkdir -p /etc/yum.repos.d/backup
echo "[2/4] Backing up existing repo files..."
for f in /etc/yum.repos.d/*.repo; do
cp "$f" /etc/yum.repos.d/backup/
done
echo "[3/4] Disabling existing repositories..."
for f in /etc/yum.repos.d/*.repo; do
sed -i "s/enabled=1/enabled=0/g" "$f"
done
echo "[4/4] Creating Liara mirror repository configuration..."
cat > /etc/yum.repos.d/liara-mirror.repo <<'EOF'
[liara-baseos]
name=Liara CentOS BaseOS
baseurl=https://linux-mirror.liara.ir/repository/centos/$releasever/BaseOS/$basearch/os/
enabled=1
gpgcheck=0
[liara-appstream]
name=Liara CentOS AppStream
baseurl=https://linux-mirror.liara.ir/repository/centos/$releasever/AppStream/$basearch/os/
enabled=1
gpgcheck=0
[liara-extras]
name=Liara CentOS Extras
baseurl=https://linux-mirror.liara.ir/repository/centos/$releasever

View File

@@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Debian Mirror Setup"
echo "================================="
# Check OS
if [[ ! -f /etc/os-release ]]; then
echo "Cannot detect OS. /etc/os-release not found."
exit 1
fi
source /etc/os-release
if [[ "$ID" != "debian" ]]; then
echo "This script is only for Debian."
echo "Detected OS: $ID"
exit 1
fi
CODENAME="$VERSION_CODENAME"
if [[ -z "$CODENAME" ]]; then
echo "Could not detect Debian codename."
exit 1
fi
echo "Detected Debian codename: $CODENAME"
echo
echo "[1/4] Backing up current APT sources..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo
echo "[2/4] Writing Liara mirrors to /etc/apt/sources.list..."
cat > /etc/apt/sources.list <<EOF
deb https://linux-mirror.liara.ir/repository/debian $CODENAME main non-free-firmware
deb-src https://linux-mirror.liara.ir/repository/debian $CODENAME main non-free-firmware
deb https://linux-mirror.liara.ir/repository/debian-security ${CODENAME}-security main non-free-firmware
deb-src https://linux-mirror.liara.ir/repository/debian-security ${CODENAME}-security main non-free-firmware
deb https://linux-mirror.liara.ir/repository/debian ${CODENAME}-updates main non-free-firmware
deb-src https://linux-mirror.liara.ir/repository/debian ${CODENAME}-updates main non-free-firmware
EOF
echo
echo "[3/4] Mirror configuration written."
echo
echo "[4/4] Updating package lists..."
apt update
echo
echo "================================="
echo "Liara mirror setup completed"
echo "Backup saved at:"
echo "/etc/apt/sources.list.bak"
echo "================================="

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Fedora Mirror Setup"
echo "================================="
if [[ ! -f /etc/os-release ]]; then
echo "Cannot detect operating system."
exit 1
fi
source /etc/os-release
if [[ "$ID" != "fedora" ]]; then
echo "This script only supports Fedora."
echo "Detected OS: $ID"
exit 1
fi
echo "Detected Fedora version: $VERSION_ID"
FEDORA_REPO="/etc/yum.repos.d/fedora.repo"
UPDATES_REPO="/etc/yum.repos.d/fedora-updates.repo"
echo
echo "[1/4] Backing up existing repository files..."
cp "$FEDORA_REPO" "${FEDORA_REPO}.bak"
cp "$UPDATES_REPO" "${UPDATES_REPO}.bak"
echo
echo "[2/4] Configuring Fedora base repository..."
cat > "$FEDORA_REPO" <<'EOF'
[fedora]
name=Fedora $releasever - $basearch
baseurl=https://linux-mirror.liara.ir/repository/fedora/linux/releases/$releasever/Everything/$basearch/os/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
countme=1
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
echo
echo "[3/4] Configuring Fedora updates repository..."
cat > "$UPDATES_REPO" <<'EOF'
[updates]
name=Fedora $releasever - $basearch - Updates
baseurl=http://linux-mirror.liara.ir/repository/fedora/linux/updates/$releasever/Everything/$basearch/
#metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
echo
echo "[4/4] Refreshing package cache..."
dnf makecache
echo
echo "================================="
echo "Liara Fedora mirror configured"
echo "Backups saved:"
echo "${FEDORA_REPO}.bak"
echo "${UPDATES_REPO}.bak"
echo "================================="

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Manjaro Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "manjaro" ]]; then
echo "This script only supports Manjaro."
echo "Detected OS: $ID"
exit 1
fi
echo
echo "[1/3] Backing up mirrorlist..."
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
echo
echo "[2/3] Writing Liara mirror..."
echo "Server = https://linux-mirror.liara.ir/repository/manjaro/stable/\$repo/\$arch" \
> /etc/pacman.d/mirrorlist
echo
echo "[3/3] Refreshing package databases..."
pacman -Syy
echo
echo "Manjaro mirror configured successfully."

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara OpenSUSE Mirror Setup"
echo "================================="
if ! command -v zypper &> /dev/null; then
echo "This script only supports OpenSUSE."
exit 1
fi
echo
echo "[1/2] Adding Liara repository..."
zypper addrepo \
--priority 100 \
--no-gpgcheck \
https://linux-mirror.liara.ir/repository/opensuse/distribution/leap/\$releasever/repo/oss/ \
opensuse-oss
echo
echo "[2/2] Refreshing repositories..."
zypper refresh
echo
echo "OpenSUSE mirror configured successfully."

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Rocky Linux Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "rocky" ]]; then
echo "This script only supports Rocky Linux."
echo "Detected OS: $ID"
exit 1
fi
REPO="/etc/yum.repos.d/rocky.repo"
echo
echo "[1/3] Backing up existing repository..."
if [[ -f "$REPO" ]]; then
cp "$REPO" "$REPO.bak"
fi
echo
echo "[2/3] Writing Liara mirror configuration..."
cat > "$REPO" <<'EOF'
[baseos]
name=Rocky Linux $releasever - BaseOS
baseurl=https://linux-mirror.liara.ir/repository/rocky/$contentdir/$releasever/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
metadata_expire=6h
[appstream]
name=Rocky Linux $releasever - AppStream
baseurl=https://linux-mirror.liara.ir/repository/rocky/$contentdir/$releasever/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
metadata_expire=6h
[crb]
name=Rocky Linux $releasever - CRB
baseurl=https://linux-mirror.liara.ir/repository/rocky/$contentdir/$releasever/CRB/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
metadata_expire=6h
EOF
echo
echo "[3/3] Refreshing package cache..."
dnf makecache
echo
echo "Rocky mirror configured successfully."

View File

@@ -0,0 +1,71 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Liara Ubuntu Mirror Setup"
echo "================================="
if [[ ! -f /etc/os-release ]]; then
echo "Cannot detect operating system."
exit 1
fi
source /etc/os-release
if [[ "$ID" != "ubuntu" ]]; then
echo "This script only supports Ubuntu."
echo "Detected OS: $ID"
exit 1
fi
CODENAME="$VERSION_CODENAME"
if [[ -z "$CODENAME" ]]; then
echo "Could not detect Ubuntu codename."
exit 1
fi
echo "Detected Ubuntu version codename: $CODENAME"
SOURCE_FILE="/etc/apt/sources.list.d/ubuntu.sources"
if [[ ! -f "$SOURCE_FILE" ]]; then
echo "Expected file not found: $SOURCE_FILE"
exit 1
fi
echo
echo "[1/4] Backing up existing sources..."
cp "$SOURCE_FILE" "${SOURCE_FILE}.bak"
echo
echo "[2/4] Writing Liara mirror configuration..."
cat > "$SOURCE_FILE" <<EOF
Types: deb
URIs: https://linux-mirror.liara.ir/repository/ubuntu
Suites: ${CODENAME} ${CODENAME}-updates ${CODENAME}-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: https://linux-mirror.liara.ir/repository/ubuntu-security
Suites: ${CODENAME}-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
echo
echo "[3/4] Mirror configuration written."
echo
echo "[4/4] Updating package index..."
apt update
echo
echo "================================="
echo "Liara Ubuntu mirror configured"
echo "Backup saved at:"
echo "${SOURCE_FILE}.bak"
echo "================================="

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare AlmaLinux Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "almalinux" ]]; then
echo "This script only supports AlmaLinux."
exit 1
fi
echo "[1/3] Backing up repo files..."
cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
echo "[2/3] Updating repo configuration..."
for f in /etc/yum.repos.d/*.repo; do
sed -i 's/^mirrorlist/#mirrorlist/g' "$f"
sed -i 's/^#baseurl/baseurl/g' "$f"
sed -i 's|^baseurl=.*|baseurl=http://mirror-linux.runflare.com/almalinux/\$releasever/\$basearch/os/|g' "$f"
done
echo "[3/3] Refreshing cache..."
dnf clean all
dnf makecache
echo "AlmaLinux mirror configured."

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare Alpine Mirror Setup"
echo "================================="
if [[ ! -f /etc/alpine-release ]]; then
echo "This script only supports Alpine."
exit 1
fi
VERSION="v$(cut -d'.' -f1,2 /etc/alpine-release)"
echo "[1/3] Backing up repositories..."
cp /etc/apk/repositories /etc/apk/repositories.bak
echo "[2/3] Writing mirror..."
cat > /etc/apk/repositories <<EOF
http://mirror-linux.runflare.com/alpine/$VERSION/main
http://mirror-linux.runflare.com/alpine/$VERSION/community
EOF
echo "[3/3] Updating package index..."
apk update
echo "Alpine mirror configured."

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare Arch Mirror Setup"
echo "================================="
if [[ ! -f /etc/arch-release ]]; then
echo "This script only supports Arch Linux."
exit 1
fi
echo "[1/3] Backing up mirrorlist..."
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
echo "[2/3] Commenting existing mirrors..."
sed -i 's/^Server/#Server/g' /etc/pacman.d/mirrorlist
echo "[3/3] Adding Runflare mirror..."
echo "Server = http://mirror-linux.runflare.com/archlinux/\$repo/os/\$arch" \
>> /etc/pacman.d/mirrorlist
pacman -Syyu
echo "Arch mirror configured."

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare Debian Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "debian" ]]; then
echo "This script only supports Debian."
exit 1
fi
CODENAME=$(lsb_release -cs)
echo "[1/3] Backing up sources.list..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "[2/3] Writing Runflare mirror..."
tee /etc/apt/sources.list > /dev/null <<EOF
deb http://mirror-linux.runflare.com/debian $CODENAME main
deb http://mirror-linux.runflare.com/debian-security ${CODENAME}-security main
EOF
echo "[3/3] Updating package index..."
apt update
echo "Debian mirror configured."

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare Fedora Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "fedora" ]]; then
echo "This script only supports Fedora."
exit 1
fi
echo "[1/3] Updating repo configuration..."
sed -i "s|^metalink=|#metalink=|g" /etc/yum.repos.d/fedora*.repo
sed -i "s|^#baseurl=http://download.example/pub/fedora/linux|baseurl=http://mirror-linux.runflare.com/fedora|g" \
/etc/yum.repos.d/fedora*.repo
sed -i "s|^baseurl=http://download.example/pub/fedora/linux|baseurl=http://mirror-linux.runflare.com/fedora|g" \
/etc/yum.repos.d/fedora*.repo
echo "[2/3] Cleaning cache..."
dnf clean all
echo "[3/3] Rebuilding cache..."
dnf makecache
echo "Fedora mirror configured."

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare Kali Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "kali" ]]; then
echo "This script only supports Kali Linux."
exit 1
fi
RELEASE=$(lsb_release -cs)
echo "[1/3] Backing up sources.list..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "[2/3] Writing Runflare mirror..."
cat > /etc/apt/sources.list <<EOF
deb https://mirror-linux.runflare.com/kali $RELEASE main non-free contrib
EOF
echo "[3/3] Updating package index..."
apt update
echo "Kali mirror configured."

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Runflare Ubuntu Mirror Setup"
echo "================================="
source /etc/os-release
if [[ "$ID" != "ubuntu" ]]; then
echo "This script only supports Ubuntu."
exit 1
fi
CODENAME=$(lsb_release -cs)
echo "[1/3] Backing up sources.list..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "[2/3] Writing Runflare mirror..."
tee /etc/apt/sources.list > /dev/null <<EOF
deb http://mirror-linux.runflare.com/ubuntu $CODENAME main restricted universe multiverse
deb http://mirror-linux.runflare.com/ubuntu $CODENAME-updates main restricted universe multiverse
deb http://mirror-linux.runflare.com/ubuntu $CODENAME-backports main restricted universe multiverse
deb http://mirror-linux.runflare.com/ubuntu $CODENAME-security main restricted universe multiverse
EOF
echo "[3/3] Updating package index..."
apt update
echo "Ubuntu mirror configured."

35
scripts/security.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " Security Setup"
echo "================================="
read -rp "Disable root SSH login? (y/n): " DISABLE_ROOT
if [[ "$DISABLE_ROOT" == "y" ]]; then
sed -i 's/^#PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
fi
read -rp "Enable SSH key-only login (disable passwords)? (y/n): " KEY_ONLY
if [[ "$KEY_ONLY" == "y" ]]; then
sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
fi
read -rp "Restart SSH service now? (y/n): " RESTART_SSH
if [[ "$RESTART_SSH" == "y" ]]; then
systemctl restart ssh || systemctl restart sshd
fi
echo
read -rp "Enable UFW firewall? (y/n): " ENABLE_FIREWALL
if [[ "$ENABLE_FIREWALL" == "y" ]]; then
apt update
apt install -y ufw
ufw allow OpenSSH
ufw --force enable
fi
echo "Security setup complete"

69
scripts/user.sh Normal file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -e
echo "================================="
echo " User Setup"
echo "================================="
read -rp "Enter new username: " USERNAME
if id "$USERNAME" &>/dev/null; then
echo "User already exists"
exit 1
fi
useradd -m -s /bin/bash "$USERNAME"
passwd "$USERNAME"
read -rp "Add user to sudo group? (y/n): " ADD_SUDO
if [[ "$ADD_SUDO" == "y" ]]; then
usermod -aG sudo "$USERNAME"
fi
mkdir -p "/home/$USERNAME/.ssh"
echo
echo "SSH Setup:"
echo "1) Copy root authorized_keys"
echo "2) Enter new public key"
echo "3) Skip"
read -rp "Choose option: " SSH_OPTION
case "$SSH_OPTION" in
1)
if [[ -f /root/.ssh/authorized_keys ]]; then
cp /root/.ssh/authorized_keys "/home/$USERNAME/.ssh/"
fi
;;
2)
read -rp "Paste public key: " PUBKEY
echo "$PUBKEY" > "/home/$USERNAME/.ssh/authorized_keys"
;;
3)
;;
*)
echo "Skipping SSH setup"
;;
esac
chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh"
chmod 700 "/home/$USERNAME/.ssh"
if [[ -f "/home/$USERNAME/.ssh/authorized_keys" ]]; then
chmod 600 "/home/$USERNAME/.ssh/authorized_keys"
fi
if command -v docker &>/dev/null; then
echo
read -rp "Docker is installed. Add $USERNAME to the docker group? (y/n): " ADD_DOCKER
if [[ "$ADD_DOCKER" == "y" ]]; then
usermod -aG docker "$USERNAME"
echo "Added $USERNAME to the docker group."
else
echo "Skipped adding $USERNAME to docker group."
fi
fi
echo "User setup complete"