Personal Cloud Project

August-October 2019

Overview

Setup a LAMP (Linux Apache MySQL PHP) stack server on an old MacMini
Networked my home WiFi router to allow self-hosting on my server
Configured Nextcloud open-source cloud software as front end for the cloud server

Why Make a Personal Cloud? (My Tech Rant)

I don't have a nice laptop or computer. Instead of having one nice computer I have a varieety of trash technology, tech that others are getting rid of because they are old or semi-broken. So I never know when the computer that I am using will kick the bucket. So backing up my documents to a cloud makes sense. Also I use more than one computer at once. So maybe I'll bring my small MacBook Air to school to take notes, but use my Linux Mint machine for homework, and then I will unfortunately need to boot up Windows to run Solidworks. So having a directory that works on all of them means I don't have to worry about transfering my files by email or with a USB stick.

You may be asking, "Well why not use Google Drive or One Drive?" Well, it's not really the classic Google is Evil thing. I prefer to invest (mostly time since I have no money) in things that I control how long they last. Google Drive is pretty reliable but you never know when Google will decide to charge you for cloud space, or quit the service because of a new one they are developing (like Google Play Music is doing as of writing this). If I have my own cloud then its up to me when it dies. Also almost everywhere charges for cloud space, and like I said before, I've got no money but a lot of old computers. And why not One Drive... that shouldn't even be a question.

What It Takes to Make a Cloud

When I started the process of making the cloud I researched and found this nice open source software called OwnCloud. Cool, I'll take one of those, now how do I download this.... Well, it's not that easy. Step 1: Have a LAMP stack. And that's when I knew this wouldn't be as quick as a software download.

There are three main steps to making a personal cloud: make a LAMP (Linux, Apache, MySQL, PHP) stack, configure the cloud frontend software, and host the cloud for networking.

Disclaimer: I am not claiming to be a professional cloud maker. This following tutorial/satire is intended to provide a general summary of what I did, and hopefully make what could be a boring tutorial something fun. If the words I use or steps I explain aren't perfectly accurate or misunderstood I apologize, this is how my head tried to make sense of the countless stackoverflow forums I read.

Step 0: Setup Your Ancient MacMini for Linux

I thought that having experience dual booting many old and new computers with Linux, messing with BIOS and UEFI, dealing with unsupported WiFi cards, and fixing grub in every imaginable way would have given me an advantage overwriting MacOS on my 2011 MacMini with Ubuntu Server (the L in LAMP stack). But I should have known that no matter how many times you've done this you will always run into new problems. This time it was the mac not recognizing the live usb, internet connectivity issues, and the new challenge of setting up the ssh. The ssh was my way of fixing two problems at once. Instead of connecting to WiFi I would just keep the MacMini plugged into the router, but since that wasn't in my room I would want to remotely connect to it from my laptop. Setting up the ssh meant assigning the computer ethernet connection to be a static IP address and reserve the IP address.

Step 1: Make a LAMP Stack

This step is the backend of the server, the actual functional part of the server. Everything else is just being able to access the server and making it look nice.

Linux: The operating system that runs everything else

Apache: This is the part that communicates with the browser you access the cloud with

MySQL: This is the database layer. Basically it is what manages your database

PHP: This is the scripting layer that runs the web commands

I actually found a slough of good tutorials for setting this up. It did take me a little while, and I had to restart the process because I forgot my MySQL password within 10 minutes. But overall it wasn't too bad. It was completely setup in the terminal so I learned about some new commands with this. I wanted to make my own tutorial for this so that I could do it again later, and remember what I did without having to go to as many tutorials but I forgot to. If I do this again I'll take better notes.

Step 2: Configuring Cloud Software

Again for this one I wish I had made a tutorial for this, but after many days of piecing together tutorials I set up OwnCloud. And then right when I had it set up and working on my local network, I read this great article about how OwnCloud wasn't really supported anymore and it would be much smarter to use NextCloud. Why hadn't I read that sooner.... So I had the joy of restarting the process and setting up NextCloud. The installation was similar, but having out of date chunks of OwnCloud left on the machine did mess some things up. But, alas, I figured it out and I had a running cloud. But I could only get to my cloud from my house, so more of a low lying fog. On to step three.

Step 3: Set Up Self-Hosting on a Household Router that Isn't Intended for Hosting

I made it this far in the project, and life, without understanding how WiFi, IP addresses, networking, or the internet works. And now I would have to learn. Through much research and domain name sites spamming me with offers I figured it out at least enough to work. Here is my overly simplified, and possibly flawed, understanding of what needed to be done.

I needed somewhere to store my files and data for my cloud, this is the host, and this was the MacMini that I had been working on so far. Done.

Then I needed a way for my WiFi router, basically the receptionist for my house, to know what computer to send people looking for my cloud to. This was basically the same reserving of the internal IP that I did for the ssh, just with a different port. The port is so that your receptionist knows what job each device in the house does. So when someone is looking for an http website the receptionist knows who to send them to.

Now, how does someone know to contact your receptionist? This is because your receptionist has a phone number that is associated with your house. This is the public IP address, a long list of numbers. In an ideal world, where I am not trying to make this work with my residential router, I would have one phone number for my house. But I don't. Everytime my receptionist goes to sleep, logging off from my internet service provider, the phone number, IP address changes. This was a pain because it's not easy to reliably contact someone who keeps changing their phone number.

I needed to set up a dynamic dns service that would basically update the internet phone book each time with my new phone number. Most of these services are not free, so queue a long search that always ended up trying to give me deals for paying for these services. Finally I found one that worked for free.

The final thing to setup was to give myself a nickname. It wouldn't be really easy to have to type the long phone number, public IP address, each time I wanted to connect to my cloud. This is why people have contacts saved in their phone. This nickname is a domain name, like walnka.com. Finally I would need to spend money on this project. The reason I didn't mind paying for this is because it would only be around $10 a year, and I figured having a domain name would be useful down the road. Which it was, since I am using it for this portfolio website too.

Now finally all I had to do was type in my domain name into the browser and all the phone number and receptionist stuff worked in the background. Finished...

Going Further because I Can... Or Can I?

I had successfully made a functioning cloud that was actually a very handy tool. It was reliable enough for me, although it was a bit of a problem when my roommates unplugged and replugged in the WiFi router to fix it, since I had to restart the cloud each time.

But, I just couldn't stop there. I did a few changes that made the cloud safer, https, and tried to update it to the most recent version, which didn't work all the way since I wasn't on the newest version of Ubuntu Server. But the big thing was to try and setup a Google Docs like app on my cloud. Why did I need this... not sure, but it sounded cool.

I wanted to setup Collabora with my NextCloud server, which is doable, but not easy. Especially since I just couldn't get dockers, and easy way to run it, to work. Collabora is supposed to be run on a seperate port, but I was already using the default port for the very beginning stages of this website. So I diverged from the tutorial and defaults and started running into problems. The end was near. While trying to fix these problems something happened, I still don't know what caused it. When restarting the server I couldn't type my username to log in. The keyboard just didn't work. I narrowed it down to something to do with the kernel, since I had to download a newer version that wasn't available on the main repository yet. Eventually trying to fix that my issues grew large enough that I should just restart the process and start fresh. This time with the newest version of Ubuntu Server, no OwnCloud fragments, and the newest version of NextCloud.

A Fresh Start?

So months later when I had the chance to work on this project again I went back to Step 0, Setting up my MacMini for Linux. Guess what, I found a problem with setting up Linux. It never ceases to surprise me. The computer wouldn't recognize the live USB, but I've solved this before, do you think those same solutions that worked a few months ago would work this time... nope. This is where I am now. I have two ideas for how to salvage this project beyond using a different computer to build the cloud with. One idea is outrageous and probably has no tutorials, and the other is to try the same thing over and over again and expect different results. So for now I'll leave you with a cliff hanger, will I give up or will I perservere?