Install dan konfigurasi NextCloud di Debian 10

Instalasi

Install Apache

sudo apt install apache2

Install PHP

Pasang repository tambahan untuk PHP versi 7.4

sudo apt -y install lsb-release apt-transport-https ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Update repository

sudo apt update

Install PHP 7.4

sudo apt -y install php7.4

Install extension/module

sudo apt -y install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-cli php7.4-intl imagemagick git unzip zip libgd-dev libapache2-mod-php libphp-adodb php-bz2 php-imap php-apcu php-memcached php-redis

Install MariaDB

sudo apt install mariadb-server

Konfigurasi

(Jika dibutuhkan) Setting kapasitas maksimal upload

nano /etc/php/7.3/apache2/php.ini
memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 300
date.timezone = Asia/Jakarta

Restart Apache

sytemctl restart apache2

Konfigurasi database

mysql_secure_installations

Jika muncul pertanyaan

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 

Tekan Enter

Jika muncul pertanyaan

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y

Jawab Y, Lalu masukkan password baru

Jika muncul pertanyaan

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y

Jawab Y

Jika muncul pertanyaan

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y

Jawab Y

Jika muncul pertanyaan

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y

Jawab Y

Jika muncul pertanyaan

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y

Jawab Y

Masuk ke MariaDB

mysql -u root -pkatasandi

Membuat user untuk mengelola database NextCloud

CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';

Membuat database

create database nama_database;

Berikan akses/izin untuk user yang akan mengelola database NextCloud

GRANT ALL PRIVILEGES ON nama_database.* TO 'user_database'@'localhost';
FLUSH PRIVILEGES;

Download NextCloud menggunakan web browser

Kunjungi https://nextcloud.com/install/#instructions-server, Lalu klik Download NextCloud

Download Nextcloud menggunakan wget

Klik kanan pada tombol Download NextCloud > Copy Link

wget link-download

Extract

unzip nama-file

Jika Nextcloud akan diletakkan di internet buat virtualhost lalu pidahkan direktori hasil extract ke direktori document root yang sudah ditentukan pada konfigurasi virtualhost

Jika Nextcloud akan di letakkan di lokal network tanpa menggunakan domain pindahkan ke direktoi /var/ww/html/

mv nextcloud /var/www/html/

Ubah kepemilikan dan izin direktori nextcloud

chown -R www-data:www-data /var/www/html/nextcloud/
chmod -R 775 /var/www/html/nextcloud/

Restart Apache

systemctl restart apache2

Akses web interface NextCloud melalui web browser

IP-ADDRESS/nextcloud
Tampilan awal nextcloud

Buat akun admin. masukan user, password, dan nama database yang telah dibuat, lalu finish setup

Keterangan artikel

Tested on: Debian 10
Sumber & refrensi:
https://www.linuxid.net/33968/cara-install-dan-konfigurasi-nextcloud-di-debian-10/