Firewall Configuration - Ubuntu

So on Ubuntu, one of the first things you should do is enable the firewall, you can do that by entering the following command in Terminal sudo apt update && sudo apt install ufw && sudo ufw default deny incoming && sudo ufw default allow outgoing && sudo ufw enable and hit Enter, that should install Uncomplicated Firewall and configure it to deny incoming traffic and allow outgoing traffic So if we break that command down, we’ll go through exactly what is happening sudo apt update - downloads the package lists from the repositories and “updates” them to get information on the newest versions of packages and their dependencies. && - tells the computer to run the following command once the previous one is finished sudo apt install ufw - Installs the latest version of Uncomplicated Firewall from the Ubuntu repositories. sudo ufw default deny incoming - Tells Uncomplicated Firewall to deny incoming traffic by default sudo ufw default allow outgoing - Tells Uncomplicated Firewall to allow outgoing traffic by default sudo ufw enable - Switches on Uncomplicated Firewall and ensures that it starts every time the Operating System is booted.