Nextcloud Install Guide

About Nextcloud

Nextcloud is like your own google drive hosted on your server.
You can create accounts for other people and even install addons like a Kanbanboard or ToDo-List.
It uses PHP and is quite easy to install.
Similar programs are Seafile, Owncloud and FileRun.

Why self-host your files

It's nice to have ownership over your own files. No one can read your files except if they have your login.
It's faster than Google Drive because you use it on your own server. No background-activities or virus-scans will slow down the uploading or downloading of your files.

I personally really like nextcloud, it's very easy to setup and just works straight out of the box.
Owncloud is - from my research - replaced by nextcloud. (Like LibreOffice replaces OpenOffice)

But: Nextcloud is a bit overloaded if you only want to quickly upload files.
Other alternatives like Droppy are either not up-to-date or use non-PHP solutions that require extra setup.

For very simple and "easy uploading" of files I personally use encode-explorer. Very easy to setup but it neither has security for uploaded files nor many other things. But it works very well as a mini filehosting.

Installing Nextcloud

Requirements: Have a MySQL Database and webserver with PHP installed.
(On Debian: sudo apt-get install mariadb-server apache2 php)

To setup a simple MySQL Database:

sudo mysql_secure_installation
sudo mysql -u root -p
<ENTER>
CREATE DATABASE ncdb;
CREATE USER 'ncdbuser'@'localhost' IDENTIFIED BY 'MyOwnPasswordHere0?';
GRANT ALL PRIVILEGES ON ncdb.* TO 'ncdbuser'@'localhost';
FLUSH PRIVILEGES;

Then you need the required PHP packages:
sudo apt-get install php-zip php-xml php-curl php-gd php-mbstring php-mysql

Before installing nextcloud make sure the folder you want your cloud to be in has write permissions from the PHP/web user.
If you use Apache2&PHP on Debian and want to use the /cloud folder then you can use the following commands:
sudo mkdir /var/www/html/cloud
sudo chown -R www-data:www-data /var/www/html/cloud
This makes the web-user own the cloud directory and be able to write / create files in it.

To download nextcloud simply visit their website and click on "Get Nextcloud" in the top right. There you can download the "Web Installer" package which is only one .php file.
To directly download it to your webserver you can use the following command:
sudo wget https://download.nextcloud.com/server/installer/setup-nextcloud.php
Or you can download it locally and copy it to your webfolder (in this case /var/www/html/cloud).
Now visit the website with a browser of your choice.

If it says an error along the lines of "can't write" then you have to use the chown command again to make the directory writeable for the www-data user again.
(sudo chown -R www-data:www-data /var/www/html/cloud)

Selecting install directory: If your install file is in /cloud then you can enter .
After clicking OK it will install nextcloud for you. after finishing you can then enter your configuration.
Enter your new Admin User and Password and then select MySQL as your database-provider and enter the details from earlier.

To create users you can simply visit the "User" setting on the top right by clicking on your Icon.