# How to Setup a Nextcloud Server on Chromebook and USB-Hard Drive The chromebook server was predicted already in 2005 by George Lucas through the following lines from *Revenge of The Sith*, Obi-Wan: *You have allowed this **Local computing** to twist your mind until now... until now you have become the very thing you swore to destroy.* Anakin Skywalker: *Don't lecture me, Obi-Wan. I see through the lies of the **Cloud**. I do not fear the **Server** Side as you do!* I started this project because I was given the school supplied Chromebook, which I used throughout High School, upon graduation. I had no use for it and wanted to ''Degoogle''' my life. I also received a (already at the time) 6 year old Hard Drive from my High School, at which point I had something with a performance that was significantly better than an Raspberry Pi and also had a build in battery which would make it more resilient towards power outages. ## How to Use This Guide This guide was written in 2021 and worked then. It is mostly a general outline of the process, with some links to references to relevant tutorials. *Reference links* [Discussion about BIOS in Chromebooks](https://www.reddit.com/r/chromeos/comments/cijg3b/access_chromebook_biosuefi/) Nowadays, there are a lot of different Chromebook models. All of this worked on my Chromebook (HP Chromebook 11 G4 from mid 2015), but some steps will naturally change for other models. A few general lessons I have learned throughout my research, Chromebooks usually do not have a UEFI-BIOS (MUCH easier to work with, common for ''normal'' (i.e. Windows) laptops), but rather some alternative bios which only boots ChromeOS. You could try and and update the BIOS to add more functionality (with 3rd-party firmware), but in this tutorial, we will not be doing that. Also, since a Chromebook usually ships with way to little storage, we will be installing everything on a external hard drive (i.e. we will not install the OS on the Chromebook itself), this should make it easy to boot up from that hard drive from some other device in case you want to upgrade the server hardware (the con is that it will be a little bit trickier if you ever want more storage). I will only be noting the general steps to transform the Chromebook to a server, and will refer to the articles I used for details. Also, if some tutorial want you to use a F-key, then just try all top row keys instead, they might be programmed in a different order. ## Booting from USB-device on Chromebook *Reference links* [Enable USB Booting on Chromebook](https://www.wikihow.com/Enable-USB-Booting-on-Chromebook) (F3 may have another symbol on your model of Chromebook, for me it was a reload-symbol) There are lots of good tutorials out there, although this might be frustration, so an outline : Enter developer mode (this might vary from model to model!) from warning screen proceed with Ctrl + D, then go in to the shell (Ctrl + Alt + F2 (←)) when you have booted to the OS (Don't login to Chrome OS!) and login (to the Shell!) with either crout or root user without any password, then set dev_boot_usb=1 (using sudo if necessary) Restart with reboot and enter USB-boot-menu with Ctrl + L or Ctrl + U (Put a Post-it on the computer with this command written on it, you'll have to remember it to access the boot menu!). ## Installing Ubuntu Server on The Hard Drive *Reference links* [Download Ubuntu Server Create Bootable USB (Ubuntu)](https://ubuntu.com/tutorials/create-a-usb-stick-on-ubuntu#1-overview), [Change Time Zone](https://linuxize.com/post/how-to-set-or-change-timezone-on-ubuntu-20-04/) All this could be setup on another computer, and then just plug the finished hard drive to the Chromebook, but for the sake of clarity, I'll refer to it as everything being done on the Chromebook. My preferred OS for this is Ubuntu Server (20.04 LTS at the time of writing), since it is Debian based (similar to Raspberry Pi OS) and well documented on forums, you could use something entirely different, but if you want to followed guide to install Nextcloud later, use something Debian-based. Download the ISO-file from the Ubuntu website and create a bootable USB-drive (The linked tutorial uses tool in (normal) Ubuntu, there are other tools such as pendrive for Windows). Important to use two USB-devices, one USB-stick with an image of Ubuntu on it (which has to be connected with USB 3 to Chromebook), and the hard drive (USB 2 or 3) (you can do it using only the external hard drive, but that makes it harder to keep track of partitions). Follow the installation prompts without doing anything special, except enabling ssh by checking ''Install OpenSSH server'' (otherwise, you'll have to install it manually later). When you come to the part of the setup where you chose where you will install the OS, make sure that the first drop down menu has the USB hard drive! It will most likely create two partitions, but you just want ubuntu-lv-partition, delete the other one and make sure the root ( / )-partition has as much storage as possible (otherwise the storage will be inaccessible, you can change that after the fact, but it is quite tricky, do it right the first time instead!). I formatted my entire external hard drive to ext4 (file system used by Linux) before the installation, but you should be able to format it as ext4 from the OS-installation menu. When you have successfully booted in to the OS, you may want to press enter a few times and wait some before the correct login screen shows up. While you're at it, make sure it has the correct time zone. ## Setting it up for SSH *Reference links* [Connecting to Wifi from Ubuntu Server](https://medium.com/@yping88/how-to-enable-wi-fi-on-ubuntu-server-20-04-without-a-wired-ethernet-connection-42e0b71ca198), [Change SSH-port](https://www.ubuntu18.com/ubuntu-change-ssh-port/) If you're as lucky as I was, your Chromebook has no eth0 (ethernet port), i.e. we'll have to make do with connecting over WiFi (if you are lucky enough to have one, or some adapter which works, skip this step). Note that Ubuntu Server does not ship with the tools required to actually connect to a WiFi without installing additional packages. As such, we'll have to transfer them from another computer via USB as .deb files. You'll have to mount the USB-drive to access the files, and then install them from the files. You can see which network interfaces are available with ls/sys/class/net (beware that 1 is not the same as l). Just the one that starts with w is your wireless-adapter. Remember to turn off DHCP4/DHCP6 to get a static local IP-address. When you're at it, you should probably change to ssh-port if you plan on exposing the server to the web, use some random four or five-digit number, such as 4444 (a lot of bots on the internet are trying to connect to port 22 (default for ssh), which can be a security risk). Now, from another computer, ssh to the Chromebook server (using putty for Windows), from Ubuntu you want to use the command ssh USERNAME@LOCAL-IP-ADDRESS -p PORTNUMBER ## Make It Feel Like a Server We probably want to be able to close the lid on the Chromebook without it shutting down/entering standby (which won't work since we haven't overwritten the BIOS). Also, rebooting will be annoying since we will have to physically press Ctrl + L or Ctrl + U on the Chromebook to be able to enter the boot-menu, i.e. we have to have physical access to the device every time we want to reboot. We can turn of standby adding the following lines to /etc/systemd/sleep.conf ``` # Settings for /etc/systemd/sleep.conf AllowSuspend=no AllowHibernation=no AllowSuspendThenHibernate=no AllowHybridSleep=no ``` Now you can safely close the lid (may have to reboot first), plug it into the power brick, put it away and only access it through ssh. This is the last Chromebook-specific part of this tutorial, the rest is just links to some general things you will have to do to make it a Nextcloud-server. ## Installing Nextcloud *Reference links* [Install Nextcloud on Raspberry Pi](https://pimylifeup.com/raspberry-pi-nextcloud-server/), [SSL with *Let's Encrypt*](https://pimylifeup.com/raspberry-pi-ssl-lets-encrypt/) There is a extremely well written tutorial by PiMyLifeUp, follow that, but change all php7.3 to php7.4 (or which one is the newest). Also install php7.4-bcmath. Don't worry too much if a few packages are missing. If you want to expose the server to the internet (not only your local network), you should request a public IP-address from your ISP (lots of them offer that for free, the ''private'' IP-addresses are used since there isn't enough IPv4-addresses for everyone), then you will have to login in to your router and enable port forward from port 80, 443 and SSH-PORT to 80, 443 and SSH-PORT on your servers local IP-address. Thereafter, buy a domain name and secure it with a certificate from Let's Encrypt (which is free!). Now you should be all set! ## Useful Keywords If you are new to linux in general, I would advice to read a little bit about the following topics to make it easier to navigate relevant tutorials BIOS (UEFI), Hard Drive Partitioning, File Systems (Ext4), SSH, Linux Distros (Debian, Ubuntu), root user (sudo), Ubuntu vs Ubuntu Server (Desktop Environments), ISO-files, local/private/public IP-addresses, IPv4/IPv6, ports (port forwarding), SSL (https), systemd