In this tutorial, we will explain how to install Nextcloud on Ubuntu.

Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud application functionally is similar to Dropbox. Unlike Dropbox, Nextcloud does not offer off-premises file storage hosting. Nextcloud is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices.

Prerequisites

You will need:

  • VPS running Ubuntu

Step 1 – Install LAMP

Nextcloud requires a LAMP Server.  First, run tasksel

sudo tasksel

After, hit space to select LAMP server and hit Enter to install.

And after, install PHP and PHP extensions:

sudo apt-get install php7.2 bzip2 libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip

Step 2 – Install Nextcloud

Now it’s time to install ownCloud. First, go to web directory:

cd /var/www/html/

Download Nextcloud tarball file:

wget https://download.nextcloud.com/server/releases/latest-15.tar.bz2 -O nextcloud-15-latest.tar.bz2

Extract it:

tar -xvjf nextcloud-15-latest.tar.bz2

Set permissions to Nextcloud files:

chown -R www-data:www-data nextcloud

And remove the downloaded file:

rm nextcloud-15-latest.tar.bz2

Step 3 – Create a Database

MySQL is needed to store Nextcloud data.

Now, login to MySQL:

mysql -u root -p

Enter for none password and create a database for ownCloud:

CREATE DATABASE nextcloud;

CREATE USER ‘nextcloud_user’@’localhost’ IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextcloud_user’@’localhost’;

FLUSH PRIVILEGES;

exit

Restart apache to take effects:

systemctl restart apache2

Step 4 – Finish Setup

Open your browser and go to your Nextcloud URL:http://youripaddress/nextcloud

Create an admin account:

Click on Storage & Database and enter your data folder:

Now configure the database and click on Finish Setup button:

You will be redirected to Nextcloud dashboard.

You have successfully installed Nextcloud on Ubuntu.

Enjoy.