Whether you're setting up Nextcloud on a home server or making it accessible online through a VPS, Debian makes an excellent platform. You can even host it on a Raspberry Pi. This guide will get you started with a basic setup.
In this tutorial you will learn:
- How to Install the Required Packages
- How to Set Up Your Database
- How to Download Nextcloud
- How to Install Nextcloud
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||Debian 10 Buster|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Install the Required Packages
Before you can install and set up Nextcloud, you're going to need to put the framework it runs on in place. Nextcloud is a PHP web application. It requires PHP, a web server, and a database. This guide will be working with Apache and MariaDB, but you can certainly set up Nextcloud a different way. This is just the simplest and most direct.
The UAF Geophysical Institute, is looking for an experienced Linux Systems Analyst to join their team of research cyber infrastructure analysts and engineers. LOCATION: Fairbanks, Alaska, USA
Install all the dependencies at once. There are a lot, but don't let that discourage you. Almost the whole setup is automated. These pieces just need to be there.
$ sudo apt install apache2 libapache2-mod-php mariadb-server php-xml php-cli php-cgi php-mysql php-mbstring php-gd php-curl php-zip
After that's finished, restart Apache to make sure that it's using the PHP module.
$ sudo systemctl restart apache2
Set Up Your Database
Nextcloud keeps track of everything in a database. Plus, like most web applications, it stores its own information and settings in it too. You already have the database server from MariaDB. You just need some minimal configuration to get it ready for Nextcloud.
Before you sign in, run the built-in secure installation script to remove junk and set up your admin account.
$ sudo mysql_secure_installation
Follow the instructions, and set up a new root password when asked. You can accept the defaults for everything.
Next, sign in to MariaDB using the root password that you just established.
$ sudo mysql -u root -p
Create a new database to use with Nextcloud.
CREATE DATABASE nextcloud;
Then, set up a new database user to access your Nextcloud database.
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'yourpassword';
Because that user will be interacting with every aspect of the database for the Nextcloud application, you'll need to grant it full access.
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost';
Finally, flush the privileges and exit MariaDB.
FLUSH PRIVILEGES; \q
Now, you're ready to download and install Nextcloud. Head over to the Nextcloud download page, and grab the latest release. You can also copy the link location, and use
wget to download it directly on a headless server.
$ cd ~/Downloads $ wget https://download.nextcloud.com/server/releases/nextcloud-16.0.1.zip
Unpack your Nextcloud zip file where it is.
$ unzip nextcloud-*.zip
Then, copy the extracted folder into your web root directory. If you don't plan to host any other web applications on your server, you can replace your web root with the Nextcloud folder.
$ sudo cp -r /home/user/Downloads/nextcloud /var/www/html/nextcloud
Since your web server, Apache, is going to be accessing your Nextcloud files, it's best to give ownership of them to
www-data, the same user running Apache.
$ sudo chown -R www-data:www-data /var/www/html/nextcloud
Open your browser, and navigate to your Nextcloud server:
You'll arrive on the Nextcloud setup page. Enter a username and password for your admin user.
Next, scroll down, and enter the information for the database that you set up, including the username and password of the user you created to manage it.
When you're finished, Nextcloud will take a few seconds to set everything up. Then, it'll drop you into your dashboard. Nextcloud is fully set up and ready to use. You can now optionally install the nextcloud client on your Debian Linux desktop
From there, you can do everything you need within Nextcloud itself. It's simple to create new users, and manage access. You can also easily download the Nextcloud app on your desktop and mobile devices to connect to your new server.