How to Install Nextcloud on Arch Linux

Nextcloud is a powerful, open-source cloud platform that provides secure file storage, sharing, and online collaboration. In this tutorial, we will learn how to install Nextcloud on Arch Linux.

Prerequisites

Before we get started with the installation, let's make sure our system is up-to-date:

sudo pacman -Syu

Install Apache and PHP

Nextcloud requires the Apache web server and PHP to be installed on our system. To install them, we can run the following command:

sudo pacman -S apache php php-apache

Install MariaDB

Nextcloud requires a database to store its data. We will use MariaDB, a community-developed fork of MySQL as our database.

To install MariaDB, run the following command:

sudo pacman -S mariadb

To start the MariaDB service, run the following command:

sudo systemctl start mariadb

To enable the MariaDB service to start at boot time, run the following command:

sudo systemctl enable mariadb

Now we can secure our MariaDB installation by running the following command:

sudo mysql_secure_installation

Create a Nextcloud Database

After securing MariaDB, we can create a database for Nextcloud:

sudo mysql -u root -p

This will open the MariaDB console. Enter your MariaDB root password when prompted.

Now we can create a new database and user for Nextcloud by running the following commands:

CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

Remember to replace 'password' with a strong password of your choice.

Install Nextcloud

Now we can download the latest release of Nextcloud from their website:

cd /tmp;
wget https://download.nextcloud.com/server/releases/nextcloud-21.0.0.zip

Next, we need to install the unzip package to extract the downloaded zip file:

sudo pacman -S unzip

Now we can extract the downloaded file to our web server's document root directory:

sudo unzip nextcloud-21.0.0.zip -d /srv/http/

Change the ownership of the nextcloud directory to our Apache user:

sudo chown -R http:http /srv/http/nextcloud

Configure Apache for Nextcloud

Now we need to configure our Apache web server to serve Nextcloud.

Create a new configuration file for Nextcloud in the Apache configuration directory:

sudo vim /etc/httpd/conf/extra/nextcloud.conf

And then add the following configuration:

Alias /nextcloud "/srv/http/nextcloud/"

<Directory /srv/http/nextcloud/>
  Require all granted
  AllowOverride All
  Options FollowSymlinks MultiViews
  <IfModule mod_dav.c>
    Dav off
  </IfModule>
</Directory>

Save and close the file.

Now we need to enable the necessary Apache modules:

sudo a2enmod rewrite ssl headers env dir mime

Restart the Apache service:

sudo systemctl restart httpd

Finish the Installation

In your web browser, navigate to your server's IP address or domain name followed by '/nextcloud'. You will see the Nextcloud installation screen.

Enter the details for your database configuration and admin account.

Once you have completed the installation, you can log in to your Nextcloud instance and start using it!

Conclusion

In this tutorial, we learned how to install Nextcloud on Arch Linux. Nextcloud is a powerful and flexible cloud platform, perfect for organizations of all sizes. With its robust features and focus on user privacy and security, it's a great alternative to proprietary cloud services.

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!