{"id":477,"date":"2026-03-06T03:52:40","date_gmt":"2026-03-06T03:52:40","guid":{"rendered":"https:\/\/mitalgoswami.in\/?p=477"},"modified":"2026-03-06T03:52:40","modified_gmt":"2026-03-06T03:52:40","slug":"how-to-install-firewall-in-ubuntu-ufw-%f0%9f%94%a5%f0%9f%9b%a1%ef%b8%8f","status":"publish","type":"post","link":"https:\/\/mitalgoswami.in\/?p=477","title":{"rendered":"How to Install Firewall in Ubuntu (UFW) &#x1f525;&#x1f6e1;&#xfe0f;"},"content":{"rendered":"\n<p>Ubuntu uses <strong>UFW (Uncomplicated Firewall)<\/strong> to manage firewall rules easily. It helps <strong>protect the system by controlling incoming and outgoing network traffic<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Update the System<\/h2>\n\n\n\n<p>Open the <strong>Terminal<\/strong> and update packages.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install UFW Firewall<\/h2>\n\n\n\n<p>Install the firewall package.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install ufw<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Check Firewall Status<\/h2>\n\n\n\n<p>Check whether the firewall is active.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw status<\/pre>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Status: inactive<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Enable the Firewall<\/h2>\n\n\n\n<p>Enable UFW protection.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw enable<\/pre>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Firewall is active and enabled on system startup<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Allow Services (Example: SSH)<\/h2>\n\n\n\n<p>Allow specific services if required.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow ssh<\/pre>\n\n\n\n<p>You can also allow HTTP for web servers.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow http<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Check Firewall Rules<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw status verbose<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 7: Disable Firewall (Optional)<\/h2>\n\n\n\n<p>If needed, you can disable it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw disable<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Example Screenshots (Terminal)<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">1&#xfe0f;&#x20e3; Installing UFW<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/img.azdigi.com\/2021\/01\/Screenshot-2021-01-22-at-22.12.17%402x.png\" alt=\"https:\/\/img.azdigi.com\/2021\/01\/Screenshot-2021-01-22-at-22.12.17%402x.png\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.cyberciti.biz\/media\/new\/faq\/2018\/11\/Setup-a-UFW-firewall-on-Ubuntu-18.04-LTS-server.png\" alt=\"https:\/\/www.cyberciti.biz\/media\/new\/faq\/2018\/11\/Setup-a-UFW-firewall-on-Ubuntu-18.04-LTS-server.png\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.linux.com\/images\/stories\/66866\/ufw_A.png\" alt=\"https:\/\/www.linux.com\/images\/stories\/66866\/ufw_A.png\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu uses UFW (Uncomplicated Firewall) to manage firewall rules easily. It helps protect the system by controlling incoming and outgoing network traffic. Step 1: Update the System Open the Terminal and update packages. sudo apt update Step 2: Install UFW Firewall Install the firewall package. sudo apt install ufw Step 3: Check Firewall Status Check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-477","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=477"}],"version-history":[{"count":1,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/477\/revisions"}],"predecessor-version":[{"id":478,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/477\/revisions\/478"}],"wp:attachment":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}