This article is a continuation of a previous companion article I wrote about how to setup a Raspberry Pi Model 4B 8GB as a Metaverse Server for your VR headset on the home network.
Setting Up A Raspberry Pi As A Home Metaverse Server For Your VR Headset!
After posting this article I received many questions about what is this for? Why would you want to do this? Well, these…
If you have successfully completed all the steps in the above article you may continue, carefully.
PLEASE DO NOTE: I can’t take responsibility, if you get stuck, or wrongly configure your network, or zap the life out of your little Pi, or leave security holes open. Or any of the other things that could go wrong along the way. That’s my disclaimer, upfront and center, you take full responsibility for your actions while carefully following these instructions in this article. By following the steps in this article you consent to this agreement.
Alright, Great and congratulations again for getting through that previously long article. This one I think will be less work, and much more fun!
Step 1: Overclocking Your Pie On Ubuntu (Optional)
First, I have to say this can be a little dangerous. You could fry (burn up / over heat) and damaged your Pi SBC permanently. So again, you take full responsibility for your own actions in following these instructions carefully.
Now there are a lot of articles out there on how to overclock a Raspbian or Raspberry Pi OS. We are a Ubuntu Server 20.04 64bit OS. So we can’t use those. However, there is always a way.
What I would like to do first is take a few metrics, current CPU frequency, and temperatures. We are going to use #3 Hardinfo to do that, which was the only one I was able to get working properly.
So, at the terminal type the following:
sudo apt install hardinfohardinfo
Take a look at your numbers, maybe even photograph them with your phone, so we can compare them later to the overclocked versions.
Here where mine:
Now open up the /boot/firmware/config.txt file in say Sublime editor and add the following lines carefully under the [pi4] area as shown in the photo below:
Double check everything over carefully, and save. Now logout, and power down and up your Pi for the settings change to take effect.
If all is good, your Pi should be running well, and faster, if a little bit warmer. Since, I don’t have an active fan, but a passively cooled case with large heatsink, I decided not to risk it and go any faster. I personally didn’t like the noise of a constantly running fan where I had my Pi located in the home.
It’s up to you, and again at your own risk. Check your numbers now with hardinfo. I noticed my Pi was a little faster overall, still stable as far as I could tell.
Mine where (at idle, not under load):
1800 MHz for each of the four cores. Slightly varying temperatures at my sensors. House temperature in Celsius at the time of measurement was 20.56 degrees.
Step 2: Cloning The OS To A Faster SSD (Optional)
Up to this point we have not made a backup of all the work we have done. It would be a loss of effort if something were to go wrong, and the OS became corrupted and unrecoverable. If we had a backup, you could recover at least to this point!
So let’s make a clone backup.
You’ll need to logout and power off your Pi. Remove the micro SD. Using another computer, download and install Balena Etcher for your specific computer. It can be found here.
We are going to clone the micro SD to a USB SSD drive for faster and more long lasting access (suggest reading ahead before actually doing it).
Using the Clone option, in Balena Etcher duplicate your micro SD image containing the Pi’s Ubuntu Server 20.04 64 bit OS to a USB SSD drive of same, or more likely larger capacity.
For this step you’ll need another additional fast capacity micro SD ready for the original Pi Raspbian OS. You can reuse it later as another backup of your current Pi’s Ubuntu Server OS. But, forget that for now.
You will need to prepare a version of Raspbian OS 32 bit on this additional micro SD card. This is because we need commands that appear to be only available on Raspbian OS 32 bit to be able to setup the SSD for storage access and speed. Use the Pi imager for this.
Just to check, you should have three things: your original Ubuntu Server micro SD card, a cloned version of that card onto a USB SSD drive, and another micro SD card with Raspberry Pi OS. Onward . . .
Now, have your Raspbian OS 32 bit micro SD booting in your Pi . . . After logging in, open a terminal to type:
sudo apt updatesudo apt full-upgradesudo rpi-updatesudo reboot -now
Watch and follow the instructions in the video below only from 3:09 mins to 4:03 mins.
Now power off the Pi. Remove the Pi’s Raspbian OS, we are done with it. Insert your original micro SD Pi’s Ubuntu version and also connect the USB SSD to one of two blue colored USB sockets. Power on the Pi.
I was unable to get the Pi to boot to the SSD without the micro SD installed for Ubuntu Server, however it does access the SSD for the OS, which means it will last longer because of drive wear leveling.
I’m not sure why? Maybe possibly because I formatted with exFAT rather than Fat32. But, I will work on getting the Pi to boot without the micro SD card installed, and update this step in the article, when I can figure it out! Meanwhile, file read and write access should be improved. This video may be helpful in figuring that out . . .
Step 3: Using Apache To Server A Cool VR Enabled Front Page
Now we are going to be adding a front page VR menu and pages in between for launching into Node.js webserver on port 3000.
On the Pi in a terminal type
sudo chown -R 777 /var/www/sudo chmod -R 777 /var/www/cd /var/www/html/curl -o PiMetaverseServer2.zip "https://rocketvirtual.com/PiMetaverseServer2.zip"lsunzip PiMetaverseServer2.ziprm -f PiMetaverseServer2.zip
To make it work for your Pi setup open in Sublime and edit each of the following four (4) html files at /var/www/html/:
In each of them replace YourDomainName.com with the domain name you purchased and setup in article one. Then save each file.
It should have a nice VR Menu page. Congratulations! Your almost done . . .
Now in a browser inside your network, and on the outside internet, test the following URL. Replacing your domain name.
Note: I had a small problem with Chrome browser wanting to continue to do a redirect, when the file no longer existed to do that! I solved it on, Chrome only by following solution number 205 (third answer down). There was no problem with other browsers such as Firefox.
You’ll want to edit your index.html file to customize it further, such as replacing with your site name. But that’s it now. I’ve included some large video files in the /assets/video/ directory we will use in an up coming exercise. If you don’t want them, you may delete them.
Step 4: (Totally Optional) Setup A Drupal CMS For Website And Quick Page Creation
In the feedback I received from the first article, some people felt that the Drupal CMS was not necessary, and too slow for the Pi. That may be true for versions 8 and above.
However, I found a minimal version of Drupal 7 with all the latstest security patches to be effective, and ultimately time saving. Allowing me to edit and create pages with links for my VR headset (avoinding having to type long URLs inside VR). Also, without having to log into the backend of the Pi OS to edit a web page.
Of course, Drupal 7 requires some upfront learning to use effectively, there is that, and it may not be for everyone. It is terribly well documented.
If you still don’t like the way it’s fronpage looks, even after installing a theme, you can also always put a Bootstrap front end page in front of it to make it look even better. Finally, Drupal has a built in login system for managing users as well, which you can leverage for forums and followers, etc.
Now that I’ve sold the CMS idea, remember this is a completely optional step, and requires setting up a database. Remember the root password I asked you write down in the first article?
Finally, if you plan on doing the Drupal install and setup configure, it is long and complicated and you might be best at backuping your current setup before attempting it.
Setup is detailed and is outside the scope of this article. Good luck.
Finishing It All Off
Congratulations, great work!!! You now have a full fledged development environment for VR experimentation.
Don’t forget to change the permissions on the /var/www/ directory after you are done editing to secure your website. As is best practice.
Thank you for your readership. Clap me up, if you like this article, and follow me for future articles on the Pi Metaverse Server project.