In this guide, we will walk you through the steps of installing Nextcloud on a Raspberry Pi. Nextcloud is a self-hosted file sharing and collaboration platform that allows you to access your files, contacts, calendars, and more from any device.
Before we get started, make sure you have the following:
Get Nextcloud with 1 TB of storage for just up to €3.99 per month.
Try it now for one month free and risk-free.
– Raspberry Pi (any model will do, but a Raspberry Pi 4 is recommended for better performance)
– MicroSD card (at least 16GB)
– Power adapter
– Ethernet cable or Wi-Fi dongle
– HDMI cable (optional)
– Keyboard and mouse (optional)
Step 1: Prepare the Raspberry Pi
First, you will need to install an operating system on your Raspberry Pi. The recommended OS for Nextcloud is Raspbian, which is based on Debian. You can download the latest version of Raspbian from the official Raspberry Pi website and follow their instructions for installation.
Step 2: Install Apache and PHP
Once you have Raspbian up and running on your Raspberry Pi, you will need to install a web server and PHP. Open a terminal and run the following commands:
sudo apt-get update
sudo apt-get install apache2 php libapache2-mod-php php-mysql
Step 3: Install MariaDB
Nextcloud requires a database to store its data. We will use MariaDB, a popular open-source database server. Install MariaDB by running the following command:
sudo apt-get install mariadb-server
During the installation process, you will be prompted to set a root password for the database. Make sure to choose a strong password and remember it for future reference.
Step 4: Install Nextcloud
Now it’s time to download and install Nextcloud. First, download the latest version of Nextcloud by running the following command:
wget https://download.nextcloud.com/server/releases/nextcloud-x.x.x.zip
Replace „x.x.x“ with the latest version number available on the Nextcloud website. Once the download is complete, unzip the Nextcloud archive and move it to the Apache web server root directory:
unzip nextcloud-x.x.x.zip
sudo mv nextcloud /var/www/html
Step 5: Configure Apache
Next, we need to configure Apache to serve Nextcloud. Create a new virtual host configuration file for Nextcloud by running the following command:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Paste the following configuration into the file:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/nextcloud/
ServerName yourdomain.com
Options +FollowSymlinks
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Save and exit the file, then enable the new virtual host configuration and restart Apache:
sudo a2ensite nextcloud.conf
sudo systemctl reload apache2
Step 6: Configure MariaDB
Next, we need to create a new database and user for Nextcloud. Log in to the MariaDB server with the root account:
sudo mysql -u root -p
Enter the root password you set during the MariaDB installation. Once you are in the MariaDB console, run the following commands to create a new database and user:
CREATE DATABASE nextcloud;
CREATE USER ’nextcloud’@’localhost‘ IDENTIFIED BY ‚your_password‘;
GRANT ALL PRIVILEGES ON nextcloud.* TO ’nextcloud’@’localhost‘;
FLUSH PRIVILEGES;
EXIT;
Replace „your_password“ with a strong password of your choice. Remember to keep this password secure.
Step 7: Finish the Installation
Finally, open a web browser on your Raspberry Pi and navigate to http://localhost/nextcloud to complete the installation of Nextcloud. Follow the on-screen instructions to set up an admin account and configure Nextcloud to your preferences.
Congratulations, you have successfully installed Nextcloud on your Raspberry Pi! You can now access your files, contacts, calendars, and more from any device connected to your Nextcloud server. Enjoy the benefits of self-hosted cloud storage and collaboration with Nextcloud on your Raspberry Pi.