The first step is to determine the current status of your firewall, by using this command:
$ sudo ufw status verbose
If UFW is not installed you will have to install it:
$ sudo apt-get install ufw
UFW should have been installed by default on Ubuntu