Cara menggunakan nextcloud/config php timezone

Nextcloud memiliki versi klien yang tersedia untuk sistem operasi iOS, Andorid, Windows, Mac dan Linux sehingga tidak masalah sistem apa yang perusahaan Anda pakai atau jika karyawan Anda ingin menjalankan sistem yang berbeda. Mungkin bagian pemasaran menginginkan Mac mereka dan Pengembang lebih nyaman dengan menggunakan Ubuntu Linux. Nextcloud akan dapat berfungsi dan bekerja pada semua operating sistem yang disebutkan tadi!

Disini saya akan membahas bagaimana menginstall nextcloud di server pribadi kita,tentu saja kita harus memiliki server dengan ip publik untuk bisa mengakses nya secara jarak jauh .

MARIADB DATABASE

Install terlebih dahulu Mariadb database

$ sudo apt-get install mariadb-server mariadb-client

Aktifkan database service dan jalankan servicenya

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service

Amankan database dengan menghapus user dan DB yang tidak diperlukan, sekaligus mengganti root password menjadi sebagai contoh AgusCool19.

$ mysql_secure_installation
Enter current password for root (enter for none): Just press the Enter
Set root password? [Y/n]: Y
New password: AgusCool19
Re-enter new password: Repeat password
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

Modifikasi berkas konfigurasi Mariadb yaitu /etc/mysql/mariadb.conf.d/50-server.cnf. menjadi seperti contoh dibawah.

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]
# this is for nexcloud setup START
skip-name-resolve
innodb_buffer_pool_size = 128M
innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90
query_cache_type = 1
query_cache_limit = 2M
query_cache_min_res_unit = 2k
query_cache_size = 64M
tmp_table_size= 64M
max_heap_table_size= 64M
slow-query-log = 1
slow-query-log-file = /var/log/mysql/slow.log
long_query_time = 1
# this is for nexcloud setup END

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
skip-external-locking

# this is for nextcloud setup START
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
transaction_isolation = READ-COMMITTED
binlog_format = ROW
innodb_large_prefix=on
innodb_file_format=barracuda
innodb_file_per_table=1
# this is for nexcloud setup END

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address		= 127.0.0.1

#
# * Fine Tuning
#
key_buffer_size		= 16M
max_allowed_packet	= 16M
thread_stack		= 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam_recover_options  = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
query_cache_limit	= 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file	= /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit	= 1000
#log_slow_verbosity	= query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id		= 1
#log_bin			= /var/log/mysql/mysql-bin.log
expire_logs_days	= 10
max_binlog_size   = 100M
#binlog_do_db		= include_database_name
#binlog_ignore_db	= exclude_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ..when MariaDB is compiled with OpenSSL:
# ssl-cipher=TLSv1.2
# ..when MariaDB is compiled with YaSSL (default in Debian):
# ssl=on

#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]


Membuat database baru untuk nexcloud dengan menjalankan satu baris perintah di bawah ini.

mysql -u root -pAgusCool19 -e "create database myclouddb; GRANT ALL PRIVILEGES ON myclouddb.* TO [email protected] IDENTIFIED BY 'mycloudpass2019'";

Reload privileges.

mysql -u root -pAgusCool19 -e "flush PRIVILEGES";
  • Password root AgusCool19
  • Nama database myclouddb
  • Nama user database myclouduser
  • Password database mycloudpass2019


APACHE WEBSERVER DAN PHP 7.2

Disini saya akan menggunakan PHP 7.2 dan saya tidak bisa mendapatkan versi ini di repo ubuntu standar.
Nextcloud bisa berfungsi secara optimal jika menggunakan php 7.2 dan untuk menginstal php 7.2 terlebih dahulu tambah kan repo ondrej.

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php

Selanjutnya jalankan perintah dibawah ini untuk menginstall php 7.2 beserta modul-modul pendukungnya.

$ sudo apt update
$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip php-redis php-memcached

Sesuaikan atau tambahkan konfigurasi php standart di berkas /etc/php/7.2/apache2/php.ini menjadi seperti dibawah ini

$ sudo nano /etc/php/7.2/apache2/php.ini
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Asia/jakarta

Restart apache2 untuk memastikan perubahan yang kita buat sudah berjalan tanpa kendala.

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
0

Jalankan perintah di bawah untuk membuat berkas phpinfo.php yang berguna untuk melakukan pengecekan versi php dan module2 php sudah terload dengan sempurna.

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
1

Ketikan baris dibawah berikut

<?php phpinfo( ); ?>

Buka browser di komputer lain dan check versi php

  • Cara menggunakan nextcloud/config php timezone


DOWNLOAD DAN INSTALL NEXTCLOUD

Unduh terlebih dahulu archive nextcloud dan extract.

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
2

Kemudian jalankan perintah untuk merubah permission dari file dan folder nexcloud menjadi milik user webserver yaitu www-data user dan group sehingga user tersebut memiliki hak read/write akses.

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
3


APACHE2 VIRTUALHOST

Web nextcloud belum bisa di akses sebelum kita menkonfigurasikan apache2 virtualhost.
Menuju ke folder /etc/apache2/sites-available/ dan buat berkas baru dengan nama nextcloud.conf, berikut langkah-langkahnya.

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
4

Paste-kan baris-baris dibawah ini ke dalam berkas nextcloud.conf

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
5

Virtualhost sudah dibuat saatnya mengaktifkan nextcloud site dan modul-modul apache2

Disable terlebih dahulu default web

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
6

Enable nextcloud web

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
7

Kembali restart apache2

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
8

Buka web browser lalu ketikan http://ip-server , setelah itu kita akan diminta untuk membuat user baru sebagai administrator, database user & password dll diakhiri dengan menekan tombol Finish Setup.

  • Cara menggunakan nextcloud/config php timezone
    NEXTCLOUD INITIAL INSTALL

Secara otomatis kita akan di bawa menuju halaman storage user admin, disitu kita bisa mengelola user, limitasi quota, mengaktifkan/menonaktifkan apps

  • Cara menggunakan nextcloud/config php timezone
  • Cara menggunakan nextcloud/config php timezone


UPGRADE NEXTCLOUD

Proses upgrade merupakan salah satu proses yang beresiko, sehingga perlu dilakukan persiapan sebelum melakukan proses upgrade.
Hal yang yang menurut saya penting dan harus menjadikan bahan pertimbangan adalah

  • Backup konfigurasi sistem yang sudah berjalan dengan menyalin berkas /var/www/html/nextcloud/config/config.php ke tempat yg aman entah itu ext hardisk maupun laptop pribadi anda.
  • Sebaiknya folder DATA yang berisi file-file user di letakan di luar root directory nextcloud, disarankan untuk di letakan di partisi terpisah dari sistem operasi.
  • Ketika nextcloud anda sudah tertinggal beberapa versi major jangan melakukan direct upgrade langsung ke versi yang lebih tinggi tapi selangkah demi selangkah naik versi.
  • Backup database sebelum melakukan upgrade, INGAT pastikan database bisa di restored dengan melakukan validasi integritas file backup dari database.

Untuk meng-upgrade versi nextcloud relatif mudah dan disarankan untuk upgrade melalui command line di terminal untuk menghindari connection timeout jika kita upgrade menggunakan web gui.
Setelah semua persiapan sudah kita jalankan lakukan ekseskusi perintah di terminal sebagai berikut.

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service
9

Sampai di sini nextcloud sudah bisa digunakan untuk menyimpan berkas-berkas pribadi anda dan juga melakukan share berkas melalui web browser, untuk cara menginstal klien nextcloud dan cara penggunaan client akan dibahas lebih lanjut di artikel saya selanjutnya.