Installing NextCloud
Resources
https://landchad.net/nextcloud/ https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
Motivations
I am a terribly organized person. I have multiple notebooks with todo lists, random sticky notes, loose papers, and physical calendars all scattered across my desk. In an attempt to streamline this, Nextcloud’s calendar app looked very appealing.
Needless to say, I want to own my data, and that is why I didn’t take to easy route of using Google Calendar. I try to distance myself from Google as much as possible, even opting for custom roms such as GrapheneOS. I don’t like my data tracked/stored/sold by third parties without my best interest, which is a big reason for my interest in self hosting.
Use Cases
I need a method to synchronize my contacts, calendar, notes, and some files across my multiple devices. I have utilized tools like Syncthing in the past, but this limits synchronization to only when I am on my home network (and I do not want the security risk that comes with port forwarding). Therefore, Nextcloud’s simple user experience and seemingly unlimited extensibility were the deciding factors.
Install
Creating the DB
These are the dependencies you need to install first:
apt install -y nginx python3-certbot-nginx mariadb-server php php-{fpm,bcmath,bz2,intl,gd,mbstring,mysql,zip,xml,curl}
systemctl enable mariadb --now
This will begin the process of creating the SQL table and guide us through some questions
mysql_secure_installation
Here is where the problems started to happen.
Bashing the enter key didn’t work (like I usually hope it does to “fix” problems). I was totally confused as to which root password it was referring to, I had not created one for the database so I just kept inputting the root user password, but that didn’t work.
At this point, I remembered the commonly reoccurring conversation I have with my roommate. I took some deep breaths, and decided to enter the Stack Overflow realm.
“Just copy and paste the error code u noob”
After scrolling through this stack overflow page, I tried using the installation command by prepending
sudo
, and it subsequently worked. Shoulda tried that first :/
Generating the Cert
I was having issues with the certbot
command on the guide, needless to say I forgot to put the correct domain.
After requesting the cert, I was unsure whether my current cron job would work correctly to update all subdomains of the
sideisec.xyz
domain. A quick dive in to the certbot docs led me to find this
renew
acts on multiple certificates and always takes into account whether each one is near expiry. Because of this,renew
is suitable (and designed) for automated use, to allow your system to automatically renew each certificate when appropriate. Sincerenew
only renews certificates that are near expiry it can be run as frequently as you want - since it will usually take no action.
This tracks perfectly with the cronjob I configured in the initial setup of my website. So nothing to change there!
Nginx Config
At this point, I needed to create the nginx config file for the Nextcloud installation. After reading through the documentation provided by Nextcloud, I decided to use the webroot approach, since I want the url to my Nextcloud instance to use a subdomain that looks like this
https://nextcloud.sideisec.xyz
and not like this
https://nextcloud.sideisec.xyz/nextcloud
This means my config will be placed in /var/www/nextcloud
Then I created the directory
sidei@my-website:~$ sudo mkdir /etc/nginx/sites-available/nextcloud
I was confused at this point where to put the config file, but then I realized I should have created a file, not a directory. This file will hold the php nginx config for nextcloud.
I copied the php config from here and made sure to to replace all the example domains with my own.
Then I enabled the site by linking the config to \etc\nginx\sites-enabled\
Now to Install NextCloud
This part seemed the easiest at first.
wget https://download.nextcloud.com/server/releases/nextcloud-31.0.3.tar.bz2
After getting this error, I realized I had to first install bzip2 to extract the package
Also, I incorrectly set the link to the
sites-enabled
directory, instead of the nextcloud file inside the directory. This caused a problem with I tried to restart the nginx service. I cleared this issue by deleting the previous link and replacing it with the proper one.
sidei@my-website:~$ ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/
I then enabled php8.2, and reloaded nginx, and went to go look at my finished site and …
Nothing.
I checked
/var/www/nextcloud/data/nextcloud.log
, I noticed it was the /OCA/Themeing/Service/ThemesService
{"reqId":"XrDz8gyE4aXiYDnBv3AJ","level":3,"time":"2025-04-12T04:26:44+00:00","remoteAddr":"35.142.1
76.143","user":"--","app":"index","method":"GET","url":"/","message":"Could not resolve OCA\\Themin
g\\Service\\ThemesService! Class \"OCA\\Theming\\Service\\ThemesService\" does not exist",
After a quick google search, I came across a post on the nextcloud forum from someone two days ago with the same problem. Turns out this is a known issue in the lastest release of Nextcloud server 31.0.3 (the directory is just totally missing from the zip file) so I downgraded to 31.0.2
Finishing touches
Its up! Just got to create the admin account.
So it works! Nope, its never that easy. As soon as I tried to access it from a client on my phone, the server crashed. I determined the error was with the data by looking through
/var/nextcloud-data/nextcloud.log
, and after checking the status with systemctl
I saw it was a memory issue. Which makes sense because the VPS is running now with only half a GB of memory. Time to upgrade.
Final Thoughts & Lessons Learned
This has been the most rewarding experience I have had in a while. After so many problems, especially the ones I couldn’t answer within the guide itself, I feel much more confident in my ability to diagnose and fix errors. I learned that its probably the most important skill to have in IT. In the past, whenever I ran into an issue, or bricked a server, I would just give up if I couldn’t find the answer in the first google link. With my good dev friend at my side, he carefully walked me through the thought process required to successfully solve problems. These have been long nights that I benefitted greatly from.
All praise is due to God, the Most Compassionate, Most Merciful