How to Install Nextcloud on Linux Mint

Nextcloud is a free and open-source cloud storage solution. It is used by individuals and organizations to store and share their files securely. In this tutorial, we will show you how to install Nextcloud on Linux Mint.

Prerequisites

Before we start, make sure you have the following:

Step 1: Install Apache web server

Open a terminal and enter the following commands to install Apache web server:

sudo apt update
sudo apt install apache2

Step 2: Install PHP

Nextcloud requires PHP 7.1 or later versions. Run the following commands to install PHP and its extensions:

sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-json php-mbstring php-xml php-zip

Step 3: Install MariaDB

Nextcloud requires a database to store its data. MariaDB is a popular open-source database server, and you can install it by running the following command:

sudo apt install mariadb-server

During the installation, you will be prompted to set a root password for MariaDB. Enter a strong password and remember it.

Step 4: Create a Database for Nextcloud

Now that we have installed the database server, we need to create a database and a user for Nextcloud. Open the MariaDB console by running the following command:

sudo mysql -u root -p

Enter the root password when prompted. Once logged in, execute the following SQL commands to create a database, a user, and grant permissions:

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

Replace password with a strong password.

Step 5: Download and Install Nextcloud

We will download and install the latest version of Nextcloud from its official website. Open a terminal and execute the following commands:

sudo apt install wget unzip
wget https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip
sudo unzip nextcloud-22.2.0.zip -d /var/www/html/
sudo chown -R www-data:www-data /var/www/html/nextcloud/

This will download and extract the Nextcloud archive to /var/www/html/nextcloud, and change the ownership of the directory to www-data:www-data.

Step 6: Configure Apache

We need to configure Apache to serve the Nextcloud files. Create a new virtual host configuration file by running the following command:

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

Paste the following configuration:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/nextcloud/

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

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>

Save the file and exit the text editor.

Next, enable the virtual host and the necessary Apache modules by running the following commands:

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

Restart Apache for the changes to take effect:

sudo systemctl restart apache2

Step 7: Finish the Installation

Open a web browser and enter your server's IP address or domain name in the address bar. You should see the Nextcloud setup page.

Follow the instructions to complete the installation. When prompted for a database, enter the following:

Once the installation is complete, you can log in to Nextcloud and start using it.

Conclusion

In this tutorial, we have shown you how to install Nextcloud on Linux Mint, a free and open-source cloud storage solution. We have covered the installation of Apache, PHP, MariaDB, and the configuration of Apache to serve Nextcloud files. You can now start using Nextcloud to store, share and collaborate on your files.

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!