How to Install Nextcloud on Ubuntu 20.04

If you’re looking for a cloud storage solution that you can host on your own server, Nextcloud is a great option. With Nextcloud, you can store your files, photos, and documents securely, while also having the ability to access them from anywhere with an internet connection.

In this guide, we’ll walk you through the steps to install Nextcloud on Ubuntu 20.04. By the end of this tutorial, you’ll have your very own Nextcloud server up and running.

Step 1: Update and Upgrade

Before installing any new software, it’s always a good idea to make sure your system is up to date. To do this, run the following commands:

sudo apt update
sudo apt upgrade

Step 2: Install Dependencies

Nextcloud requires a few dependencies to be installed on your system. You can install these dependencies by running the following command:

sudo apt install apache2 mariadb-server libapache2-mod-php7.4 php7.4-gd php7.4-json php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl php-imagick php7.4-xml php7.4-zip php7.4-bz2 php7.4-mbstring php7.4-curl php7.4-redis redis-server

Step 3: Configure MariaDB

Next, you’ll need to configure MariaDB, which is a popular open-source relational database management system. You can configure MariaDB by running the following command:

sudo mysql_secure_installation

Follow the on-screen prompts to secure your MariaDB installation.

Step 4: Download Nextcloud

Now it’s time to download the Nextcloud server software. You can download the latest version of Nextcloud by running the following command:

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

Once the download is complete, extract the archive by running the following command:

tar xvjf latest.tar.bz2

Step 5: Configure Apache

Next, you’ll need to configure Apache to serve your Nextcloud installation. You can do this by creating a new Apache configuration file:

sudo nano /etc/apache2/sites-available/nextcloud.conf

Copy and paste the following configuration into the file:

Alias /nextcloud "/var/www/nextcloud/"


   Options +FollowSymlinks
   AllowOverride All

   
       Dav off
   

   SetEnv HOME /var/www/nextcloud
   SetEnv HTTP_HOME /var/www/nextcloud

Save and exit the file, and then enable the newly created configuration:

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime
sudo systemctl restart apache2

Step 6: Set Permissions

Next, you’ll need to set the correct permissions for your Nextcloud directory. You can do this by running the following commands:

sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/

Step 7: Complete the Installation

Finally, open a web browser and navigate to http://your-server-ip/nextcloud to complete the installation. Follow the on-screen prompts to set up your Nextcloud admin account and configure your storage options.

Once the installation is complete, you’ll have your very own Nextcloud server up and running on Ubuntu 20.04. You can now start syncing your files and accessing them from anywhere with an internet connection.

Congratulations, you’ve successfully installed Nextcloud on Ubuntu 20.04!