Basics & UFW
Install basic packages and UFW on server
Update system
Execute some updates and install vim editor
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -yPackages
Common
zipandunzipto compress and decompress filescurlto download filesgitto manage repositoriesvimto edit filessshto connect to serverlsb-releaseto get information about distributionca-certificatesto manage certificatesapt-transport-httpsto use https in aptsoftware-properties-commonto manage software
sudo apt install -y \
zip \
unzip \
curl \
git \
vim \
ssh \
lsb-release \
ca-certificates \
apt-transport-https \
software-properties-common \
htop \
p7zip-full \
neofetchHandle images
These tools are used to optimize images.
INFO
If your server is not used to host images, you can skip this step.
sudo apt install -y \
jpegoptim \
optipng \
pngquant \
optipng \
gifsicle \
webpConversion
These tools are used to convert images and videos.
ffmpegto convert videosimagemagickto convert images
sudo apt install -y \
ffmpeg \
imagemagickServer monitoring
INFO
You can install all packages or only some of them.
Base packages
procps: providesps,vmstat,uptime,topfor basic statsutil-linux:dmesg,lsblk,lscpufor system logs and hardware infosysstat:iostat,mpstat,pidstat,sarfor disk/CPU statsiproute2:ip,ss,nstat,tc, recommended network toolsnumactl:numastatfor NUMA stats
sudo apt install -y procps util-linux sysstat iproute2 numactlNetwork tools
tcpdump: network sniffernicstat: network interface statsethtool: interface info
sudo apt install -y tcpdump nicstat ethtoolProfiling and tracing tools
linux-tools-commonetlinux-tools-$(uname -r): perf, turbostatbpfcc-tools(oubcc) : a suite of powerful eBPF toolsbpftrace: a dynamic eBPF scripting tooltrace-cmd: command line tool forftrace
sudo apt install -y linux-tools-common linux-tools-$(uname -r) bpfcc-tools bpftrace trace-cmdEquipment-specific tools
- GPU Intel :
intel-gpu-tools - GPU NVIDIA :
nvidia-smi
UFW (Firewall)
Install firewall
sudo apt install ufw -ySet default rules
sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443Enable firewall
sudo ufw enableShow rules
sudo ufw show added
sudo ufw statusIf works, disallow ssh connection with root.
sudo vim /etc/ssh/sshd_configFind PermitRootLogin line and replace yes to no and restart sshd daemon. Disconnect yourself with exit and you won't able to connect with root, connect with custom user now.
-#Port 22
+Port 22 # l. 14 to change port
-PermitRootLogin yes
+PermitRootLogin no # l. 33 to disable root login
-PasswordAuthentication yes
+PasswordAuthentication no # l. 57 to disable password auth
-KbdInteractiveAuthentication yes
+KbdInteractiveAuthentication no # l. 62 to disable password authsudo systemctl restart sshd.serviceChange SSH port
Change port in sshd config
sudo vim /etc/ssh/sshd_configPort 22Port 1234Allow new port in firewall
sudo ufw allow 1234/tcpRemove old port
sudo ufw delete allow 22/tcpCheck new rules
sudo ufw statusRestart sshd daemon
sudo systemctl restart sshd.service