Linux/Virtual Server Setup Guide: Difference between revisions
< Linux
m (→Add swapfile) |
|||
Line 61: | Line 61: | ||
<blockquote> | <blockquote> | ||
<pre> | <pre> | ||
sudo fallocate -l 4G /swapfile | |||
sudo chmod 600 /swapfile | |||
sudo mkswap /swapfile | |||
sudo swapon /swapfile | |||
add to /etc/fstab | |||
/swapfile none swap sw 0 0 | |||
sudo sysctl vm.swappiness=10 | |||
cat /proc/sys/vm/swappiness | |||
</pre> | </pre> | ||
</blockquote> | </blockquote> |
Revision as of 19:23, 21 November 2023
Step 1: Prepare local linux terminal
- Install Windows Subsystem for Linux / Ubuntu
- Open local linux terminal and complete initial setup
Step 2: Generate Cloud VM (Hetzner, Netcup,...)
- Install latest Ubuntu LTS
- Set username / password
- Write down information required for next steps:
- VM IP, VM username, VM password
Step 3: Adjust DNS entries
- Make sure the desired DNS entries point to the (new?) IP of the VM. (IPv4 + IPv6)
- Verify from the local terminal that the DNS entry is pointing to the correct ip
nslookup {hostname}
Step 4: Set up VM
- Open local linux terminal
- Connect to VM:
ssh {user}@{hostname}
Install basics
apt update apt install mc aptitude nmap plocate
Uninstall snapd
apt install apparmor apport apt bcache-tools btrfs-progs cloud-init cryptsetup dbus \ lvm2 mdadm multipath-tools netbase ntfs-3g open-iscsi pollinate snapd ssh-import-id \ sudo systemd systemd-sysv ubuntu-drivers-common ubuntu-release-upgrader-core udev xfsprogs apt purge ubuntu-server-minimal snap remove lxd core20 core22 snapd apt purge snapd ntfs-3g apt autoremove
Install fail2ban
apt install fail2ban cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local systemctl enable fail2ban systemctl restart fail2ban
Add swapfile
sudo fallocate -l 4G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile add to /etc/fstab /swapfile none swap sw 0 0 sudo sysctl vm.swappiness=10 cat /proc/sys/vm/swappiness