Ubuntu includes a simple firewall called ufw. It's off by default.
1. Turn it on: sudo ufw enable
2. Check it: sudo ufw status verbose
3. Allow a service you use from other computers, for example SSH: sudo ufw allow ssh
4. Remove a rule: sudo ufw delete allow ssh
5. Turn it off: sudo ufw disable
Graphical: install gufw (sudo apt install gufw) for an easy on and off switch. Linux Mint has Firewall Configuration in its menu.
Allow SSH before enabling ufw on a computer you manage remotely, or you'll lock yourself out.