After creating a NAS in the last article, now I will create my own Cloud with Raspberry Pi 3 using nextCloud. This new project involves a clean new instance of the PIXEL operating system. Therefore, you should use another microSD card on which to put the Raspbian Jessie with PIXEL on it. After you do that, you should have available an external hard drive or memory stick. For my cloud I will use an external 160 GB hard drive. It is quite old, but can still do the job pretty well.
Update the system
The very first things you need to do after booting the RPi3 is to run
Configure Raspberry Pi
Next, lets take care of some security basics for Raspberry Pi. Open a terminal window and type
Now, you should change the password for the default pi user. Select the option and change it accordingly. After you do that, select
7 Advanced Options entry and then select the
Expand Filesystem option from the
Advanced Options entry. After you did that, select
Finish to end the configuration.
Working with the external drive
Next thing to do is to run
The output will show you the available disks on your system. Besides the
/dev/mmcblk0p that is the microSD with the PIXEL on it, you will see the
/dev/sda that is the external hard drive to use for your cloud configuration. The hard drive is mounted, therefore you will have to unmount it with the command
once this is done, you can format it if you didn’t do it already. If you did it previously to attaching it to the RPi3, then you should skip the formatting part. Mine is formatted in using NTFS, but I will format it for EXT4 using the command
and following the onscreen options. This will format the partition. The following step is to mount it again. You can choose where to mount it thus I will create a new directory called
"mycloud" inside the home directory.
Now I will mount the external hard drive to that directory using the command
In order for nextCloud to work, we need some extra packages. Among those, there is apache, php, sqlite and nextCloud itself. Thus, first things first. To install apache use the command
Now that you installed apache, you should check and see if it is correctly installed. To do this, open the web browser and insert the RPi3’s IP in the address bar. Check to see if Apache2 is correctly installed.
NextCloud also requires PHP to be installed. In order to install it, you should use the following commands
After php is installed you can now restart the apache service using the command:
First you should download the NextCloud package from the official website using your web browser. On the left side of the page you will see the nextCloud Server section where you should click on the
"Download" button. The archive is around 50 MB in size and the last stable version of the file at the time of writing this article is 11.0.3. By default, the file will be downloaded to your
/Downloads directory. When Apache was installed, it created the directory structure
"/var/www/html/" and we will move the archive there and then extract it. In the terminal, use the following commands:
After the archive was extracted (which could take a little bit of time) you can proceed to the next step.
Create the NextCloud Data Directory
The data directory for the nextCloud to work with should be created on the external hard drive. If you don’t do this, it will use the space on the microSD that the PIXEL uses. Remember that I mounted the external hard drive to the
Now check to see the ownership of the
/data directory by using the command:
The output will be:
In order for nextCloud to know where your
Data Directory is, you need to edit the configuration file. Like this:
Notice that I used nano and did not install vim, as I would have done usually. VIM is not installed by default in PIXEL. Inside the configuration file, add the following:
'datadirectory' => 'PATH_TO_YOUR_DATA', Save the changes to the file and exit.
Set directory owners
Next step is to set the correct directory owners for the nextCloud. First, we will set the directory owners for the
"apps" directories inside the nextcloud directory:
This will set ownership to apache for New ownership for
Create a NextCloud Login
Inside your web browser, enter yout RPi3’s IP location followed by /nextcloud. In my case, my RPi3’s location IP is 192.168.0.17 and I will use the address 192.168.0.17/nextcloud in my browser.
Access your nextcloud interface inside your browser. After you choose a username and a password, it will take several minute for nextCloud to finish setup.
Now you are done setting up NextCloud.