My Checklist And Tips For Server Setup
By Alireza Alavi • 6 minutes read •
Table of Contents
Disclaimer: I'm by no means a professional systems administrator or DevOps engineer. I'm a software engineer that works a lot on servers.
These are just how I do things. Maybe not necessarily the best way or even the correct way. But I will be updating and refining this post as I learn more (or post them in separate new posts).
I will be very happy if you share your own tips and tricks with me(contact me)
Linux distribution preferences
If I want to work with a server with more than 4GiB of ram and I know that there will be many use cases for that server, I will go with Debian Linux. It is true and tested, stable and has good community support and resources for server use cases.
If the server is limited on resources, and it will be used for specific things like only containerization or only a single service, I will go with Alpine Linux. It is super lightweight and the package manager apk
is so fast, it's unbelievable.
But for most cases, for the checklist and tips here the Linux distribution doesn't matter that much. So let's get started.
First tools to install
neovim
There is no way I am editing any text without my neovim. When you have a good editor that you are efficient with, editing config files and searching around the server becomes so much faster and less tiring.
Tmux
Tmux is an absolute life saver when SSH-ing into servers. The fact that you might get disconnected from the SSH server and don't lose any work is amazing, The way it lets you have multiple panes and windws and sessions is amazing, it just makes working on servers so much easier and more enjoyable. I hate the default tmux keymaps, so I always import my own config.
btop
Yes, htop
is cool and all, but honestly the usability and information that btop provides is on another level. I install btop on anything I use, and it is the only "task manager" that I need.
ranger
Exploring files on a server can be a real pain, so I always install ranger
to easily navigate and manipulate files and directories on my servers.
lnav
No more cat
and tail
for logs. Super useful for navigating logs and debugging.
firewalld
NOTE: ufw
does not work with docker and docker bypasses the firewall. (see github issue) although you can use a tool like ufw-docker
NOTE: Remember to configure firewall for docker
NOTE: It's much better to use podman in production
These below articles provide good information on this matter https://docs.docker.com/engine/network/packet-filtering-firewalls/
https://dev.to/soerenmetje/how-to-secure-a-docker-host-using-firewalld-2joo
honorable mentions
-
trash-cli
on a server might sound strange, but honestly I think it's just good practice to userm
less and less. Why take unneeded risks? Recently, I accidentally ranrm -rf /*
instead ofrm -rf ./*
and made a pinky promise to myself that I will only usetrash
from now on. There isn't a downside that I can think of. Only more safety. -
rsync
can be very useful if you want to transfer lots of files, much faster and better thanscp
Server configurations
- Update and upgrade the server
- Set datetime and timezone
- Setup firewall
- Allow ssh port
- Deny all incoming, allow all outgoing
- Setup SSH
- Copy ssh key to server:
ssh-copy-id -i ~/.ssh/[key name].pub [user]@[server ip]
- disable root login
- enable ssh-key auth
- disable password auth
- Copy ssh key to server:
- Make sure swap is enabled
- Set hostname
- Enable and configure
unattended-upgrades
- debian wiki
sudo apt install unattended-upgrades apt-listchange
- Edit
/etc/apt/apt.conf.d/50unattended-upgrades
to send emails on upgrades and errors (setup a mail server) - Enable automatic upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
Tips
Neovim as terminal multiplexer
When you realize that 90% of the work that you do on a server can be achieved from a neovim session, It really makes things a lot easier.
You can use the netrw
file explorer built within vim to explore files, use :term
for a terminal within your neovim, and create splits (C-w
) and tabs (:tabnew
). So if you have a raw server with only vim, you have most of the things that you need right there. The tools that I listed prior are super useful and make things a lot easier and better, but if you want to keep it minimal, a lot can be done with just vim.
Remember that more complete multiplexers like tmux
also have sessions, meaning you can disconnect from the SSH and reconnect later and don't lose any work.
Consider podman instead of docker
Podman has a lot of benefits over docker. I haven't tested podman in serious conditions yet, but it seems like it is pretty mature. If feasible, it is a more desirable option.
5 reasons to choose podman in 2025 - redhat
podman vs docker comparison - geekygadgets
ultimate docker to podman migration guide
how to transition from docker to podman
Consider automation
If you setup a lot of servers(I don't. Maybe 10/year) consider automating your repetitive tasks. Automation can be achieved with tools like Ansible or simple bash/sh scripts.
Backups and snapshots
You don't notice that backups are important until you need them.
Try to keep the 3-2-1 principle in mind:
- Three copies of your data: Your three copies include your original or production data plus two more copies.
- On two different media: You should store your data on two different forms of media. This means something different today than it did in the late 2000s. I’ll talk a little more about this in a bit.
- One copy off-site: You should keep one copy of your data off-site in a remote location, ideally more than a few miles away from your other two copies.[source]
I finally realized that for taking backups, you don't have strict how-tos. It very much depends on your use case and situation. Just be sure that you take backups from parts of the system that you can't afford to lose.
You also most likely will need custom bash scripts for taking backups, depending on the services running on the server. So don't try to find a "do it all" tool that just magically "does backups".
Here are some good tools that can help the backup process: