A Step-by-Step Guide to Setting Up a Private Cloud Server on Your Raspberry Pi
Learn how to set up your own private cloud server using Raspberry Pi and Nextcloud, an open-source file sync and share platform. Follow our easy guide to get started with Nextcloud on Raspbian OS. …
Updated September 18, 2023
Learn how to set up your own private cloud server using Raspberry Pi and Nextcloud, an open-source file sync and share platform. Follow our easy guide to get started with Nextcloud on Raspbian OS.
Introduction
Nextcloud is a popular open-source cloud platform that allows you to store your files in one place and access them from anywhere. It offers features like file synchronization, sharing, and collaboration tools for teams or individuals. In this article, we will guide you through the process of setting up Nextcloud on Raspberry Pi 4 running Raspbian OS.
Prerequisites
- A Raspberry Pi 4 Model B with a 8GB SD card preloaded with the latest version of Raspbian OS (32-bit)
- Power supply and Ethernet cable for network connectivity
- Monitor, keyboard, and mouse for managing your Raspberry Pi
- An active internet connection to download Nextcloud files
Step 1: Update Your Raspberry Pi
Before proceeding with the installation of Nextcloud, make sure your Raspberry Pi is up to date. Open a terminal window and run the following commands:
sudo apt update
sudo apt upgrade
Step 2: Install Apache Web Server
Nextcloud requires an Apache web server to function properly. To install Apache, run the following command in the terminal:
sudo apt install apache2 -y
Once installed, enable and start the Apache service using these commands:
sudo systemctl enable apache2
sudo systemctl start apache2
Step 3: Install PHP and Other Required Packages
Nextcloud requires a few additional packages to be installed on your Raspberry Pi. Run the following command to install them:
sudo apt install php libapache2-mod-php php-cli php-common php-gd php-mbstring php-intl php-xml php-zip -y
Step 4: Install MariaDB Server
Nextcloud requires a database to store its data. We will use the MariaDB server for this purpose. Run the following command in the terminal to install it:
sudo apt install mariadb-server -y
During the installation, you will be prompted to set up a root password for your MariaDB server. Choose a strong and secure password.
Step 5: Install Nextcloud
Download the latest version of Nextcloud from its official website: https://nextcloud.com/install/#install-on-your-own-server
Extract the downloaded file to your Raspberry Pi using the following command:
tar -xvf nextcloud*.tar.bz2
Copy the extracted files to your Apache web server directory:
sudo cp -r nextcloud /var/www/html/nextcloud
Now, set the ownership of the Nextcloud folder to the www-data user and group:
sudo chown -R www-data:www-data /var/www/html/nextcloud
Next, configure your Apache web server to serve Nextcloud. Open the Apache configuration file using a text editor:
sudo nano /etc/apache2/sites-available/000-default.conf
Locate the <Directory /var/www/html>
section and add the following lines inside it:
<Directory /var/www/html/nextcloud>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
Save and close the file. Finally, restart the Apache service for the changes to take effect:
sudo systemctl restart apache2
Step 6: Configure Nextcloud
Open your web browser and navigate to http://your_raspberrypi_ip/nextcloud
. Follow the on-screen instructions to configure Nextcloud. You will be prompted for a database name, username, password, and other details. Use the root credentials you set up earlier when configuring MariaDB.
Once the configuration is complete, you should have a fully functional Nextcloud server running on your Raspberry Pi! You can now access it from any device by entering http://your_raspberrypi_ip/nextcloud
in the web browser’s address bar.
Conclusion
In this article, we learned how to install Nextcloud on Raspberry Pi 4 running Raspbian OS. Nextcloud is an excellent solution for anyone looking to create their own private cloud server to store and share files. The installation process was straightforward, thanks to the ease of use of Raspberry Pi and Nextcloud. With this setup, you can access your files from anywhere with an internet connection and collaborate with others in real-time.