Nextcloud adalah perangkat lunak open source untuk membuat sebuah layanan cloud storage seperti halnya Dropbox atau Google Drive tetapi dapat diinstalasi di server milik sendiri (private server).
Nextcloud server mendukung berbagai distribusi Linux besar, seperti Ubuntu, Debian, Red Hat, CentOS, SUSE, dan openSUSE. Sementara untuk Nextcloud client tersedia untuk versi desktop (Windows, macOS, Linux) dan versi mobile (Android, iOS, Windows Phone).
*0. Kebutuhan Sistem*
Nextcloud server membutuhkan sistem dengan spesifikasi sebagai berikut:
*Operating System*
· Ubuntu 18.04 LTS (direkomendasikan) · Red Hat Enterprise Linux 8 (direkomendasikan) · Debian 10 · SUSE Linux Enterprise Server 15 · openSUSE Leap 42.1+ · CentOS 8
*Database*
· MySQL 5.7+ atau MariaDB 10.2+ (direkomendasikan) · Oracle Database 11g · PostgreSQL 9/10/11 · SQLite (hanya direkomendasikan untuk pengujian)
*Web Server*
· Apache 2.4 dengan mod_php atau php-fpm (direkomendasikan) · nginx dengan php-fpm
*PHP Runtime*
· 7.2 · 7.3 (direkomendasikan) · 7.4 (direkomendasikan)
*Memory* Kapasitas memory yang dibutuhkan tergantung dari seberapa besar jumlah user, app, file dan aktivitas server.
Nextcloud membutuhkan minimum RAM 128MB, direkomendasikan minimum RAM 512MB.
*1. Menyiapkan Server CentOS 8*
Tutorial ini menggunakan VPS CentOS 8 di UpCloud dengan spesifikasi CPU 1 core, RAM 1GB, dan Storage 25GB.
UpCloud Virtual Private Server
Login SSH ke server, update sistem.
[INPUT]1 dnf update -y
Install *langpack* untuk mengatasi pesan error *Failed to set locale, defaulting to C.UTF-8*.
[INPUT]1 dnf install langpacks-en glibc-all-langpacks -y
Install EPEL repository.
[INPUT]1 dnf install epel-release -y
Install paket pendukung.
[INPUT]1 dnf install unzip curl wget bash-completion mlocate policycoreutils-python-utils -y
*2. Menghubungkan Domain dengan Server*
Tutorial ini menggunakan subdomain *cloud.defnex.com*. Di DNS manager, buat *A record* dengan *hostname cloud.defnex.com* dan *server IP address*.
Defnex.com DNS Records
ping domain untuk menguji apakah sudah terhubung ke server.
[INPUT]1 2 3 4 5 6 ping cloud.defnex.com PING cloud.defnex.com (94.237.74.88) 56(84) bytes of data. 64 bytes from 94-237-74-88.sg-sin1.upcloud.host (94.237.74.88): icmp_seq=1 ttl=53 time=25.0 ms 64 bytes from 94-237-74-88.sg-sin1.upcloud.host (94.237.74.88): icmp_seq=2 ttl=53 time=29.1 ms 64 bytes from 94-237-74-88.sg-sin1.upcloud.host (94.237.74.88): icmp_seq=3 ttl=53 time=34.6 ms
*3. Install Apache Web Server*
Install Apache web server.
[INPUT]1 dnf install httpd -y
Aktifkan dan jalankan service httpd.
[INPUT]1 2 3 systemctl enable –now httpd systemctl start httpd systemctl status httpd
Masukkan protokol http ke dalam FirewallD.
[INPUT]1 2 3 firewall-cmd –add-service=http –permanent firewall-cmd –reload firewall-cmd –list-services
-Apache virtual host-
Membuat file konfigurasi Apache virtual host untuk domain/subdomain.
[INPUT]1 2 cd /etc/httpd/conf.d nano cloud.defnex.com.conf
Isi dari file konfigurasi virtual host.
[INPUT]1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Membuat direktori document root.
[INPUT]1 2 cd /var/www mkdir cloud.defnex.com
Membuat file *index.html* untuk pengujian virtual host.
[INPUT]1 2 cd cloud.defnex.com echo “cloud.defnex.com” > index.html
Menguji konfigurasi Apache, hasilnya *Syntax OK*.
[INPUT]1 2 3 apachectl -t Syntax OK
Restart httpd service.
[INPUT]1 2 systemctl restart httpd systemctl status httpd
Tes akses http://cloud.defnex.com.
Browse http://cloud.defnex.com
*4. Install SSL*
Install Certbot Let’s Encrypt.
[INPUT]1 dnf install certbot python3-certbot-apache -y
Nonaktifkan konfigurasi default SSL virtual host.
[INPUT]1 2 3 cd /etc/httpd/conf.d mv ssl.conf ssl.conf.off systemctl restart httpd
Request sertifikat SSL untuk subdomain cloud.defnex.com.
[INPUT]1 certbot –apache -d cloud.defnex.com
Masukkan informasi yang diminta.
[INPUT]1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Enter email address (used for urgent renewal and security notices) (Enter ‘c’ to cancel): address@email.com – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – (A)gree/(C)ancel: A – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let’s Encrypt project and the non-profit organization that develops Certbot? We’d like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – (Y)es/(N)o: N
SSL sukses terinstall.
[INPUT]1 Congratulations! You have successfully enabled https://cloud.defnex.com
SSL Let’s Encrypt
Masukkan protokol https ke dalam FirewallD.
[INPUT]1 2 3 firewall-cmd –add-service=https –permanent firewall-cmd –reload firewall-cmd –list-services
Tes akses https://cloud.defnex.com.
Browse https://cloud.defnex.com
*5. Install PHP*
Versi PHP yang tersedia di default repository CentOS 8 adalah PHP 7.2. Untuk bisa menjalankan PHP 7.4 pasang REMI repository.
[INPUT]1 dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
Aktifkan PHP 7.4 module stream.
[INPUT]1 dnf module enable php:remi-7.4 -y
Install PHP 7.4 beserta extension yang dibutuhkan oleh Nextcloud server.
[INPUT]1 dnf install php74 php74-php php74-php-common php74-php-fpm php74-php-cli php74-php-gd php74-php-mbstring php74-php-intl php74-php-pecl-apcu php74-php-mysqlnd php74-php-opcache php74-php-json php74-php-zip -y
Aktifkan dan jalankan PHP-FPM service.
[INPUT]1 2 3 systemctl enable –now php74-php-fpm systemctl start php74-php-fpm systemctl status php74-php-fpm
Restart httpd service.
[INPUT]1 systemctl restart httpd
Membuat file *info.php* untuk tes PHP.
[INPUT]1 2 cd /var/www/cloud.defnex.com echo “” > info.php
PHP Information
Jika PHP sudah bisa berjalan dengan baik, hapus file info.php dan index.html.
[INPUT]1 rm -f info.php index.html
*6. Install MariaDB Database*
Install MariaDB database.
[INPUT]1 dnf install mariadb-server -y
Aktifkan dan jalankan service MariaDB.
[INPUT]1 2 3 systemctl enable mariadb systemctl start mariadb systemctl status mariadb
Amankan instalasi MariaDB.
[INPUT]1 mysql_secure_installation
Jawab pertanyaannya.
[INPUT]1 2 3 4 5 6 Enter current password for root (enter for none): ENTER Set root password? [Y/n] Y Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Login ke MariaDB.
[INPUT]1 mysql -u root -p
Membuat database dan user untuk Nextcloud.
[INPUT]1 2 3 4 5 CREATE DATABASE nextcloud; CREATE USER ‘usrnxtcld’@’localhost’ IDENTIFIED BY ‘thesecret’; GRANT ALL PRIVILEGES ON nextcloud.* TO ‘usrnxtcld’@’localhost’; FLUSH PRIVILEGES; EXIT;
*7. Install Nextcloud Server*
Download Nextcloud server, ekstrak, dan copy ke direktori document root.
[INPUT]1 2 3 wget https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip unzip nextcloud-19.0.1.zip cp -R nextcloud/* /var/www/cloud.defnex.com
Mengubah ownership dan permission document root.
[INPUT]1 2 3 cd /var/www chown -R apache:apache cloud.defnex.com chmod -R 755 cloud.defnex.com
Cek apakah SELinux aktif.
[INPUT]1 2 3 getenforce Enforcing
Jika SELinux aktif (Enforcing), restore context document root sebagai file web.
[INPUT]1 2 semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/cloud.defnex.com(/.*)?’ restorecon -Rv ‘/var/www/cloud.defnex.com’
Akses https://cloud.defnex.com untuk install Nextcloud.
Membuat admin account.
Admin account
Konfigurasi database, klik *Storage & database*, klik *MySQL/MariaDB*. Masukkan username, password, dan database.
Storage & database
Centang *Install recommended apps* jika ingin menginstalasi aplikasi Calendar, Contacts, Talk, Mail, & Collaborative editing.
Terakhir, klik *Finish setup*.
Finish setup
Installing apps
Nextcloud sudah selesai terinstall.
Nextcloud dashboard
Selamat mencoba ð