Nextcloud is a self-hosted file sharing application that allows you to store your data, such as files, contacts, images, calendars, news and more. Using Nextcloud to store your documents can remove your need for using third-party hosting software like Dropbox, Google Drive, iCloud. In this article, we will install Nextcloud 14 on Debian 9, with Apache web server, MariaDB and PHP 7.0.
Requirements:
- root access via SSH to your VPS;
- MySQL or MariaDB 5.5+ or PostgreSQL version 9 or 10;
- PHP version 7.0 or above;
- Apache version 2.4 with mod_php or Nginx (php-fpm) web server;
Table of Contents
Login via SSH and update your system
Log in to your Debian 9 VPS via SSH as user root
Using the following command, all installed packages will be updated and upgraded:
apt update && apt upgrade -y
Install Apache web server
First, you need to install a web server to run Nextcloud. By executing the following command you will install the Apache web server on your VPS.
You can start Apache and also enable to start on server boot with these commands:
Install PHP
Install PHP together with some PHP modules that are required by Nextcloud.
Install MariaDB and create a database
As mentioned in the requirements, a database server is required to run NextCloud. We will install MariaDB server using the command:
Once installed, start the database server and enable it to start at server boot.
You can run the mysql_secure_installation which is a post-installation script used to improve the security of your MariaDB server and set a ‘root’ password. You may use the options below
Next step is to log in to the MariaDB server as ‘root’ user and creates a database and user for Nextcloud.
It is recommended to replace ‘Password’ with a strong password which will be a combination of letters and numbers and at least 10 characters long.
Download and install Nextcloud
Go to Nextcloud’s official website and download Nextcloud 14 to your Debian 9 VPS. Currently, the latest stable version is 14.0.0
Extract the downloaded ZIP archive Nextcloud-14.0.0.zip in a directory that Apache has access to, and change the ownership of the Nextcloud directory to the web server user.
Once all of the Nextcloud prerequisites are met, we can complete the installation using two different ways: using the on-screen installation wizard or via the command line. In this case, we are going to use the installation via the command line. We will change the current working directory with this command:
now run the following command as web server user (www-data):
You should use the database information we created previously in this tutorial and replace the ‘Password’ with a strong password for the Nextcloud ‘admin’ user.
You will get the following output if the installation is successful
Add your_domain.com by editing the config/config.php file
Create Apache Virtual Host
To access the Nextcloud with a domain name you need to create a virtual host. Create the following file with this command:
Don’t forget to modify the your_domain.com
Save the file.
Enable the newly created virtual host:
To finish and activate the newly created configuration, you need to reload the Apache web server.
Congratulations, the Nextcloud 14 installation is complete. Now you can choose your favorite browser and visit the http://your_domain.com and login to your Nextcloud instance by using the credentials you set in the installation command above.
You don’t need to Install NextCloud 14 on Debian 9 if you use one of our NextClould Hosting services, in which case you can simply ask our expert Linux admins to set up Nextcloud 14 on your Ubuntu 16.04 server for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on How To Install NextCloud 14 on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.