StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

How to Setup Nextcloud with LAMP on Ubuntu 20.04 LTS

  • May 6, 2021
  • 11 min read
IT Engineer and Technical Author. Karim is specializing in Linux, he is a prolific blogger who writes for various websites.
IT Engineer and Technical Author. Karim is specializing in Linux, he is a prolific blogger who writes for various websites.

In today’s world, data is your most important asset but how you manage it is another challenge. We store our data on different devices but it is not safe and convenient when you have to retrieve some useful documents or pictures. Here comes the use of NextCloud, which makes it easier for you to store and manage your data in your personal workplace, whether it’s on your home or office system. Nextcloud is an open-source solution that protects your data and offers you access from your system of mobile devices where you have the options to sync, access, or share data.

In this article, we are going to show you the Nextcloud installation setup on a home system running Ubuntu 20.04 LTS operating system (OS). You can opt to use other Linux distributions as well, but Ubuntu is one of the most useful operating systems.


The prerequisites for the Nextcloud setup are to have a running LAMP stack on your Ubuntu system.

Follow the steps below to complete the prerequisites by installing the LAMP stack using Apache Web server and MySQL Database.

Step 1: Installation of LAMP (Linux Apache MySQL PHP)

Every web-based application like Nextcloud is dependent on the LAMP stack. LAMP stack is an installation of Linux open-source tools, comprising of Web servers and Database servers.

Let’s run the command below to install the Apache Web Server and MySQL Database server along with PHP and its other required dependencies.

Installation of LAMP

Type ‘Y’ for yes to continue the installation.

Step 2: Configure Database for Nextcloud

Once the installation is complete, make sure that the service of Apache Web and MySQL Database is up and running. Next, at the very first step, use the below command to secure the Database by setting its root password, removing anonymous users as shown below.

Configure Database for Nextcloud Run the commands below to create a new user and database to be used for the Nextcloud setup.

We have created the DB user and password. Now exit the DB console using the “exit” command.

Now we have a LAMP ready to perform the installation of the Nextcloud setup on it. Let’s move to the next step to download and install Nextcloud.

Step 3: Downloading Nextcloud setup

The latest Nextcloud installation setup can be downloaded from the official web link of Nextcloud, where you can download its Mobile, Desktop, and Server version.

We are going to get its latest server version from their website as shown.

Downloading Nextcloud setup

When you have downloaded the installation package, extract it into the document root directory of your web server which is ‘/var/www/html/’

Document root directory

After extracting the archive, change ownership and permissions of the extracted directory to www-data using the below command.

Step 4: Configure Web Server for Nextcloud

After downloading and extracting the setup files into the web document root directory, we are going to configure the Apache webserver to serve the contents of Nextcloud.

Let’s create a new conf file and add the following virtual host entry to that.

Save and close the file using your editor and run the below command to enable the new virtual host and its other required modules in your web server.

Make sure to reboot the webserver service after making these changes as indicated.

Reboot webserver service

Step 5: Completing Nextcloud Web Setup

At this step, we will complete the Nextcloud web setup by accessing its web interface using the server name we have defined in its Virtual Host configuration setup.

Let’s open up your web browser and access your domain.

Access your domain

Fill in the required information for your Admin account, give the Database credentials you have set up earlier, check with install recommended apps and click to Finish setup as shown.

 Admin account

Step 6: Using Nextcloud Dashboard

We have Nextcloud setup installed, configured, and running on our home setup test domain.

You can make use of the recommended apps that we have installed during the setup. In order to download and install a new application, just drop down your account and click the App button to enable new applications as shown below.

Nextcloud setup installed

Now let’s see how you can make use of it in your daily routine by uploading your valuable contents.

Click on the Files icon on the top left bar to upload your documents using the ‘Plus’ icon.

Upload your documents


In this article, we have thoroughly covered the steps to set up a NextCloud productivity platform on our self-hosted home system. We have also covered the detailed steps to prepare the LAMP stack as a prereq. Now, following this article you can make use of this tool in your daily routine by setting it up in your home or office premises. Making use of this tool, you can manage your data in one safe place and access it from remote devices.

Hey! Found Karim’s insights useful? Looking for a cost-effective, high-performance, and easy-to-use hyperconverged platform?
Taras Shved
Taras Shved StarWind HCI Appliance Product Manager
Look no further! StarWind HCI Appliance (HCA) is a plug-and-play solution that combines compute, storage, networking, and virtualization software into a single easy-to-use hyperconverged platform. It's designed to significantly trim your IT costs and save valuable time. Interested in learning more? Book your StarWind HCA demo now to see it in action!