What is Nextcloud ?
Nextcloud is a counter model to the typical cloud offerings of large US providers such as Microsoft.
In this tutorial, I will use the IP address 192.168.0.200, gateway 192.168.0.1 and DNS 220.127.116.11, 18.104.22.168. These settings might differ for you, so you have to replace them where appropriate. You can write the commands below directly in the terminal or remote connect using a SSH client like PuTTY.
Before proceeding further you need to have Raspberry Pi OS Lite / Desktop installed on your Raspberry Pi device. If you don’t already have this, you can use the Tutorial: Installing Raspberry Pi OS to install the Operating System.
- Raspberry Pi board
- Power supply
- Micro SD card 8/16GB
- Ethernet cord
1 Update system.
sudo apt-get update sudo apt-get upgrade -y
2 Configure Network.
sudo nano /etc/dhcpcd.conf
Scroll to the end and the following:
interface eth0 static ip_address=192.168.0.200/24 static routers=192.168.0.1 static domain_name_servers=22.214.171.124 126.96.36.199
Press ctrl + x, and then press y + enter to save.
3 Installing packages.
sudo apt install apache2 php7.3 php7.3-gd php7.3-sqlite3 php7.3-curl php7.3-zip php7.3-xml php7.3-mbstring php7.3-mysql php7.3-bz2 php7.3-intl php7.3-smbclient php7.3-imap php7.3-gmp libapache2-mod-php7.3 mariadb-server mariadb-client php-mysql
4 Configure Mysql
Secure mysql by setting a root password.
Enter current password for root (enter for none): <<ENTER
Change the root password? [Y/n] <<Y
Remove anonymous users? [Y/n] <<ENTER
Disallow root login remotely? [Y/n] <<ENTER
Remove test database and access to it? [Y/n] <<ENTER
Create a user and database for Mysql.
sudo mysql -u root -p
We will be creating database called nextclouddb and a user called
nextclouduser by running the commands below. Make sure that you replace
PASSWORD with a secure password and make note of it for later.
CREATE DATABASE nextclouddb;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
FLUSH PRIVILEGES; EXIT;
Download & Installing.
cd /var/www/ sudo wget https://download.nextcloud.com/server/releases/latest.tar.bz2 sudo tar -xvf latest.tar.bz2 sudo rm latest.tar.bz2
We now need to create a data directory for Nextcloud to operate in, for the initial setup of Nextcloud
sudo mkdir -p /var/www/nextcloud/data sudo chown -R www-data:www-data /var/www/nextcloud/ sudo chmod 750 /var/www/nextcloud/data
sudo nano /etc/apache2/sites-available/nextcloud.conf
Within this file enter the following lines.
Alias /nextcloud "/var/www/nextcloud/" <Directory /var/www/nextcloud/> Require all granted AllowOverride All Options FollowSymLinks MultiViews <IfModule mod_dav.c> Dav off </IfModule> </Directory>
Press ctrl + x, and then press y + enter to save. And then run:
sudo a2ensite nextcloud.conf sudo systemctl reload apache2
Now that we have finished with that we can now finally go to Nextcloud itself and begin its installation process. Open your browser and open the following address:
You will now be greeted with the following screen.
Here you will need to type in the Username and Password that you intend to use for your admin account.
Next, we need to specify the details for our database server. To get to these options you will need to click the “
Storage & Datbase” option.
Now you need to slect the type of database we want to use. As we are using an SQL server click the “
Finally we need to enter the details for our database server. There are three bits of information that we will need to enter.
- The username for the user that will interact with our database server. If you are using the same information we used, this setting should be set to
- The password that you set for the above user.
- The final option you will need to set is the database name. If you have been following our guide this will be
Once you are happy with this, press the “Finish Setup” button, please note this can take some time to complete as it finalises your setup.