Cloud/Hetzner/AA: Difference between revisions
Jump to navigation
Jump to search
Line 39: | Line 39: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cat << FST | sudo tee -a /etc/fstab >/dev/null | cat << FST | sudo tee -a /etc/fstab >/dev/null | ||
# | # loop based swap storage » 16GB + 4GB | ||
/swap.img none swap sw 0 0 | /swap.img none swap sw 0 0 | ||
FST | FST |
Revision as of 20:00, 12 February 2025
SSH Access
ssh -i ~/.ssh/cid.chorke.org_ed25519 [email protected]
Add Users
# root
passwd
adduser chorke
passwd chorke
adduser shahed
passwd shahed
APT Update
cat << EXE | sudo bash
apt-get update;echo
mkdir -p /etc/apt/keyrings
apt list -a --upgradable;apt-get upgrade -y;echo
apt-get install -y apt-transport-https ca-certificates gnupg build-essential snap
EXE
Swap Space
echo 'swapon --show'|sudo bash
cat <<'EXE' | sudo bash
swapoff /swap.img
fallocate -l 20G /swap.img
ls -lh /swap.img && mkswap /swap.img
chmod 0600 /swap.img && swapon /swap.img && swapon --show && free -th
EXE
cat << FST | sudo tee -a /etc/fstab >/dev/null
# loop based swap storage » 16GB + 4GB
/swap.img none swap sw 0 0
FST
cat /etc/fstab
free -th
echo 'swapon --show'|sudo bash
Cloudflare » WARP
cat << INI | sudo tee /etc/systemd/system/warp0.service >/dev/null
[Unit]
Description=Cloudflared WARP Routing Virtual Interface
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/ip link add warp0 type dummy
ExecStartPost=/usr/sbin/ip addr add 10.20.41.1/32 dev warp0
ExecStartPost=/usr/sbin/ip link set warp0 up
ExecStop=/usr/sbin/ip link delete warp0
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
INI
cat << EXE | sudo bash
systemctl enable warp0.service
systemctl start warp0.service
systemctl status warp0.service
EXE
ip a
Containerize » LXD
cat << EXE | sudo bash
snap install lxd --channel=6/stable
usermod -aG lxd chorke
usermod -aG lxd shahed
EXE
echo 'id -nG'|sudo -i -u chorke bash
echo 'id -nG'|sudo -i -u shahed bash
cat <<YML | sudo lxd init --preseed
---
config: {}
networks:
- config:
ipv4.address: 10.20.0.1/24
ipv4.nat: "true"
ipv6.address: auto
description: ""
name: lxdbr0
type: ""
project: default
storage_pools:
- config:
size: 30GiB
description: ""
name: lxd-zfs-pool-aa
driver: zfs
storage_volumes: []
profiles:
- config: {}
description: ""
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
root:
path: /
pool: lxd-zfs-pool-aa
type: disk
name: default
projects: []
cluster: null
YML
Containerize » Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo tee /etc/apt/keyrings/docker.asc >/dev/null
DISTRIBUTION=$(. /etc/os-release && echo "${VERSION_CODENAME}")
cat << SRC | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${DISTRIBUTION} stable
SRC
cat << EXE | sudo bash
apt-get update;echo
apt-cache policy docker-ce
apt list -a --upgradable;apt-get upgrade -y;echo
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
EXE
cat << EOF | sudo tee /etc/docker/daemon.json >/dev/null
{
"bip" : "10.20.13.1/24",
"mtu" : 1500,
"dns" : [
"8.8.8.8",
"8.8.4.4"
],
"debug": true
}
EOF
cat << EXE | sudo bash
systemctl stop docker.socket
systemctl stop docker.service
systemctl start docker.service
usermod -aG docker chorke
usermod -aG docker shahed
EXE
ip a
echo 'id -nG'|sudo -i -u shahed bash
echo 'id -nG'|sudo -i -u chorke bash
References
| ||
| ||