Do you want to host your own personal cloud storage at home? Nextcloud is a robust open-source solution where you can host your own cloud server and maintain complete control of your data. With the Raspberry Pi 4, it’s simple to have an economical and power-saving personal cloud storage.
In this step-by-step tutorial, we’ll guide you through the whole process of installing Nextcloud on a Raspberry Pi 4 — from hardware preparation to remote access to your cloud server. Whether you’re a novice or a tech geek, this tutorial will assist you in setting up your own self-hosted cloud storage with ease.
Download and install the latest Raspberry Pi OS from the official website:
Step 1. Update system Packages:
sudo apt update && sudo apt upgrade -y
Step 2. Install LAMP Stack (Apache, MariaDB, PHP):
sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2
Step 3. Install MariaDB (MySQL):
sudo apt install mariadb-server -y
sudo mysql_secure_installation
Step 4. Install PHP:
sudo apt install php libapache2-mod-php php-mysql php-xml php-mbstring php-zip php-curl php-gd php-intl php-bcmath -y
Step 5. Create Database for Nextcloud:
sudo mysql -u root -p
Step 6. Create a database:
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 7: Download Nextcloud:
cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/latest.tar.bz2
sudo tar -xvf latest.tar.bz2
sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/
Step 8: Configure Apache for Nextcloud
sudo nano /etc/apache2/sites-available/nextcloud.conf
Add the following content:
<VirtualHost *:80>
ServerName your-raspberry-pi-ip
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud/>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Step 9. Enable configuration:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 10: Final Installation
Open your browser and go to:
http://your-raspberry-pi-i
Conclusion:
Installing Nextcloud on a Raspberry Pi 4 is a great method of having your own private cloud storage with complete control over your data. Due to its low power usage and cost, the Raspberry Pi 4 is a perfect option for a personal cloud server.
By reading this guide, you now know how to install Nextcloud, set up key settings, and access your cloud storage everywhere. You are now able to safely store, share, and sync your data without trusting it to third-party cloud services.
In case of any question or additional customization needed, do not hesitate to consult Nextcloud’s vast documentation or leave a message below.