<p>We live in a time where everything is streamed; from our TV, radio,
podcasts everything is fine until the internet goes down. Gone are the
days of simply turning on the TV with a set top aerial. With this in
mind, I set up an old Raspberry Pi 2 and connected it to use as a video
and music server through a Samba share.</p>
<p>To complete this task you will need:</p>
<ul>
<li>A Raspberry Pi</li>
<li>A micro-SD card</li>
<li>An Ethernet cable</li>
<li>An external hard drive (min 2TB recommended)</li>
</ul>
<p>Step 1: Update your Pi software in the terminal:</p>
<pre><code>sudo apt update &amp;&amp; sudo apt upgrade</code></pre>
<p>Step 2: To allow us to share our files over a network we will install
Samba:</p>
<pre><code>sudo apt install samba</code></pre>
<p>Step 3: To find UUID and the file system of the drive, enter:</p>
<pre><code>sudo blkid</code></pre>
<p>Ignore the line with <code>fat32</code>, this is your Micro-SD
card.</p>
<p>Step 4: We need to mount this drive automatically whenever the
Raspberry Pi is switched on. Firstly, we'll need to create a location to
mount the external hard drive, we can do this by using the command:</p>
<pre><code>sudo mkdir /media/external</code></pre>
<p>Step 5: Now we need to edit the fstab to tell the Raspberry Pi to
automount the external drive every time it is switched on</p>
<pre><code>sudo nano /etc/fstab</code></pre>
<p>Insert the following line at the bottom of the page:</p>
<pre><code>UUID=&quot;{the UUID you noted down in step 3}&quot;     /media/external   {type noted in step 3}     auto,user,rw      0     0</code></pre>
<p>The above should all be on one line, pressing the tab key to create a
gap between each piece of information.</p>
<p>Step 6: Now we need to set up which folders are going to be shared.
I'll assume that we are going to make the whole of the external drive
available over the network</p>
<pre><code>sudo nano /etc/samba/smb.conf</code></pre>
<p>At the bottom of the page add the following, note that you can call
this anything you wish, just exchange the word external but you must
include [ ]:</p>
<pre><code>[external]
path = /media/external
available= yes
browsable = yes
public = yes
writable = yes</code></pre>
<p>It's worth noting before we continue that I've set the option
<code>writable = yes</code>, this means that you can add to or remove
the contents of the external drive over the network. If you are not
comfortable having this option then simply change it to
<code>writable = no</code>. Now save and exit (ctrl + X), make sure that
you answer 'yes' to save your changes.</p>
<p>Step 7: We will now set the Raspberry Pi to log in automatically on
startup, if the user Pi isn't logged in then all of things we've just
set up will not work. Type:</p>
<pre><code>sudo nano /etc/inittab</code></pre>
<p>Navigate down to the line:</p>
<pre><code>1:2345:respawn:/sbin/getty --noclear 38400 tty1</code></pre>
<p>and add <code>--autologin pi</code> after <code>getty</code> to make
the line:</p>
<pre><code>1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1</code></pre>
<p>Save and exit (ctrl + X) make sure that you answer 'yes' to save
it.</p>
<p>Step 8: We can try it out our system and auto-login by using the
command</p>
<pre><code>sudo reboot</code></pre>
<p>Assuming that everything goes well, your system should be up and
running. Try and find it on a computer through the file manager. I
personally recommend saving the Pi location on Kodi for an easy to use
solution for browsing your media on a TV.</p>
