Raspberry Pi

OSMC Media Center and NAS using Raspberry Pi

Beginner 1 hour View Now
view more posts

Today we are going to go through the steps of configuring OSMC Media Center, which can be controlled using your android or IOS device as a remote.

To create OSMC Media Center you will require:

  • Raspberry Pi
  • Keyboard and mouse to connect to the Raspberry Pi
  • External USB hard drive one or two, depending upon the grade or normal configuration
  • An android mobile so that you can download and install the App which will act as a remote
  • A 5 volt micro USB charger that this could be your android mobile charger, but make sure it gives at least 2000milliamps of power.
  • HDMI wire that connects to your TV from the Raspberry Pi

So gather all this material and lets go ahead and create this OSMC Media Center.

Preparing the SD Card.

First, we need to format our micro SD card properly. Head over to the SD association website and download the application. Installing the application is a straight forward process. Insert your SD card into your card reader. In the SD formatter app, choose the correct SD card, change to overwrite format and proceed. Once formatting is done, you get a confirmation.

Which Media Center to choose?

There are two types of operating systems available that you can install in your Raspberry Pi to convert into a media center. One is called as Kodi and another one is called as OSMC. The main difference between Kodi and OSMC is that Kodi is not a Linux flavour. Kodi is built from ground up, so you cannot give any Linux commands to it like sudo or apt-get. But in our project we need to create a network attached storage system which requires a lot of Linux comments. So OSMC is the best choice. Obviously OSMC runs a Linux OS, on top of which Kodi runs. So you get the goodness of Linux along with the goodness of Kodi. Apart from all these things I just feel OSMC has beautiful visuals.

Change settings - Allow downloaded apps from anywhere.

Change settings – Allow downloaded apps from anywhere.

Installing OSMC Media Center

Download the installation application for your OS and get going with the setup process. Sometimes your MAC does not allow downloaded apps to be installed in that case change your settings in the ‘Security & Privacy‘ page of ‘System Preference‘. Make sure to choose anywhere.

Choose the language and the board

Choose the language and the board

Choose the language and your version of the Raspberry Pi board

Select the stable version of OSMC

Select the stable version of OSMC

R3 is the latest stable build of OSMC Media Center at the time of making this video.

Then burn the files to the SD card. Choose the connection type; mine is wired. We will configure the network later. Choose the correct SD card and let the app download OSMC and burn it to the SD card.

Insert the SD card and all other necessary connections to the Raspberry Pi

Insert the SD card and all other necessary connections to the Raspberry Pi

After installation is complete, quit the application and eject the card. Now insert the SD card on the raspberry Pi and connect the ethernet wire, HTMI cable, power source, keyboard and mouse.

Configure OSMC Media Center to your needs

If you see the rainbow screen once you power ON your Raspberry Pi then all is good. OSMC will start installing automatically.

Configure the OSMC

Configure the OSMC

Time to configure your OSMC Media Center. Select your language and go through the basic setting process.

Set the manual IP address for the Raspberry Pi

Set the manual IP address for the Raspberry Pi

Now click on My OSMC then select network and secure IP address manually this is necessary so that when you restart your Raspberry Pi the IP address remains the same.

Setting up the NAS

To get to the terminal, let’s exit OSMC. The login and password is “osmc” in lower case without quotes. First lets install NTFS package to manage the hard disk.

sudo apt-get install ntfs-3g

Using F disk we list all the drives connected to Raspberry Pi. I have already connected my 2 TB hard drives to the Pi. You can see them listed as SDB and SDC. SDA is a windows hard disk I connected to test something else.

sudo fdisk -l
Check if the drives are connected properly.

Check if the drives are connected properly.

To mount these two hard drives to the OS we need to create two directories I named them USBHDD1 and USBHDD2.

sudo mkdir /media/USBHDD1
sudo mkdir /media/USBHDD2

Then I mount the hard disk I want using the mount command. Here SDA1 and SDB1 are the partition names inside the SDA and SDB drivers that we saw earlier.

sudo mount -t auto /dev/sda1 /media/USBHDD1
sudo mount -t auto /dev/sdb1 /media/USBHDD2

To keep things organized I created a ‘shares’ folder inside each USB folder. This folder will be the shared folder from each drive which can be accessed from other PC’s in your network.

sudo mkdir /media/USBHDD1/shares
sudo mkdir /media/USBHDD2/shares

Let’s install Samba. Samba is a file sharing application, which can help other PC talk to your Raspberry Pi.

sudo apt-get install samba samba-common-bin

If you get an error it means that we need to update our OS and we do that using this command.

sudo apt-get upgrade

Again, try installing Samba and this time. Success!

Let’s make a copy of the Samba configuration file before editing.

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old

Then use the nano editor to make changes to the configured file.

sudo nano /etc/samba/smb.conf

Scroll down to the end of the page and create share folder names. The name you give inside the square brackets will be the names shown in other PC’s. When you access this Raspberry Pi. Make sure read only set no. After making changes, press Ctrl X to close the nano editor, Press “Y”to save the changes.

Give the folder a recognisable name.

Give the folder a recognisable name.

Restart Samba to take effect of the changes added to the configured file.

sudo /etc/init.d/samba restart

Let’s create a user and a password and add it to Samba. This username and password will be asked every time you want access the share folder from other PC’s. I have set “fatlady” as the username

sudo useradd fatlady -m -G users
sudo passwd fatlady
sudo smbpasswd -a fatlady

All set. Let’s test it on by copying files into the shares folder. and sure enough, we see it displayed here in the directory listing.

The test file copied is displayed.

The test file copied is displayed.

To automatically mount both the hard drives to OS, let’s write a few lines of code.Open fstab in nano editor.

sudo nano /etc/fstab

Write these lines of code. Save and close the nano editor.

/dev/sda1 /media/USBHDD1 auto noatime 0 0
/dev/sdb1 /media/USBHDD2 auto noatime 0 0

We install rsync. R sink is a powerful tool used to make a mirror copy of a folder or a drive to another.

sudo apt-get install rsync

Restart OSMC and go to file manager inside settings to check if you can see your mounted drives.

Installing the Mobile App

Now to install the mobile app. Head over to Google play and search for Kodi. Select the correct app and install it to your device.

Kodi remote app on Play Store

Kodi remote app on Play Store

Hope you enjoyed this video. Now you can have your own OSMC Media Center and watch all those beautiful movies from one place.

Watch how the OSMC Media Center is configured:

Subscribe to our YouTube Channel

Until then Happy Learning.

Latest Comments

Leave a Reply

comment on this article