Step 1 – Prerequsites
The first of all, to set up Nextcloud you must have running LAMP server on your Debian 9 system. If you already have running LAMP stack skip this step else use the following commands to install it.
Install PHP
First of all, Install the latest version of PHP on your Debian 9 Stretch system. So import the GPG key and add the following Apt repository to your system. Then isntall PHP on your system:
Install Apache2
Install MySQL
Step 2 – Download Nextcloud Archive
After successfully configuring lamp server on your system, Let’s download latest Nextcloud from its official website. Now extract downloaded archive under website document root and setup appropriate permissions on files and directories. Now, remove the archive file.
Step 3 – Create MySQL Database
After extracting code, let’s create a MySQL database and user account for configuring Nextcloud. Use the following set of command to login to MySQL server and create database and user.
Step 4 – Run Nextcloud Web Installer
Access the Nextcloud directory in the web browser as below. Change localhost to your server IP address or domain name. Enter new admin credentials to create an admin account and provide the location of the data folder.
Now slide your page down and input the database credentials and click on Finish Setup.
After completing setup you will get admin dashboard. Where you can create a user, groups, assigned them permissions, etc.
Congratulations, You have a working Nextcloud instance on your Debian 9 Stretch system.