{"id":23,"date":"2025-01-24T00:17:08","date_gmt":"2025-01-24T00:17:08","guid":{"rendered":"https:\/\/neutronxinnovation.com\/blog\/?p=23"},"modified":"2025-02-03T09:21:18","modified_gmt":"2025-02-03T09:21:18","slug":"install-ubuntu-and-expose-raspberry-pi-to-internet","status":"publish","type":"post","link":"https:\/\/neutronxinnovation.com\/blog\/2025\/01\/24\/install-ubuntu-and-expose-raspberry-pi-to-internet\/","title":{"rendered":"Install Ubuntu and expose Raspberry Pi to internet"},"content":{"rendered":"<p>This post is in continuation to: <a href=\"https:\/\/neutronxinnovation.com\/blog\/2025\/01\/25\/authentication-infrastructure-using-ory-stack\/\" target=\"_blank\" rel=\"noopener prev\">Authentication Infrastructure &#8211; Using Ory Stack (Ory Kratos, Ory Hydra) &#8211; NeutronX Innovation Blog<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Alright, so now let&#8217;s move to next step i.e.:<\/p>\n<ul>\n<li>Ready My Hardware<\/li>\n<li>Install necessary tools<\/li>\n<li>Exposing it to Internet<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>1. Ready my Hardware<\/h3>\n<p>The hardware I used is as mentioned below:<\/p>\n<ul>\n<li>Raspberry Pi 5<\/li>\n<li>Booting up from a SSD, 2 extra SSDs connected (Why 3? Becz I can afford :P).<\/li>\n<li>All 3 SSDs are connected using 4 Bay SSD Hat by Geekworm (<a href=\"https:\/\/geekworm.com\/products\/x1011?_pos=5&amp;_fid=4c805babd&amp;_ss=c\" target=\"_blank\" rel=\"noopener nofollow\">Geekworm X1011<\/a>)<\/li>\n<li>OS: Ubuntu 24.04.1 (Noble Numbat)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Steps I followed to get it ready:<\/p>\n<ul>\n<li>Install OS<\/li>\n<li>Assign static DHCP IP address<\/li>\n<li>Mount my SSDs<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h4>Install OS<\/h4>\n<p>So since I am using Raspberry Pi, I used Raspberry Pi 5 imager and installed Ubuntu to my small SSD. Then I connected it to my RPi and it worked flawlessly.<\/p>\n<p>&nbsp;<\/p>\n<h4>Assign static DHCP IP address<\/h4>\n<p>I connected my RPi to my network using LAN cable (recommended) and gave it static DHCP address in my router so that it&#8217;s local IP address doesn&#8217;t change.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-62\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/static-dhcp.png\" alt=\"mapping raspberry pi to a specific local ip address on home router in DHCP\" width=\"648\" height=\"320\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/static-dhcp.png 828w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/static-dhcp-300x148.png 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/static-dhcp-768x378.png 768w\" sizes=\"(max-width: 648px) 100vw, 648px\"><\/p>\n<p>&nbsp;<\/p>\n<p>What happens with this config is that, you&#8217;re instructing your router to assign the mentioned IP address to device having this MAC Address (Simply put, every network connected device [Ethernet, Wi-Fi, and Bluetooth] has a MAC Address. If there are multiple network connections, there will be multiple MAC Addresses). If we don&#8217;t fix it like this, router assigns any IP address to your device which make things complicated sometimes. Hence, I highly recommend doing this.<\/p>\n<p>&nbsp;<\/p>\n<h4>Mount my SSDs (Optional)<\/h4>\n<p>Next step is to setup my other 2 hard drives to be recognized and mounted at some path. I choose the following:<\/p>\n<p>SSD1 -&gt; This is my boot drive. I am not touching it for anything<\/p>\n<p>SSD2 -&gt; \/serverapps [I will install all my apps here]<\/p>\n<p>SSD3 -&gt; \/serverstorage [This will serve as data storage option if I need anything]<\/p>\n<p>&nbsp;<\/p>\n<p>For formatting my SSDs with XFS filesystem (Why XFS? Described in the article in link) and mounting them, I used this guide: <a href=\"https:\/\/www.cyberciti.biz\/faq\/how-to-install-xfs-and-create-xfs-file-system-on-debianubuntu-linux\/\" target=\"_blank\" rel=\"noopener\">How to install xfs and create xfs file system on Debian\/Ubuntu Linux<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60 size-full\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/root-directory.png\" alt=\"Image showing SSDs mounted as folder on linux root\" width=\"1459\" height=\"127\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/root-directory.png 1459w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/root-directory-300x26.png 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/root-directory-1024x89.png 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/root-directory-768x67.png 768w\" sizes=\"(max-width: 1459px) 100vw, 1459px\"><\/p>\n<p>&nbsp;<\/p>\n<h3>2. Install Necessary Tools<\/h3>\n<ul>\n<li>A Database (I used MySQL)<\/li>\n<li>Customize MySQL installation directory to my <code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/serverapps<\/code><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h4>Install MySQL<\/h4>\n<p>This is the most complete tutorial I found on MySQL installation on Ubuntu and I followed it: <a href=\"https:\/\/itslinuxfoss.com\/install-mysql-ubuntu-24-04\/\" target=\"_blank\" rel=\"noopener\">How to Install MySQL on Ubuntu 24.04<\/a><\/p>\n<p>&nbsp;<\/p>\n<h4>Customize MySQL installation directory (Optional)<\/h4>\n<p>I followed following tutorial: <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-20-04\">How To Move a MySQL Data Directory to a New Location on Ubuntu 20.04 | DigitalOcean<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>For me, mysql is installed under following path: <strong>\/serverapps\/mysql<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3>3. Expose it to Internet<\/h3>\n<p><strong>Prerequisite:<\/strong> You must have a static IP. Global IP address assigned to your router changes when your router restarts. Hence, you cannot point your domain to your router&#8217;s IP address reliably and static IP address is a must. Contact your ISP (Internet Service Provider) for this.<\/p>\n<p>&nbsp;<\/p>\n<p>When incoming requests reach your router (Example, I am hosting an http server on a machine inside my home i.e. port 80), router has no idea what to do with it. To resolve this, most router&#8217;s admin console has some inbuilt functionality called &#8220;Port Mapping\/Forwarding&#8221;. Via that, you instruct your router that whenever any request comes on a particular port, forward that traffic to a specific IP Address in your local network.<\/p>\n<p>&nbsp;<\/p>\n<p>On my router, it looks like this:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-80\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/port-mapping.png\" alt=\"Image showing port forwarding\/mapping to forward traffic from router's IP Address to a device inside the network\" width=\"506\" height=\"746\"><\/p>\n<p>&nbsp;<\/p>\n<p>This mapping above is telling my router to forward all incoming requests on port 80 (public port) to my RPi (having local IP 192.168.1.100) on it&#8217;s port 80.<\/p>\n<p>&nbsp;<\/p>\n<p>For now, port 80 is the one we require. We can add others, if necessary, later.<\/p>\n<p>&nbsp;<\/p>\n<p>Next Part: <a href=\"https:\/\/neutronxinnovation.com\/blog\/2025\/01\/31\/get-a-domain-and-route-traffic-to-raspberry-pi-using-cloudflare\/\" rel=\"noopener prev\">Get domain name and point to your home server via Cloudflare<\/a><\/p>\n<p>&nbsp;<\/p>\n<hr>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is in continuation to: Authentication Infrastructure &#8211; Using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"Install Ubuntu and expose Raspberry Pi to internet","_seopress_titles_desc":"I this post, we will see how I ready my hardware (Raspberry Pi 5), install necessary tools (Ubuntu, MySQL etc.) and expose it to Internet","_seopress_robots_index":""},"categories":[1],"tags":[4,6,3,2,5],"_links":{"self":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts\/23"}],"collection":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":40,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions\/196"}],"wp:attachment":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}