Install fresh Raspbian image on your Raspberry Pi - part 2
Marco Franssen /
8 min read • 1594 words
In the previous blog of this series I explained the basics of getting a fresh installation of Raspbian on your Rapberry Pi including SSH access and configuration of a static IP for your Wifi. In this blog we are going to have a look at tweaking it a little further to get a better commandline experience and have some more tooling available to operate your Raspberry Pi.
Admin experience and tooling
On any server I will most likely always work with Git and Vim. I have many of my bash scripts and utilities committed and versioned in Git repositories, to be able to easily use them, I want to be able to clone these Git repositories. Secondly my preferred commandline editor of choice is ViM, for which I also have a nice configuration in Git with nice theming and coding plugins.
I also make some tweaks to my bash shell to improve the convenience of using it.
Lets start with installing Git and ViM.
The first thing I always want to do is configure my ViM to have a similar experience on all servers I'm accessing. For that I made a shell script which is publicly available for you and can easily be installed by making a curl request and pipe it to bash as following.
Next I always want to have Git available which allows me to pull my repositories with my scripts etc. Me was not me if I wouldn't have a config for my Git setup as well.
My Git config has some nice aliases available to speed up my Git commandline experience.
To improve the experience with arrow-up and arrow-down keys in bash I always apply following .inputrc.
Mount NFS shares
As your Raspberry doesn't have a lot of storage capacity on the SD card you would have 2 options to have more storage mounted on your Raspberry Pi. First and most easy option would be to connect an external disk to your Raspberry. Second option would be to mount an external volume to your Raspberry Pi. Lets have a look on how to mount an external volume on your Raspberry Pi. Below I will show you an example how I mount my 3 shared folders from my Synology NAS which I will expose to my Raspberry Pi so Kodi can use them. More on Kodi later. In case you need help on setting up NFS shares on your Synology check out this manual.
Assuming we have 3 nfs shares available we make 3 folders on our Raspberry Pi to mount them.
Above script first ensures we have the latest nfs-common package installed. Then we create 3 directories for the 3 NFS shares I want to mount.
Now having the directories for my mounts available, I will first update /etc/fstab, which takes care of mounting the directories automatically on next boot. I'll also mount the drives now manually so I don't need to reboot.
Ensure to replace above IP address with your own and also adjust the folders to point to the NFS shares you have on your own NAS.
Now I have access to the files on my NAS I'm ready to install Kodi. I will also create a user for Kodi to have a more secure setup.
Most important is to add Kodi to the audio and video groups so it has permissions to use the audio and video devices, as well add the input group if you want a keyboard to work. More on groups on a Debian based OS can be found here. You might find some guides that also add the user to plugdev, but as I do the nfs mounting outside of Kodi this isn't required. By doing nfs shares on the OS level I also found slight better performance then doing this via Kodi + the advantage of being able to access the shares outside of Kodi.
First thing I want to do is ensure Kodi automatically boots when my Raspberry Pi boots up. For that we will add a systemctl service. Below bash script will create the service file for systemctl.
As you can see this service will boot Kodi using the kodi user we created.
Now it is time to enable the kodi service and start Kodi.
After a reboot the systemctl service will automatically boot Kodi for you as we enabled the service.
Now we have Kodi installed and running we can start to configure Kodi. Although we could do all of this via the GUI I prefer to configure it via the terminal as that makes it faster for me.
I always enable the webserver which allows me to use my Mobile App as a remote control for Kodi. When Kodi starts for the first time, it will create a folder in your home folder named .kodi. In this folder you will find all kind of xml configuration files. As we started Kodi using the kodi user you will find it in /home/kodi/.kodi.
In the guisettings.xml file you will be able to enable the webserver. Below bash command will update the given setting to enable the webserver.
You might prefer different settings, but at least this gives you an impression on what you could automate on your personal setup.
Secondly I will configure the Kodi sources.
As the sources.xml is freshly created I need to ensure it is owned by the kodi user. With above configuration we have added my music library, my photos and my home video folder as a datasource to Kodi. This allows me to enjoy all my family moments on my TV with some nice music :-). Feel free to add more sources to your Kodi in case you have them. E.g. your TV shows and Movies can be added as well. So now last step is to reboot Kodi once to ensure we have the configurations applied.
Thanks for reading this blogpost and enjoy your Kodi setup.
You have disabled cookies. To leave me a comment please allow cookies at functionality level.
I see many struggle when it comes to using Secure Shell in a comfortable way. Many are installing unneeded applications like Putty on Windows for example. Just like I did 4 years ago. Over the years I have been working a lot on servers where there was no GUI available and learned a lot doing that. I would like to share my tips and tricks so you can also be empowered by just sticking to the terminal on your OS or simply using Git Bash on Windows.
What is SSH
The SSH protocol (also referred to a…
In this blog I will cover how I'm managing and versioning the tools my Go projects depend on. Go Modules are available since Go 1.11. Using Go Modules you can manage the dependencies for your project. You can compare it to NPM in Nodejs projects or Maven in Java project or Nuget in .NET projects.
In general Go Modules are used to manage your compile time dependencies. However in my projects I also like to manage the tools required for Continuous Integration in my projects. To ensure all develop…
In my last blog I shown you how to upgrade from Raspbian Stretch to Raspbian Buster. As the whole upgrade went smooth it seems there are still some issues with Raspbian Buster. The one which blocked me completely was the ability to run Kodi. Kodi was not able to start due to a GUI error. Therefore I decided to switch back to Raspbian Stretch until Raspbian Buster packages catch up.
Before you start a fresh install make sure you have an ethernet cable at hand, as we will need it…
In this blog I want to note down in the shortest way possible how to upgrade your Raspberry Pi from Raspbian Stretch to Raspbian Buster.
First check your current version of Raspbian is Raspbian Stretch. The easiest way to do this is enter the following in your terminal.
In case it states version 8 (jessie) you can check out following blog first to upgrade first to Raspbian Stretch from Jessie. In case your output is version 9 (stretch) please continue below.
First I ensure at least all patche…