How to Install Nextcloud on POP! OS Latest

In this tutorial, we will guide you step by step on how to install Nextcloud, a powerful and secure self-hosted cloud storage solution on POP! OS Latest.

Prerequisites

Before starting, make sure you have the following:

Step 1: Install Required Dependencies

Before proceeding with the installation, we need to install some required dependencies. Enter the following command in the terminal:

sudo apt-get update && sudo apt-get install curl libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip

This command will update the package list and install all required dependencies.

Step 2: Install and Configure MariaDB

Nextcloud uses a database to store its data, and we will use MariaDB as our database management system.

To install MariaDB, enter the following command in the terminal:

sudo apt-get install mariadb-server

During the installation, you will be asked to set a root password for the MariaDB server.

Next, we need to create a database and a user for Nextcloud. To do so, enter the following commands in the terminal:

sudo mysql -u root -p

Enter the root password you set during the installation of the MariaDB server.

CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Make sure to replace mypassword with the password of your choice.

Step 3: Download and Install Nextcloud

Now that we have installed all the required dependencies and configured our database, we can proceed with the actual installation of Nextcloud.

Download the latest Nextcloud archive from the official website using the following command:

cd /tmp && curl -O https://download.nextcloud.com/server/releases/latest.tar.bz2

Extract the downloaded archive into your web root directory /var/www/html/ using the following command:

sudo tar -xvjf /tmp/latest.tar.bz2 -C /var/www/html/

Next, we need to set the correct ownership and permissions for the Nextcloud installation files:

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

Step 4: Configure Apache Server for Nextcloud

In this step, we will configure our Apache server to serve Nextcloud. For that, we need to create a virtual host file for Nextcloud.

Create a virtual host file nextcloud.conf in the /etc/apache2/sites-available/ directory:

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

And add the following configuration:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/nextcloud/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/html/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
        Satisfy Any

        <IfModule mod_dav.c>
            Dav off
        </IfModule>
    </Directory>

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{HTTP_USER_AGENT} DavClnt
        RewriteRule ^$ /remote.php/webdav/ [L,R=302]

        RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
        RewriteRule ^(.*)$ /index.php [PT,E=PATH_INFO:$1]
    </IfModule>

</VirtualHost>

Save and close the file by pressing Ctrl + X, then Y, then Enter.

Next, we need to enable the newly created virtual host file and enable the required Apache modules with the following commands:

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

Finally, restart the Apache server to apply the changes:

sudo systemctl restart apache2

Step 5: Configure Nextcloud

Now that we have completed the installation and configuration of the Apache server, we need to complete the configuration of Nextcloud.

Open your web browser and navigate to your server's IP address or domain name followed by /nextcloud/. You should see the Nextcloud setup page.

Set your admin credentials, the database credentials you have created earlier, and the data directory.

Conclusion

Congratulations! You have successfully installed and configured Nextcloud on your POP! OS Latest. You can now enjoy a powerful and secure self-hosted cloud storage solution!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!