Similar to Dropbox and Google Drive, Nextcloud is self-hosting software that allows you to share files, contacts, and calendars. But, unlike Dropbox and Google Drive, your files will be private and stored on your server instead of a third party server. Nextcloud is HIPAA and GDPR compliant, so your files will be encrypted along with the ability to audit. For this tutorial, we’ll be installing our Nextcloud instance on our Ubuntu 18.04 LTS server.
Step 1: You’ll first log in to your server.
Step 2: Then log in to your MySQL/MariaDB instance by typing:
You’ll see the prompt change, and you’ll then be able to use MySQL commands to make a database and grant permissions.
Replace the highlighted password below, with a secure password. You can tell the commands were accepted because it’ll show a “Query OK, 0 rows affected (0.00 sec)” message after each command. Be sure to have the password for the Nextcloud user handy; we’ll be using it later in this tutorial.
CREATE DATABASE nextcloud;
CREATE USER nextcloud IDENTIFIED BY 'password';
GRANT USAGE ON *.* TO nextcloud@localhost IDENTIFIED BY 'password';
GRANT ALL privileges ON nextcloud.* TO nextcloud@localhost;
Install Nextcloud Modules
You’ll need specific modules installed for NextCloud to work, within your terminal, install the modules using the apt install command. Press Y to continue when prompted.
apt install php-gd php-json php-mysql php-curl php-mbstring
apt install php-intl php-imagick php-xml php-zip
Finally, we’ll download and extract NextCloud’s files. You can then move it over to the destination of your choice, for our tutorial, we’ll move it to our default document root, /var/www/html.
Step 1: Download the Nextcloud package.
Step 2: Extract the Nextcloud package.
tar -xvf nextcloud-15.0.7.tar.bz2
Step 3: Move Nextcloud core files over to Apache’s root directories.
mv ./* /var/www/html
mv ./.htaccess /var/www/html
mv ./.user.ini /var/www/html
Step 4: Make a directory within the /var/www/html folder for Nextcloud storage.
Step 5: Nextcloud is run by Apache and uses www-data as the user, therefore, you’ll need to change over the permissions and ownership.
chown -R www-data:www-data ./*
chown -R www-data:www-data .htaccess
chown -R www-data:www-data .user.ini
chown www-data:www-data /nextcloud-data
Step 6: Restart Apache for the changes to take effect.
systemctl restart apache2Step 7: Verify Nextcloud is working by visiting it in your browser at http://your_ip/index.php. Creation of the admin account is necessary, as well as setting the folder/directory (nextcloud-data) that NextCloud will store its uploads.
- Create an Account with username; we are using admin.
- Data folder should be /nextcloud-data
- Username and password should be the ones for MySQL that were made earlier, leave the setting on localhost.
- Click Finish
You are now in Nextcloud and can start uploading files and folders!