Weekend with Pi-4

Raspberry Pi is a powerful computer on a small form factor. I will show you how to exploit its full capability in this weekend project

Raspberry Pi generally falls into a category of Internet of Things (IoT). Microsoft for some strange reasons pulled its plug on Pi and does not support 3B and above with its windows IoT platform. Though there are other tools around, for a change I decided to use Raspberry Pi 4 for a Linux based project. If you have about 5 hours to spare, let us see how we could put the Pi for optimum use. We will use Pi as the server for Network Storage, run our own Private Cloud thus synchronising our Photos and documents to our cloud rather than Google / Microsoft / Apple cloud. We will use the Pi as a juke box and lastly convert that into a Home media Entertainment Server running Plex TV. Interested?

First go to Plex TV website and sign yourself for a free account. Next head to DuckDns to get a domain name registered.

Please note that throughout the article, I have not detailed complete installation process since there are many sites that describe each of these installations. I am assuming you are experts in Linux and can easily navigate and work with menus. If you are stuck or unclear, do drop me a note. I can help you out.

Operating System:

We are not going to run a desktop OS. Though that is possible, for our projects this weekend we are going to run Pi as a server. For that we will use Raspberry Pi OS (32-bit) Lite. This will provide a small foot print. I have used a 16G HC I SD Memory card to flash the OS. I am not going to go into detail of installing this OS. However here a few tips. The Pi 4 does not have standard HDMI ports for which the cables are lying around. So it will be best to install as headless server. To do that, follow this points:

  • Aflter flashing the image to SD Memory card, create an empty file called ‚Äď ssh on the root folder. This will allow access to Telenet session through ssh.
  • Create a file wpa_supplicant.conf on the root and open for editing. Add following code making appropriate changes to reflect your requirement and save.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


That's it. This will ensure you to control your Pi with a terminal session. I use Putty, readily available on the web. Finally make sure that you assign static IP address for this pi. It is very important for this project.

Open Media Vault (as Network storage)

First item to load once the OS is loaded complete these by running raspi-config ‚Äď change root password, enable ssh and whatever you think is required by you. We will first install openmediavault software. This is a straight forward installation. Here is the code for that:

sudo apt=get update
sudo apt-get upgrade
wget -O - https://raw.githubusercontent.com/OpenMediaVault-Plugin-Developers/installScript/master/install | sudo bash

This will install and configure the software. Once done we are ready to reboot. Time for connecting our external hard drives. Use the two USB 3.0 ports to connect the hard drives. The SSD (500 GB)will be used for cloud data while the 4 TB drive is used as storage for all your data & media. The storage size depends on your requirement.

Once installed you can access the openmediavault through web interface.¬†http://IPadressOfRaspberryPi¬†(your IP address of Pi. Make that static.) will open up login screen where you should login with admin and password: openmediavault. Once inside under ‚ÄėGeneral Settings' change to web port to 85 (or whatever you fancy since 80 will be used by ‚Äėnextcloud' our next project) and the Web Administrator password. Select OMV-Extras on the left column and on the right select Docker. Install both Docker and Portainer by selecting them on the top.

Under Filesystem make sure your hard disks are mounted. If not mount them. Then head to ‚ÄėShare Folders' to create a share for your Harddisk mounted. (do not create any share for SSD. This will be used for Nextcloud and cannot be shared). Once done, click on SMB/CIFS to create a SMB share. Once done, you should be able to see the share in your network.


This is the easy part. Once you have the SMB setup working it will be lot easy to share your files across your network. Your music collections can be streamed across the network with a simple setup. All you need is an old phone and a Bluetooth speaker.

Load VLC player on the phone. Select Networks in VLC player. Add your network to the favourite (this is required due to a bug in VLC that does not save password unless it is in favourite). Connect your phone Bluetooth player. If you do not have Bluetooth player or if your phone does not support then use Auxiliary port. You have a great Juke-box player, that can stream music for all your party needs. (Of course you should have Music loaded on your Hard drive).


Nextcloud allows you to setup a private cloud and access your data from any media anytime, anywhere. A simple cloud based service running in a docker. Once installed you can access your 4TB of data from anywhere. Log into Pi server using Putty and create a file docker-compose.yml with following entries: Make sure you modify the contents to reflect your environment.

version: "2"
image: linuxserver/nextcloud
container_name: nextcloud
- PUID=1001 #change PUID if needed
- PGID=100 #change PGID if needed
- TZ=Australia/Melbourne #change Time Zone if needed
- /srv/dev-disk-by-label-disk1/appdata/nextcloud/config:/config #/srv/dev-disk-by-label-disk1 needs to be adjusted to the mount point of your SDD
- /srv/dev-disk-by-label-disk1/appdata/nextcloud/data:/data #/srv/dev-disk-by-label-disk1 needs to be adjusted to the mount point of your SDD
- mariadb
- 450:443
restart: unless-stopped
image: linuxserver/mariadb
container_name: nextclouddb
- PUID=1001 #change PUID if needed
- PGID=100 #change PGID if needed
- MYSQL_ROOT_PASSWORD=password #change password
- TZ=Australia/Melbourne #Change Time Zone if needed
- /srv/dev-disk-by-label-disk1/appdata/nextclouddb:/config #/srv/dev-disk-by-label-disk1 needs to be adjusted to the mount point of your SDD
restart: unless-stopped
image: linuxserver/letsencrypt
container_name: letsencrypt
- PUID=1001 #change PUID if needed
- PGID=100 #change PGID if needed
- TZ=Australia/Melbourne # change Time Zone if needed
- URL=yourdomain.duckdns.org #insert yourdomain with the domain name you have registered with duckdns.org
- EMAIL[email protected] # define email; required to renew certificate
- /srv/dev-disk-by-label-disk1/appdata/letsencrypt:/config #/srv/dev-disk-by-label-disk1 needs to be adjusted to the mount point of your SDD
- 444:443
- 81:80
restart: unless-stopped

Now to deploy the docker. This is done by the following command:

sudo docker-compose up -d 

This will take a while to install. Once finished ensure all is OK. While this is in progress head to your router and make following port forwarding. This depends on the router you have and beyond the scope of current article. is my static IP of Raspberry pi. This will differ in your setup

docker logs -f letsencrypt

Typically there should be no error. Now following steps are required to finalise Nextcloud setup.

Copy the sample conf to conf for proxy to use. As usual change dev-disk-by-label-disk1 in the command line to your mount point of SDD

sudo cp /srv/dev-disk-by-label-disk1/appdata/letsencrypt/nginx/proxy-confs/nextcloud.subfolder.conf.sample nextcloud.subfolder.conf

Then edit this file. use nano or vi and look for this line.

proxy_max_temp_file_size 2048m;

change that to

proxy_max_temp_file_size 1024m;

Next we need to modify config file. replace dev-disk-by-label-disk1 with your SDD mount point

nano /srv/dev-disk-by-label-disk1/appdata/nextcloud/config/www/nextcloud/config/config.php

Add following lines at the end but just before the ‚Äú);‚ÄĚ

'trusted_proxies' =>
array (
0 => 'letsencrypt',
'overwritewebroot' => '/nextcloud',
'overwrite.cli.url' => 'https://yourdomain.duckdns.org/nextcloud',
'trusted_domains' =>
array (
0 => 'yourdomain.duckdns.org:443',

replace yourdomain with the domain name you have registered with duckdns.org. Save the file and restart letsenscrypt

docker restart letsencrypt

Re-run the following command to ensure no errors:

docker logs -f letsencrypt

Now restart nextcloud and you are ready to go:

docker restart nextcloud

https://yourdomain.duckdns.org/nextcloud¬†will be your nextcloud address. Your own private cloud. First tme you start you need to provide a username and password, for access. Also need to setup the database. To do this on the welcome screen: click on ‚ÄúStorage&Database‚ÄĚ, select MySQL/MariaDB. Enter following details

Database user => rootDatabase password => password (or the one you used in the docker-compose.yml)Database name => nextcloudlocalhost host => nextclouddbThat's it. You have your own cloud. you can go ahead and clicking on the top rightmost screen you should see settings, Apps, Users, About, Help & Logout. Go about and create your own users.

To access your local storage of 4 TB there are couple of steps. Select Apps and on the left column select Disabled Apps. then on the right colum select ‚ÄúExternal Storage support‚ÄĚ and enable this application. Once enabled go back to settings and on the left column go to External Storage Support. I have provided a screen shot that explains this configuration

Now clicking on the folders on the top left icon you should see the external storage. You have your 4TB of data in your cloud that can be accessed from anywhere.

Plex TV ‚Äď Private Home enterntainment Media Server

With the most modern TV, Plex is already included as application. While Plex offers variety of entertainment free, you can also stream your own private videos, musics and photos from your collection. Installing Plex media Server is very easy. First make sure you are registered with Plex. This will enable you to access your media from anywhere. Here are the steps for Plex installation:

sudo apt-get install apt-transport-https
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
sudo apt-get update
sudo apt install plexmediaserver

Once done, restart the pi server. To test the Plex, go to http://youripaddress:32400/web/ to access the Plex server. First thing you need to do is enable Remote access.

Enabling this will allow us to log in from Internet. Head to https://app.plex.tv/ log in with your account and click on launch. You should be directed to your own Plex Media Server. Use Manage Libraries to add your media files to Plex Media Server.

Now you are all setup. Remember that Plex server takes a lot of processing power during initial media configuration. Wait until this is complete before fully accessing. Else you will find a drag in all your operations.

Hope your project works as expected. If not please feel free to send a note. Have a good weekend.

Source: Weekend with Pi-4

About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top