ServerGigabit Network

Nextcloud: Step-by-Step Guide to Create a Fast and Reliable Server

You are here:
  • KB Home
  • Nextcloud: Step-by-Step Guide to Create a Fast and Reliable Server
Estimated reading time: 2 min

Nextcloud

A high-performance server is a fantastic option for hosting Nextcloud, a highly popular open-source productivity platform. This comprehensive tutorial covers every step required to install Nextcloud on your high-performance server, equipped with Debian 11 as the operating system and Apache2 serving as a reverse-proxy for the web server.

Firstly, ensure your server is up to date by logging in as root and executing the following command:

apt update && apt upgrade –y

Step 1: Installing Necessary Programs

Begin by installing essential programs like Apache2, PHP, and database software with this command:

apt install apache2 unzip wget curl mariadb-client mariadb-server nano

Step 2: PHP8.0 Installation

PHP8.0 installation requires adding the repository and installing the necessary modules. Follow these sub-steps:

2A: Adding PHP8.0 Repository

Execute these commands in sequence:

apt-get install ca-certificates apt-transport-https software-properties-common -y
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list
apt install gnupg gnupg2 gnupg1 -y
wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -
apt update && apt upgrade -y

2B: Installing PHP8.0 & Modules

Install PHP8.0 and its required modules using:

apt install php8.0 -y
apt install libapache2-mod-php8.0 php8.0-{zip,xml,mbstring,gd,curl,imagick,intl,bcmath,gmp,cli,mysql,apcu,redis}

2C: Adjusting php.ini

Configure the PHP settings by editing the php.ini file:

nano /etc/php/8.0/apache2/php.ini

Modify parameters like memory_limit, upload_max_filesize, post_max_size, and date.timezone as needed.

Step 3: Database Setup

Create a MariaDB database for Nextcloud:

mysql –u root –p
CREATE DATABASE nextcloud;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
exit;

Step 4: Download Nextcloud Files

Download and set up Nextcloud’s files:

cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
rm latest.zip
mv nextcloud /var/www

Step 5: Apache2 Configuration

Configure Apache2 by activating necessary modules and setting up a reverse-proxy:

5A: Activate Modules

a2enmod rewrite headers env dir mime

5B: Reverse-Proxy Setup

Create a configuration file for Nextcloud:

nano /etc/apache2/sites-available/nextcloud.conf

Paste the provided VirtualHost configuration into the file and replace placeholders with your details. Save and exit.

Activate the configuration and restart Apache2:

a2ensite nextcloud.conf
systemctl restart apache2

Step 6: Optional Data Folder Creation

If desired, create a separate location for uploaded data:

mkdir /home/data

Step 7: Permission Adjustments

Ensure proper permissions for Nextcloud files and, if applicable, the uploaded data folder:

chown -R www-data:www-data /var/www/nextcloud
chmod -R 755 /var/www/nextcloud
chown –R www-data:www-data /home/data # Adjust if using a different location

Step 8: SSL Certificate Installation

For enhanced security, install an SSL certificate using Certbot:

apt install certbot python3-certbot-apache -y
certbot --apache

Follow the prompts to install the certificate for your domain.

Step 9: Finalize Installation in Browser

Access your (sub)domain in the browser and complete the installation steps:

  1. Create an admin account.
  2. (Optional) Specify the path if using a separate location for uploaded data.
  3. Enter database credentials:
    • User: nextcloud
    • Password: PASSWORD
    • Name: nextcloud
  4. Click “Install” to complete the setup.

After this, you’ll see a confirmation screen, indicating the successful setup of Nextcloud on your high-performance server. Congratulations on a successful Nextcloud installation!

If you need more step-by-step help or clarification, feel free to check out our detailed guide for further assistance.

Was this article helpful?
Dislike 0
Views: 0