Nextcloud is a web suite that provides cloud storage over the network, a fork of ownCloud. It is like a Google Drive / Dropbox that permits you to store and share your documents and pictures in a centralized location.
NextCloud works on top of LAMP,
Apache 2.4 with mod_php
PHP 7.1 and above.
Nextcloud Enterprise is also available.
- Access your files wherever you are.
- Share your files with the other users and protect the public links with a password.
- Two-factor authentication with QR Code and TOTP.
- Monitor and Track change happening onto your file.
- NextCloud can access files stored in external cloud storage service providers such as Amazon, Google, and Dropbox.
Install Apache Web Server
sudo apt update sudo apt install -y apache2 bzip2
sudo apt install -y mariadb-server
Install PHP 7.2
Nextcloud doesn’t support PHP 7.0 which comes with Debian by default. Since Nextcloud requires PHP 7.1 and above, we will configure SURY repository to install PHP 7.2.
sudo apt install ca-certificates apt-transport-https wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list sudo apt update
We will now install the PHP and its important extensions for NextCloud.
sudo apt install -y libapache2-mod-php7.2 php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-intl php-imagick php7.2-xml php7.2-zip php7.2-sqlite3
Enable Apache Modules
You need to enable the following modules to get NextCloud work properly.
sudo a2enmod rewrite
If you want, you can enable the below recommended Apache modules:
sudo a2enmod headers sudo a2enmod dir sudo a2enmod env sudo a2enmod mime
Restart the Apache service.
sudo systemctl restart apache2
cd /tmp/ wget https://download.nextcloud.com/server/releases/latest.tar.bz2 tar -jxvf latest.tar.bz2 sudo mv nextcloud /var/www/html/ sudo mkdir /var/www/html/nextcloud/data
Update the ownership of the files inside the Nextcloud directory so that Apache user can write the data into it.
sudo chown -R www-data:www-data /var/www/html/nextcloud/
If you are bringing up a MariaDB instance for the first time,
Log into the MariaDB server using the root user to create a database.
sudo mysql -u root -p
Create a database called “nextclouddb“.
create database nextclouddb;
Grant “nextclouduser” to access the “nextclouddb” database on localhost with a password “password“.
grant all on nextclouddb.* to 'nextclouduser'@'localhost' identified by 'password';
Exit from the MariaDB prompt.
Open up your web browser and navigate it to below URL.
Fill up the setup page with admin information (username and password) and then the location of the data folder.
You can choose either the SQLite or MySQL.
If you chose to use the SQLite database, then you do not have to enter database details. Using SQLite in a production environment is not recommended.
So, we will use MariaDB here. Enter the MariaDB database details in the below page.
Click the close to close the Nextcloud popup.
You will now get the home page of Nextcloud. Click the “+ sign” button and then Upload to begin uploading the files.