Installing Raspbian:
In this article, I will be using the Raspbian OS on my Raspberry Pi 3. It is based on Debian. It is the officially recommended operating system for Raspberry Pi devices.
I’ve written a dedicated article on installing Raspbian OS on Raspberry Pi 3. You can check it out at https://linuxhint.com/install_raspbian_raspberry_pi/ if you need any assistance.
Connecting to Raspberry Pi 3:
Once you have Raspbian installed on your Raspberry Pi 3, you can connect to your Raspberry Pi 3 using SSH. You will need to know the IP address of your Raspberry Pi 3 in order to do that. You should be able to find the IP address in your Routers web based administration interface.
In my case, the IP address is 192.168.2.6. Replace it with yours from now on.
Now, connect to your Raspberry Pi 3 using SSH as follows:
Now, type in yes and then press <Enter>.
Now, type in the password of your Raspberry Pi 3 and press <Enter>.
You should be logged in.
Installing NextCloud on Raspberry Pi 3:
Now, update the APT package repository cache with the following command:
The APT package repository cache should be updated.
Now, install Apache 2 web server, PHP, all the required PHP libraries and tools with the following command:
wget unzip bzip2 curl php php-common php-curl php-gd php-mbstring php-mysql php-xml
php-zip php-intl php-apcu php-redis php-http-request
Now, press y and then press <Enter>.
All the packages are being downloaded.
All the required packages should be installed at this point.
Now, you have to create a new Apache 2 virtual host configuration file for NextCloud.
You can create a new configuration file nextcloud.conf with the following command:
Now, type in the following lines and save the file by pressing <Ctrl> + x followed by y and then press <Enter>.
ServerAdmin webmaster@localhost
DocumentRoot /var/www/nextcloud
Alias /nextcloud "/var/www/nextcloud/"
<Directory "/var/www/nextcloud/">
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
Require all granted
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/nextcloud_error_log
CustomLog ${APACHE_LOG_DIR}/nextcloud_access_log common
</VirtualHost>
Now, you have to create a new MariaDB database and user for NextCloud.
To do that, first login to your MariaDB console with the following command:
You should see be logged in.
Now, create a new MariaDB database nextcloud with the following command:
Now, create a new MariaDB user nextcloud and also set a password for the new user with the following command:
NOTE: Replace YOUR_PASSWORD_HERE with the password you want to set for the MariaDB user nextcloud. I will set it to nextcloud in this article for simplicity.
Now, assign all the required permissions of the database nextcloud to the MariaDB user nextcloud with the following command:
Now, run the following command to apply the changes:
Now, exit out of the MariaDB console with the following command:
Now, navigate to the /var/www directory with the following command:
Now, download NextCloud zip archive with the following command:
NextCloud zip archive is being downloaded.
NexCloud zip archive should be downloaded.
Now, run the following command to unzip the NextCloud archive:
The archive should be extracted.
Now, create a new data directory for NextCloud with the following command:
Now, change the owner and group of the files and directories inside the nextcloud/ directory to www-data with the following command:
Now, enable the nextcloud.conf site configuration with the following command:
Now, disable the default site configuration 000-default.conf with the following command:
Now, restart the apache2 service with the following command:
Now, add apache2 and mariadb services to the system startup with the following command:
NextCloud should be installed.
Configuring NextCloud:
Now, you have to configure NextCloud from a web browser. To do that, visit http://192.168.2.6/nextcloud from your favorite web browser. You should see the following page.
From here, you have to create an administrator account. Type in the username and password for your new administrator account and scroll down a little bit.
Now, type in your MariaDB database details. Finally, click on Finish setup as marked in the screenshot below.
You should be logged in to your NextCloud account as administrator. Now, click on the X icon to close the popup window as marked in the screenshot below.
You should see the NextCloud dashboard. From here, you can create new users, upload files, and other administrative tasks.
So, that’s how you install NextCloud on Raspberry Pi 3. Thanks for reading this article.