Skip to main content

Migrasi Nextcloud 19 ke Nextcloud 20.02 (Beda Server)

Server A : 192.168.0.1 (Server lama : Centos 7), port 80
Server B : 192.168.0.2 (Server baru : Centos 8), port 80
Nginx Load Balance : 192.168.0.10, port 443 untuk SSL



Tahapan :
1. Upgrade Nextcloud 19.0.3 ke 19.0.5 (server lama)
2. Instalasi server baru (Centos 8)
3. Backup dan restore data nextcloud dan databas ke server baru
4. Konfigurasi Nextcloud di server baru dan Nginx Server
5. Finish




A. Upgrade Nextcloud 19.0.3 ke 19.0.5

Untuk Upgrade 19.0.3 ke 20.0.2 tidak dapat dijalankan secara langsung. Harus bertahap upgrade ke versi minor. 19.0.3 -> 19.0.5 secara otomais. Dan upgrade ke 20.0.2 secara manual.

1. Login ke Nextcloud
2. Setting - Administration-Overview
3. Versi yang tersedia 19.0.5
5. Pilih Open updater 

4. Start Update


5.  Pilih No (for usage of the web based updater), untuk mode maintenance dan upgrade via console.

6. Masuk ke console dan ke directory /var/www/html/nextcloud
7. Jalankan $ sudo -u apache php occ upgrade


8. Maintenance mode masih dalam keadaan aktif. Harus dinonaktifkan.

Jalankan : sudo -u apache php occ maintenance:mode --off

9. Login kembali via web dan Cek versi yang sudah upgrade. Versi upgrade Nextcloud 19.0.5




B. Instalasi Server Baru Centos 8

1. Instalasi Server Centos 8 standar :
- mariadb 10.3
- httpd
- php 7.4

2. Check php module.

  • PHP (>= 7.0, 7.1 or 7.2)
  • PHP module ctype
  • PHP module curl
  • PHP module dom
  • PHP module GD
  • PHP module iconv
  • PHP module JSON
  • PHP module libxml (Linux package libxml2 must be >=2.7.0)
  • PHP module mbstring
  • PHP module openssl
  • PHP module posix
  • PHP module session
  • PHP module SimpleXML
  • PHP module XMLReader
  • PHP module XMLWriter
  • PHP module zip
  • PHP module zlib
  • PHP module pdo_mysql 
  • PHP module fileinfo (highly recommended, enhances file analysis performance)
  • PHP module bz2 (recommended, required for extraction of apps)
  • PHP module exif (for image rotation in pictures app)
  • PHP module gmp (for SFTP storage)
  • PHP module apcu (>= 4.0.6)
  • PHP module memcached
  • PHP module redis (>= 2.2.6, required for Transactional File Locking)

C. Backup dan Restore Data Nextcloud dan Database ke Server Baru

1. Backup data nextcloud, jalankan di server lama
    $ sudo -rsync -Aavx /var/www/html/nextcloud root@192.168.0.2:/var/www/html/
    
2. Backup database di server lama
    $ sudo mysqldump --single-transaction -h 192.168.0.2 -u nextcloud -b nextcloud > nextcloud.sql


D. Konfigurasi Nextcloud di server baru dan Nginx Server

1. Create database dan user privileges, dengan nama db nextcloud
2. Restore database
    $ sudo mysql -u root -p -b nextcloud < nextcloud.sql
Troubleshooting : error error max kength 767
Edit di my.cnf
[mysqld]
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
3. Download nextcloud-20.0.2.zip. Extrab ck file
4. Pindahkan hasil extrak file ke /var/www/html
5. $ sudo chown -R apache.apache /var/www/html/nextcloud
    $ sudo find nextcloud/ -type d -exec chmod 750 {} \;
    $ sudo find nextcloud/ -type f -exec chmod 640 {} \;
    $ sudo -u www-data php occ upgrade
6. Login Web Nextcloud, check di bagian overview untuk melihat status upgrade.


Troubleshooting :
Ada banyak beberapa yang error di status.


Kita selesaikan satu persatu untuk masalah ini.

a. Error
The database is missing some primary keys. Due to the fact that adding primary keys on big tables could take some time they were not added automatically. By running "occ db:add-missing-primary-keys" those missing primary keys could be added manually while the instance keeps running.
Missing primary key on table "oc_federated_reshares".
Missing primary key on table "oc_systemtag_object_mapping".
Missing primary key on table "oc_comments_read_markers".
Missing primary key on table "oc_collres_resources".
Missing primary key on table "oc_collres_accesscache".
Missing primary key on table "oc_filecache_extended".




Masuk ke directory /var/www/html/nextcloud
sudo -u apache php occ db:add-missing-primary-keys
sudo -u apache php occ db:conver-t-filecache-bigint

b. Error

Pastikan redis dan php-redis terinstall. Dikarenakan SSL berada di nginx server lain. Maka kita harus menambahkan command di konfigurasi nginx server 192.168.0.10.
file nextcloud.conf.
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'redis' => [
     'host' => 'nextcloud.sample.com',
     'port' => 6379,
],


c. Error
Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the documentation.
Your web server is not properly set up to resolve "/.well-known/carddav". Further information can be found in the documentation.
Edit di nginx konfigurasi 
        location = /.well-known/carddav     { return 301 /remote.php/dav/; }
        location = /.well-known/caldav      { return 301 /remote.php/dav/; }


d, Error
The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the security tips ↗

Edit di nginx konfigurasi 

add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;



6. Finish 






Popular posts from this blog

Freenas Snapshots Replication Backup

Mungkin anda sudah mengetahui Freenas sebelumnya. Ya..Freenas adalah salah satu software NAS Storage berbasis FreeBSD. Karena kehandalannya, Freenas banyak digunakan sebagai NAS Storage di dunia IT. Saya pernah berfikir bagaimana jika Freenas yang kita gunakan mengalami masalah, crash misalnya. Mungkin jika hardisknya menggunakan RAID bisa tinggal ganti disknya. Bagaimana jika tidak ada RAID (hari gini Server gak ada Raid hdewww heee) atau hal lain yang membuat data tidak bisa digunakan di Freenas. Tutorial ini saya buat untuk berbagi ilmu kepada rekan2 sekalian. Saya akan coba membuat Replikasi Freenas. Dimana Dataset pada salah satu Freenas (Freenas A) akan di snapshot dan di replikasikan ke Freenas B Hal yang perlu disiapkan : 1.  Freenas A : 192.168.100.1 (Primary) Disk 8GB x 2 2.  Freenas B : 192.168.100.2 (Secondary) Disk 8GB x 2 SETING FREENAS A DAN B Kita akan buat raid mirror untuk 2 disk. Storage - Volume Manager   Volume Name :

Zimbra Error Subject : ***UNCHECKED***

Beberapa hari yang lalu Subject email Zimbra selalu di tambahkan tulisan ***UNCHECKED***. Padahal tidak ada perubahan konfigurasi mail server sebelumnya. Cari di google ada beberapa referensi yaitu merubah file /opt/zimbra/. Tahapan : #su root #cd /opt/zimbra/amavisd/bin #cp -pa amavisd amavid.org #vi amavisd Rubah isi file di baris : #su zimbra $undecipherable_subject_tag = '***UNCHECKED*** '; menjadi $undecipherable_subject_tag = '';   $zmamavisdctl restart Di hari berikutnya saya coba cek kembali utilisasi mail dengan 'top'. Terilhat penggunaan clamd sebesar 100%. Coba dicek di log /var/log/zimbra.log |grep clamd hasilnya mail amavis[26778]: (26778-07) ClamAV-clamd: All attempts (1) failed connecting to /opt/zimbra/data/clamav/clamav.sock, retrying (1) Oct 24 10:10:43 mail amavis[26778]: (26778-07) (!)connect to /opt/zimbra/data/clamav/clamav.sock failed, attempt #1: Can't connect to UNIX socket /opt/zimbra/data/clamav/clamav.sock: Co