Install Nextcloud 16.x on Raspberry Pi (Buster)

Fire up Nextcloud 16 on that shiny new Raspberry Pi and put it to some good use!

What you need

In order to successfully install Nextcloud 16, you need the following:

  • A Raspberry Pi running raspbian buster with a static IP address (or Fully Qualified Domain Name – FQDN).
  • A user account with sudo privileges.

I’ll demonstrate on a server with a static IP address. If you plan on accessing your Nextcloud server from outside your LAN, you’ll not only want to configure it with your FQDN but also with HTTPS.

With those things in hand, let’s work.

Update/upgrade

Before we install Nextcloud, make sure that your server is updated and upgraded. Do note, should your kernel be upgraded, you’ll need to reboot the server. Because of this, make sure to run the update/upgrade at a time when a reboot is possible (unless you have live patching installed, at which point you can run the task any time). To update and upgrade, log into the server to host Nextcloud and issue the following commands:

sudo apt-get update
sudo apt-get upgrade -y

Once that process completes, reboot the server (if necessary). You’re now ready to install.

LAMP

The first thing we must do is install the LAMP (Linux Apache MariaDB PHP) server stack. This can be done with the following command:

sudo apt-get install apache2 mariadb-server apt-transport-https -y
Install the PHP packages (and other dependencies) with the command:
sudo apt-get install libapache2-mod-php php7.3 php7.3-xml php7.3-curl php7.3-gd php7.3 php7.3-cgi php7.3-cli php7.3-zip php7.3-mysql php7.3-mbstring

PHP must be configured. This is done in the php.ini file. Open the file for editing with the command:

sudo nano /etc/php/7.3/apache2/php.ini

Make sure to locate and edit the following lines as such:

memory_limit = 512M
upload_max_filesize = 1G
max_execution_time = 360
post_max_size = 1G

Save and close that file.

Configure MariaDB and create the database

The MariaDB installation needs to be secured with a password. To do this, issue the command:

sudo mysql_secure_installation

You will be asked to set a new password. Once you do that, answer yes to the remaining questions.

To create the necessary database, enter the MariaDB prompt with the command:

sudo mysql -u root

Once in the prompt, issue the following commands:

CREATE DATABASE nextclouddb;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
exit

where PASSWORD is a strong/unique password.


Installing Nextcloud

And now we can install the Nextcloud server. Before we do, let’s create a new directory (and give it the proper permissions) with the following commands:

sudo chown www-data:www-data /var/www/html
sudo mkdir -p /var/nextcloud/data
sudo chown www-data:www-data /var/nextcloud/data
sudo chmod 750 /var/nextcloud/data

Download and unpack the Nextcloud installer file with the following commands:

cd  /var/www/html
sudo wget https://download.nextcloud.com/server/installer/setup-nextcloud.php
sudo chown www-data:www-data setup-nextcloud.php

Now perform a reboot.

sudo reboot

Point a browser to http://SERVER_IP/setup-nextcloud.php (where SERVER_IP is the IP address of the hosting server) and walk through the installation wizard.

Happy Cloud computing!

_-=Cinsei=-_

Add Comment