Aug 302017

In my last post, I had promised to come back with a guide on setting up your Pi as a media server. It has been some time now, but here it follows.

Before we begin, how about some insight to media servers and certain technology standard called DLNA?

We all have a lots of media lying around in various storage devices and we(some of us at least) still use the stone age methods of transferring media to our media players(USB stick to use on smart TV, phones, tablets etc.). How good it would be if we were able to access our media right from its source without getting up from the chair!!

Enter media servers. These are a bit of software running on a network connected computer, which organise, and share your media to anyone connected on to the network. To unify the way these network connected devices access media, a certification standard was formulated by various electronics giants like Sony. The basic idea behind formulating this standard was to ensure that media can be accessed across various platforms with ease. So the media content might be on a windows based server but it could be accessed by DLNA compliant devices which could range from a smart TV with proprietary operating system, or a android based mobile phone(android was just in making back then but the standard was platform independent so could be adopted at a later stage easily) or even a linux based computer. More information on DLNA of Digital Living Network Alliance can be found here.

Anyway, if you are following this guide, it means you are a potential candidate to setup media server on your home network. This guide is specific to Raspbian OS and the prerequisites are to have a Raspberry Pi which is connected to your network(via wired network preferably) and your HDDs with the media folders mounted to an accessible folder. You can follow the guides in my previous posts here and here for that.

Let’s begin!!

Login to you pi via SSH. Remember we are running the device headless since we want to conserve the processing power. In case you are still using desktop, you can launch terminal from the desktop.

First ensure that your Raspbian installation is up-to-date. Run the following commands for that.

sudo apt-get update

sudo apt-get upgrade

Next install minidlna using:

sudo apt-get install minidlna

Once installed, backup the minidlna configuration file using:

sudo cp /etc/minidlna.conf /etc/backup_minidlna.conf

Open the minidlna configuration file in nano for editing using:

sudo nano /etc/minidlna.conf

(you can use sudo leafpad /etc/minidlna.conf to open in leafpad in case you are working on desktop instead of terminal)

In the configuration file, find(using up/dn arrow keys) db_dir and set its value to :


Remember, most of these settings are commented out using #. Remove the # to uncomment them and make them usable.

Set minidlna media directories to point at the directories which hold your media as follows:

media_dir=V, /media/WD/movies

Here “V” stands for Videos. For specifying aa audio directory, use “A” and “P” for photos . The above line in the configuration file will specify that one of the media directory to scan for video files only is located /media/WD/movies. I have used WD since I have mounted one of my HDD at /media/WD and the “movies” is a folder in that HDD which contains movies. You will certainly have a different configuration so check your setup and edit this line accordingly.

If you are specifying media_dir=V, /XXX/XXXX/XXX, the server will only serve video files to the network. If you do not specify “V”, it will search for all media contents in music, photos, videos. So the line can also be :


You can have multiple configuration lines here. But I suggest you organise the media properly before sharing else your media devices will show you a lot of directories and you will find it difficult to locate specific media in them.

In friendly_name suggest a recognisable name. Mine is :

friendly_name=Raspberry Pi MiniDLNA

You can have anything you like.

Uncomment out the inotify=yes so that the server keeps on searching for new media, whenever you add new files.

Now click ctrl+x.. It will as whether to save the file. Select yes. Then run the following commands.

sudo service minidlna restart

sudo service minidlna force-reload

To ensure minidlna service starts at reboot run the command:

sudo update-rc.d minidlna defaults

No go for a reboot once using:

sudo reboot

If you have done everything right, upon reboot you should be able to see your media server on you DLNA compliant devices, or DLNA media player softwares.

Do ping me in case you have trouble.

Jul 162017

If you follow tech world, you must surely have come across the name “Raspberry Pi” which has been making waves in its field for about 5 years. I had provided a basic insight regarding credit card sized(and thumbnail sized) computers in my previous post. These tiny boards cost from about 5$ to well over 100$, each with its own specialties. And they are the favorites of the geeks for small tasks, dedicated application or plain hobby projects.

But its not just the geeks who have the competence to use them. A common person like any of us can pick one up and configure with a little bit of research(nothing anyone can’t handle. Some basic configurations are straight forward.) You can use it as a simple linux based computer, a media server, a network attached storage controller, create a magic mirror, an interactive AI and pretty much anything you may want with a bit of advance tutorials.

The aim of my todays blog is to guide you through the installation of Raspbian and create a backup image of the setup. The back up will help you to copy the sd card in an image format which can be overwritten anytime you feel that the OS is not behaving well. I will also explain how to setup your pi to be used via a remote computer, thus dispensing the need to connect it to a monitor, mouse or keyboard. We shall set it up so that the pi is on static IP and easily accessible via shell or via VNC.

Note that the Raspbian OS is based on Debian distribution of Linux, so even though you get a GUI, be prepared to try out command line for advance configurations. They are fun to learn and not very difficult to remember(or to google for that matter)

What you need

  • A Raspberry Pi 3 with a 2.5 A 5V power supply(micro usb pin)– buy it here and here
  • A 16GB – 32GB micro SD Class 10 card – better a 32 GB version if you plan to setup more number of applications – buy it here
  • A keyboard/mouse/monitor(HDMI TV will do) for initial setup
  • NOOBS – download here (NOOBS is a “New out of Box Software”, a minimal intervention installer with OS packages built in)

Whenever you plan to buy a case for the pi, consider possibility of adding a fan and GPIO headers. Also consider that you may need to remove the micro SD card time and again in case you are using another card for another project. Make sure that the SD card is readily accessible.

Install Raspbian

Before you try to install raspbian on to your sd card, you will need to format in to Fat32 file system. You can use SDformatter for the purpose. Once the SC card is formatted, extract the downloaded NOOBS image in to the root of the SD card.

The installation method below gives the installations of only Raspbian OS with PIXEL desktop. You should be able to install and use any other OS listed within the list, once you are a little familiar with how it works.

  • Insert the card in to you pi in the card slot.
  • Connect the HDMI cable, keyboard and mouse to the pi.
  • Connect the power source.
  • The pi will start automatically. You will be taken to the list of available/downloadable OSes. Select Raspbian jessie with full desktop.


  • On the top left hand corner, you will find a icon shaped like a hdd. It is your install button. Click on the button to install Raspbian.
  • Go have a cup of tea cause it takes 15-20 minutes to install. Yes, no further intervention necessary.
  • When you come back from your short break, you will be greeted with a message saying that OS is installed. Click ok. The system will reboot.

That completes the installation part. Once the system reboots, it will take you to the PIXEL desktop. It is essentially similar to windows desktop with the taskbar and menu docked to the top. But don’t let the appearances fool you. The core on which it is built is rock solid, highly customizable and very secure.

The round raspberry on top left gets the things started for you. Navigate around to get a feel. The other important icons which you would be using time and again are:

  • The blue globe near the raspberry, which is essentially the web browser.
  • The folder icon, which is used to navigate the file system
  • The black window, which I guess you know from your windows days, the console or the terminal

Navigate around the icons, they wont kill the system for now.


Let’s change the default password

Ok, first thing’s first. We secure out pi before we connect it to network. Click on the terminal icon. The terminal, as below, will open up.


Here, the “pi” is the current user and raspberrypi is the hostname. Let’s change the password. Type the following code in front of the prompt:


You will be prompted to enter the current password. The factory default password for user pi is raspberry. Enter the password and you will be asked to type in the new password, two times. Enter it twice and the password will be changed.


Let’s setup static IP

Setting up a static Ip to your pi makes it easy to access it from another machine

  • Open terminal and type in sudo nano /etc/dhcpcd.conf
  • Here sudo mean you are telling the system to do something as a superuser. Something similar to run as administrator in windows.
  • nano is a text editor for terminal. another text editor available for GUI is leafpad. So when you are logged into desktop, you can type in sudo leafpad…… instead of sudo nano….. But it is a good practice to use nano since, once we switch off the GUI, console is all that you have until you switch it back on again. You will be able to use only the arrow keys and enter button in nano.
  • dhcpcd.conf is the configuration file for the network and etc is the directory where it is stored
  • scroll down to the bottom of the file that opens up and type in the following code:

(Edit 19 August 2017 : Raspberry Pi foundation has released the new version of Raspbian codenamed Stretch(old was Jessie). The procedure for setting up static IP is different and listed below)

interface eth0

static ip_address=

static routers=

static domain_name_servers=

interface wlan0

static ip_address=

static routers=

static domain_name_servers=

In the above code:

  • you can use either wlan0 or eth0 or both, depending on what kind of connectivity you plan. wlan0 is for wifi and eth0 is for wired connection.
  • static ip can be of your choice based on your network configuration (eg. some networks are configures Make sure to keep the number /24 in the settings.
  • static router specifies the router to which the pi is to be connected. My router ip is
  • similarly static domain name servers can be as per your network configuration. My home network devices get their DNS from my router so I have entered my router address.’’
  • Press ctrl + S to save the settings.
  • Press ctrl + X to close the editor.

Edit 19 August 2017 : New procedure to setup static IP on Raspbian Stretch follows

In Raspbian Stretch, the network interface is no longer recognised as eth0 or wlan0. So we need to first find what it is called(different for different machines.)

  • type command ifconfig
  • you should get results like below

enxxxxxxxxxxxxx: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast
inet6 fe80::35e0:4ba4:69da:a857 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:2d:0c:50 txqueuelen 1000 (Ethernet)
RX packets 22310 bytes 13188104 (12.5 MiB)
RX errors 0 dropped 6 overruns 0 frame 0
TX packets 11464 bytes 6083883 (5.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet netmask
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 25 bytes 1484 (1.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 25 bytes 1484 (1.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

  • The entire alphanumeric code above in yellow is how my eth0 is recognised. It will be something else for you.
  • Now type command sudo nano /etc/dhcpcd.conf
  • At the bottom of the file that opens up, add the following. Ensure you add the correct addresses for your network setup.

interface enxxxxxxxxxxxxx
static ip_address=
static routers=
static domain_name_servers=

You can now connect to the home wifi, of ethernet, or both. The up and down arrow on your top right hand side of desktop will help you join a wifi network.

Once connected to internet, it would be a good practice to update your system before you go further.

Open the terminal and type in sudo apt-get update. Once this command is executed, use sudo apt-get upgrade. It is a good practice to use this two commands before installing any new software on your pi. They are used to update any packages which are installed on your pi and which have been updated ever since you installed. Fresh OS installations normally have some major updates available.

Let’s do away with that monitor, keyboard and mouse(Optional if you are comfortable running the show remotely via terminal. But that’s what these board is all about….accepting the challenge)

So now that you have changed password and set up static IP, let’s go a bit deep and dispense away that monitor. Only of course if you have a computer or a laptop from where you can control it. Remember, though the pi can be used as a regular desktop computer, it will run only may be one or two applications together because it simple lacks the resources needed for heavy multitasking. It is best suited for headless apps and servers, similar to ones which I have listed out in the beginning.

Open the terminal and type in sudo raspi-config

  • This will open the configuration tools for raspberry pi. Thins this as a BIOS for your PC with more configurations.


  • Use the arrow keys and enter button to select Interfacing Options.
  • Select SSH and enable it. Next Select VNC and enable it. Selection is by pressing enter and arrow keys.


  • Select Back.
  • Select Boot Options
  • Select Desktop/CLI
  • Select B2 Console auto login.


  • Select finish and reboot.
  • Move over to your regular use PC.
  • Download and install a SSH client like putty. Run Putty on your pc.
  • Enter the IP address in the hostname field, enter a recognizable name in saved session field and click save


  • Now double click on your saved session and a terminal window should open up asking you to enter username. Enter pi.
  • Next enter the password which you have set.
  • This will take you to console from where you can control your pi.


Since you have configured only console login via configuration tools, you can access only via putty(SSH). If you configure to boot in desktop mode via configuration tools, you can use VNC to login to desktop too. You will need to download VCN on your computer to do that. Try it out, its easy. If in doubt, just leave a query. You can always go back to desktop login by using sudo raspi-config.

Let’s backup

Let’s try the easy way to backup today.

  • Download win32 disk imager and install on your computer.
  • Shut down the raspberry pi, remove the card and insert it in your computer(via SD card reader)
  • Run win32 diskimager.
  • Select the device to backup(our sd card).
  • Select a backup location on your computer and give a file name (eg, raspbianbackup.img)
  • Click on Read


  • The backup will automatically be created at the specified location.
  • Next time, the setup on you pi doesn’t work as it should, run this program again and select this image we have created. Click write instead of read this time, to overwrite on the card.

In case you have any doubts or anything very clear or seems to be wrong, kindly leave a comment. In the next tutorial I plan to explain setting up a NAS server, a DLNA server and an always on bit torrent box.

Till then!!

%d bloggers like this: