Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Friday, 3 July 2026

Hitung berapa jumlah file php

 

Dari daftar yang Anda tampilkan, terdapat 141 file berekstensi .php di direktori:

/var/www/html/moodle/local/jurnalmengajar

Perhitungan tersebut tidak menghitung:

  • Direktori (amd, assets, classes, cli, css, db, lang, pix, templates, vendor, dll.)

  • File non-PHP seperti:

    • composer.json

    • composer.lock

    • jadwal_pengawas.json

  • File backup seperti:

    • export_berita_acara_pdf.php.save

    • tv.php.save

    • tv.php.save.1

Jika yang dimaksud adalah semua file PHP secara rekursif (termasuk di dalam classes/, cli/, db/, dll.), maka jumlahnya akan lebih banyak. Anda bisa mengeceknya langsung di Debian dengan:

find /var/www/html/moodle/local/jurnalmengajar -type f -name "*.php" | wc -l

atau untuk melihat daftarnya:

find /var/www/html/moodle/local/jurnalmengajar -type f -name "*.php" | sort

Sunday, 8 March 2026

isi homepage

root@debian:~# cat /opt/homepage/services.yaml
- Server Sekolah:
    - Website Sekolah:
        href: https://sman2kandangan.sch.id
        icon: mdi-school
        siteMonitor: https://sman2kandangan.sch.id

    - Sistem SiM:
        href: https://sim.sman2kandangan.sch.id
        icon: mdi-monitor-dashboard
        siteMonitor: https://sim.sman2kandangan.sch.id

    - CBT Smandaka:
        href: https://cbt.sman2kandangan.sch.id
        icon: mdi-clipboard-check
        siteMonitor: https://cbt.sman2kandangan.sch.id

- Cloud:
    - Nextcloud:
        href: https://cloud.sman2kandangan.sch.id
        icon: nextcloud.png
        container: nextcloud_app

    - OnlyOffice:
        href: https://office.sman2kandangan.sch.id
        icon: onlyoffice.png
        container: onlyoffice

- Media:
    - Immich Photos:
        href: https://photos.sman2kandangan.sch.id
        icon: immich.png
        container: immich_server

    - Jellyfin Media:
        href: https://jelly.sman2kandangan.sch.id
        icon: jellyfin.png
        container: jellyfin

- Monitoring:
    - Docker Portainer:
        href: https://docker.sman2kandangan.sch.id
        icon: portainer.png

    - Uptime Kuma:
        href: https://uptime.sman2kandangan.sch.id
        icon: uptime-kuma.png

    - Netdata:
        href: http://100.70.179.70:19999
        icon: netdata.png

- Network:
    - Pi-hole DNS:
        href: http://100.70.179.70:8090/admin
        icon: pi-hole.png

    - Modem Indihome:
        icon: router
        href: http://192.168.200.1/index.asp

=========================================== 

Simpan lalu restart Homepage

docker restart homepage



Remote admin gateway server

 

Benar Guru Duan 👍
Konsep remote admin gateway sekolah itu memang dibuat dengan perintah:

sudo tailscale up --advertise-routes=192.168.200.0/24

Saya jelaskan pelan-pelan supaya jelas cara kerjanya.


1️⃣ Kondisi jaringan Guru Duan sekarang

Di sekolah:

Internet
   │
Modem Indihome (192.168.200.1)
   │
Server Debian (192.168.200.x)
   │
Perangkat lain:
   ├ printer
   ├ access point
   ├ CCTV
   └ komputer lain

Server Debian juga sudah terhubung ke Tailscale.

Di rumah:

Laptop Guru Duan
   │
Internet
   │
Tailscale

2️⃣ Masalah tanpa subnet routing

Tanpa konfigurasi tambahan:

Laptop rumah hanya bisa akses:

100.x.x.x (IP Tailscale server)

contoh:

http://100.70.179.70:3000

tetapi tidak bisa akses jaringan sekolah seperti:

192.168.200.1
192.168.200.10
192.168.200.20

karena itu LAN lokal.


3️⃣ Fungsi perintah advertise-routes

Perintah ini:

sudo tailscale up --advertise-routes=192.168.200.0/24

memberitahu jaringan Tailscale:

Server Debian ini bisa menjadi router menuju jaringan sekolah 192.168.200.x

Setelah aktif, alur jaringan menjadi:

Laptop rumah
      │
      │ Tailscale
      ▼
Server Debian sekolah
      │
      │ LAN sekolah
      ▼
192.168.200.x

4️⃣ Hasil yang Guru Duan dapatkan

Dari rumah bisa langsung membuka:

Modem

http://192.168.200.1

Printer

http://192.168.200.20

Access Point

http://192.168.200.2

CCTV

http://192.168.200.50

Server lain

ssh 192.168.200.10

Tanpa:

❌ port forwarding
❌ VPN tambahan
❌ membuka firewall sekolah

Semua lewat Tailscale encrypted tunnel.


5️⃣ Keuntungan besar metode ini

🔒 Lebih aman dari port forwarding

Port forwarding:

Internet → modem → server

rentan scan hacker.

Tailscale:

Laptop → encrypted tunnel → server

hanya device Tailscale yang bisa akses.


🧑‍💻 Remote admin sekolah dari rumah

Guru Duan bisa mengelola:

  • modem Indihome

  • server Moodle

  • Docker

  • printer jaringan

  • AP wifi

  • CCTV

seolah-olah sedang berada di sekolah.


6️⃣ Tidak mempengaruhi layanan server

Ini tidak mengganggu:

  • Docker

  • Nextcloud

  • Moodle

  • Homepage dashboard

  • Jellyfin

  • Immich

IP Tailscale tetap:

100.70.179.70

7️⃣ Bahkan bisa akses printer jaringan

Contoh printer sekolah:

192.168.200.25

dari rumah bisa langsung:

ping 192.168.200.25

atau add printer IP.


8️⃣ Setup lengkap hanya 3 langkah

Di server Debian:

aktifkan forwarding

net.ipv4.ip_forward=1

advertise route

sudo tailscale up --advertise-routes=192.168.200.0/24

approve route di admin tailscale

https://login.tailscale.com/admin/routes

⚡ Fakta menarik

Cara ini dipakai banyak admin IT untuk membuat:

"private network kantor / sekolah dari rumah"

tanpa perlu:

  • Mikrotik VPN

  • OpenVPN

  • Wireguard manual

karena Tailscale otomatis mengurus semuanya.


💡 Melihat server Guru Duan yang sudah ada:

  • Docker

  • Nextcloud

  • Jellyfin

  • Immich

  • Uptime Kuma

  • Netdata

sebenarnya tinggal satu langkah lagi bisa menjadi:

Remote Control Center sekolah dari rumah.

Kalau Guru Duan mau, saya bisa tunjukkan setup yang lebih keren lagi:

akses semua device sekolah pakai nama, bukan IP

contoh:

http://modem-sekolah
http://printer-guru
http://cctv-lobby

Ini biasanya dipakai admin jaringan profesional.

Wednesday, 25 February 2026

Edit sudo nano /etc/cups/cupsd.conf untuk Print melalui server debian

 

Baik Guru Duan, ini sudah jelas penyebab utamanya 👍

Masalahnya ada di sini:

Allow 192.168.100.0/24

Padahal sekarang jaringan Anda:

192.168.200.xxx

Jadi CUPS hanya mengizinkan jaringan lama (100) → jaringan baru (200) otomatis Forbidden.


✅ SOLUSI CEPAT & AMAN (Rekomendasi)

Kita ganti semua 192.168.100.0/24192.168.200.0/24


1️⃣ Edit File

sudo nano /etc/cups/cupsd.conf

2️⃣ Ganti Bagian Ini (ADA 3 TEMPAT)

🔹 Bagian <Location />

Ubah dari:

Allow 192.168.100.0/24

Menjadi:

Allow 192.168.200.0/24

🔹 Bagian <Location /admin>

Ubah juga:

Allow 192.168.200.0/24

🔹 Bagian <Location /admin/log>

Ubah juga:

Allow 192.168.200.0/24

3️⃣ (Lebih Simpel & Fleksibel) Pakai @LOCAL (Opsional)

Kalau mau supaya tidak perlu ubah tiap ganti subnet, boleh ganti semua itu jadi:

Allow @LOCAL

Contoh:

<Location />
  Order allow,deny
  Allow localhost
  Allow 127.0.0.1
  Allow @LOCAL
</Location>

Ini otomatis izinkan semua LAN.

👉 Saya sarankan cara ini untuk server sekolah 👍


4️⃣ Restart CUPS

Wajib setelah edit:

sudo systemctl restart cups

5️⃣ Test Lagi

Buka dari HP / PC:

http://192.168.200.20:631

Sekarang harusnya sudah masuk.


✅ BONUS: Supaya Client Bisa Print Langsung

Karena printer USB di server, client print lewat server.

Pastikan ada baris ini (sudah ada, bagus):

Browsing On
BrowseLocalProtocols dnssd

Kalau belum muncul di client, restart juga Avahi:

sudo systemctl restart avahi-daemon

🎯 KESIMPULAN

❌ Bukan printer rusak
❌ Bukan CUPS rusak
❌ Bukan server rusak

✅ Hanya subnet berubah → akses diblok
✅ Tinggal ganti Allow → normal lagi


Kalau setelah ini masih belum bisa print dari client, kirim:

lpstat -r
lpstat -a

Nanti kita cek sharing-nya juga.

Sunday, 22 February 2026

Setup Nextdns di debian SiM server

 # sh -c "$(curl -sL https://nextdns.io/install)"
INFO: OS: debian
INFO: GOARCH: amd64
INFO: GOOS: linux
INFO: NEXTDNS_BIN: /usr/bin/nextdns
INFO: INSTALL_RELEASE: 1.47.1
c) Configure NextDNS
r) Remove NextDNS
e) Exit
Choice (default=c): c
NextDNS Profile ID: 6445b3                                        
Sending your devices name lets you filter analytics and logs by device.
Report device name? [Y|n]: y
Accept DNS request from other network hosts.
Setup as a router? (y/n): y
Make NextDNS CLI cache responses. This improves latency and reduces the amount
of queries sent to NextDNS.
Enable caching? (y/n): y
Instant refresh will force low TTL on responses sent to clients so they rely
on CLI DNS cache. This will allow changes on your NextDNS config to be applied
on your LAN hosts without having to wait for their cache to expire.
Enable instant refresh? (y/n): y
Changes DNS settings of the host automatically when NextDNS is started.
If you say no here, you will have to manually configure DNS to 127.0.0.1.
Automatically setup local host DNS? [Y|n]: y
NextDNS installed and started using systemd init
c) Configure NextDNS
r) Remove NextDNS
e) Exit
Choice (default=c): e

================================

# DEBUG=1 sh -c "$(curl -sL https://nextdns.io/install)"
INFO: OS: debian
INFO: GOARCH: amd64
INFO: GOOS: linux
INFO: NEXTDNS_BIN: /usr/bin/nextdns
INFO: INSTALL_RELEASE: 1.47.1
DEBUG: Start install loop with CURRENT_RELEASE=1.47.1
DEBUG: NextDNS is up to date (1.47.1)
c) Configure NextDNS
r) Remove NextDNS
e) Exit
Choice (default=c): r
INFO: Uninstalling NextDNS...
DEBUG: Using deb uninstall type
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares2 libjs-highlight.js libjs-inherits libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libssl-dev
  libuv1-dev node-chownr node-color-name node-err-code node-extsprintf node-fast-deep-equal node-indent-string node-ini
  node-is-typedarray node-json-parse-better-errors node-json-schema node-json-schema-traverse node-qs node-resolve-from
  node-through node-typedarray-to-buffer node-universalify node-uuid
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  nextdns
0 upgraded, 0 newly installed, 1 to remove and 103 not upgraded.
After this operation, 9,560 kB disk space will be freed.
(Reading database ... 63459 files and directories currently installed.)
Removing nextdns (1.47.1) ...
DEBUG: Start install loop with CURRENT_RELEASE=
DEBUG: NextDNS is not installed
i) Install NextDNS
e) Exit
Choice (default=i): i
INFO: Installing NextDNS...
DEBUG: Using deb install type
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apt-transport-https is already the newest version (2.2.4).
The following packages were automatically installed and are no longer required:
  gyp libc-ares2 libjs-highlight.js libjs-inherits libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libssl-dev
  libuv1-dev node-chownr node-color-name node-err-code node-extsprintf node-fast-deep-equal node-indent-string node-ini
  node-is-typedarray node-json-parse-better-errors node-json-schema node-json-schema-traverse node-qs node-resolve-from
  node-through node-typedarray-to-buffer node-universalify node-uuid
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 103 not upgraded.
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease                                                     
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease                                             
Hit:4 https://pkg.cloudflare.com/cloudflared buster InRelease                                             
Hit:5 https://repo.nextdns.io/deb stable InRelease
Get:6 https://packages.sury.org/php bullseye InRelease [6,136 B]                                                               
Err:6 https://packages.sury.org/php bullseye InRelease                                                                         
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
Hit:8 https://deb.nodesource.com/node_22.x nodistro InRelease                                                                  
Hit:9 https://download.docker.com/linux/debian buster InRelease                                                                
Get:13 https://pkgs.tailscale.com/stable/debian bullseye InRelease                                                             
Hit:10 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/debian bullseye InRelease
Get:12 https://dlm.mariadb.com/repo/maxscale/latest/apt bullseye InRelease [11.9 kB]
Err:12 https://dlm.mariadb.com/repo/maxscale/latest/apt bullseye InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5D87FACA8C27D14E
Hit:7 https://custom-downloads.mariadb.com/legacy/tools/debian bullseye InRelease                                              
Hit:11 https://packagecloud.io/ookla/speedtest-cli/debian bullseye InRelease
Fetched 18.5 kB in 22s (832 B/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php bullseye InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dlm.mariadb.com/repo/maxscale/latest/apt bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5D87FACA8C27D14E
W: Failed to fetch https://dlm.mariadb.com/repo/maxscale/latest/apt/dists/bullseye/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5D87FACA8C27D14E
W: Failed to fetch https://packages.sury.org/php/dists/bullseye/InRelease  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares2 libjs-highlight.js libjs-inherits libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libssl-dev
  libuv1-dev node-chownr node-color-name node-err-code node-extsprintf node-fast-deep-equal node-indent-string node-ini
  node-is-typedarray node-json-parse-better-errors node-json-schema node-json-schema-traverse node-qs node-resolve-from
  node-through node-typedarray-to-buffer node-universalify node-uuid
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  nextdns
0 upgraded, 1 newly installed, 0 to remove and 103 not upgraded.
Need to get 0 B/3,924 kB of archives.
After this operation, 9,560 kB of additional disk space will be used.
Selecting previously unselected package nextdns.
(Reading database ... 63459 files and directories currently installed.)
Preparing to unpack .../nextdns_1.47.1_amd64.deb ...
Unpacking nextdns (1.47.1) ...
Setting up nextdns (1.47.1) ...
NextDNS installed and started using systemd init
DEBUG: Start configure
DEBUG: Get profile ID
DEBUG: Previous profile ID: 6445b3
NextDNS Profile ID (default=6445b3): 
DEBUG: Add arg -profile=6445b3
Sending your devices name lets you filter analytics and logs by device.
Report device name? [Y|n]: y
DEBUG: Add arg -report-client-info=true
Accept DNS request from other network hosts.
Setup as a router? [Y|n]: y
DEBUG: Add arg -setup-router=true
Make NextDNS CLI cache responses. This improves latency and reduces the amount
of queries sent to NextDNS.
Enable caching? [Y|n]: y
DEBUG: Add arg -cache-size=10MB
Instant refresh will force low TTL on responses sent to clients so they rely
on CLI DNS cache. This will allow changes on your NextDNS config to be applied
on your LAN hosts without having to wait for their cache to expire.
Enable instant refresh? [Y|n]: y
DEBUG: Add arg -max-ttl=5s
Changes DNS settings of the host automatically when NextDNS is started.
If you say no here, you will have to manually configure DNS to 127.0.0.1.
Automatically setup local host DNS? [Y|n]: y
DEBUG: Add arg -auto-activate=true
NextDNS installed and started using systemd init

Congratulations! NextDNS is now installed.

To upgrade/uninstall, run this command again and select the appropriate option.

You can use the NextDNS command to control the daemon.
Here are a few important commands to know:

# Start, stop, restart the daemon:
nextdns start
nextdns stop
nextdns restart

# Configure the local host to point to NextDNS or not:
nextdns activate
nextdns deactivate

# Explore daemon logs:
nextdns log

# For more commands, use:
nextdns help


Thursday, 8 January 2026

Pasang Nextcloud di Debian SiM Server

 

Siap Guru Duan 👍
Kita pasang Nextcloud dengan prinsip yang sama seperti Immich: aman, terpisah, tidak mengganggu Moodle & WordPress, dan data besar di /dev/sdb.

Saya buat langkah rapi & bertahap. Fokus dulu install lokal sampai bisa dibuka, belum Cloudflared dulu.


🟦 RENCANA NEXTCLOUD (AMAN & TERPISAH)

Arsitektur

  • Docker sendiri (tidak campur Immich)

  • Port lokal: 8081

  • Data user: /srv/nextcloud/data/dev/sdb

  • Database: MariaDB khusus Nextcloud (container)/dev/sda

  • Tidak sentuh:

    • Nginx host

    • MariaDB Moodle

    • WordPress


🔹 LANGKAH 1 — Siapkan Folder Nextcloud

sudo mkdir -p /opt/docker/nextcloud
sudo mkdir -p /srv/nextcloud/data
sudo chown -R 1000:1000 /srv/nextcloud

Cek:

df -h /srv/nextcloud

Harus terlihat /dev/sdb1.


🔹 LANGKAH 2 — Buat .env Nextcloud

cd /opt/docker/nextcloud
nano .env

Isi (boleh copy):

# ===== Nextcloud =====
NEXTCLOUD_ADMIN_USER=admin
NEXTCLOUD_ADMIN_PASSWORD=adminpasswordku
NEXTCLOUD_TRUSTED_DOMAINS=cloud.sman2kandangan.sch.id localhost

# ===== Database =====
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud
MYSQL_PASSWORD=nextcloudpass
MYSQL_ROOT_PASSWORD=rootpass

# ===== PHP / Upload =====
PHP_UPLOAD_LIMIT=10G

📌 Password bebas, tapi ingat/simpan.


🔹 LANGKAH 3 — Buat docker-compose.yml

nano docker-compose.yml

Isi versi stabil & ringan:

services:
  nextcloud:
    image: nextcloud:28
    container_name: nextcloud_app
    restart: unless-stopped
    ports:
      - "8081:80"
    environment:
      MYSQL_HOST: db
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER}
      NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
      NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_TRUSTED_DOMAINS}
      PHP_UPLOAD_LIMIT: ${PHP_UPLOAD_LIMIT}
    volumes:
      - /srv/nextcloud/data:/var/www/html/data
      - /opt/docker/nextcloud/html:/var/www/html
    depends_on:
      - db

  db:
    image: mariadb:10.11
    container_name: nextcloud_db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    volumes:
      - /opt/docker/nextcloud/db:/var/lib/mysql

📌 MariaDB ini KHUSUS Nextcloud, tidak ada hubungannya dengan moodle-db.


🔹 LANGKAH 4 — Jalankan Nextcloud

docker compose up -d

Tunggu ±1 menit.


🔹 LANGKAH 5 — Cek Status

docker ps

Target:

nextcloud_app   Up
nextcloud_db    Up

🔹 LANGKAH 6 — Tes Lokal

Buka di browser (server/LAN):

http://IP-server:8081

Atau dari server:

curl http://localhost:8081

🎯 Target:

  • Muncul halaman Nextcloud

  • Login pakai admin yang dibuat


🔐 JAMINAN KEAMANAN

✔ Moodle AMAN
✔ WordPress AMAN
✔ MariaDB Moodle TIDAK disentuh
✔ Data Nextcloud masuk /dev/sdb
✔ Nextcloud & Immich tidak saling ganggu


⏭️ LANGKAH SELANJUTNYA

Setelah Nextcloud bisa dibuka lokal, kita lanjut:

LANGKAH 7 — Integrasi Cloudflared

  • cloud.sman2kandangan.sch.idhttp://localhost:8081

  • Tanpa buka port

  • Tanpa ubah Nginx


Balas salah satu:

  • “nextcloud lokal sudah muncul”

  • atau kirim docker ps kalau mau saya cek

Kita lanjutkan sampai cloud sekolah siap dipakai ☁️💪

Tuesday, 6 January 2026

pasang hdd ke server SiM

 # lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  63.8M  1 loop /snap/core20/2686
loop1    7:1    0   105M  1 loop /snap/core/17272
loop2    7:2    0  63.8M  1 loop /snap/core20/2682
loop3    7:3    0   8.1M  1 loop /snap/certbot-dns-cloudflare/4876
loop4    7:4    0  66.8M  1 loop /snap/core24/1237
loop5    7:5    0 104.2M  1 loop /snap/core/17247
loop6    7:6    0  66.8M  1 loop /snap/core24/1243
loop7    7:7    0   8.1M  1 loop /snap/certbot-dns-cloudflare/4856
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   500M  0 part 
├─sda2   8:2    0 438.5G  0 part 
├─sda3   8:3    0   521M  0 part 
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0 154.5G  0 part 
├─sda6   8:6    0  15.3G  0 part [SWAP]
├─sda7   8:7    0  14.9G  0 part /
├─sda8   8:8    0  27.9G  0 part /home
└─sda9   8:9    0 279.4G  0 part /var
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0   450M  0 part 
├─sdb2   8:18   0   100M  0 part 
├─sdb3   8:19   0    16M  0 part 
├─sdb4   8:20   0 438.9G  0 part 
├─sdb5   8:21   0 239.1G  0 part 
├─sdb6   8:22   0   251G  0 part 
└─sdb7   8:23   0   1.9G  0 part 

Thursday, 11 December 2025

server SiM Kamis 11 Desember 2025

 # lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME   FSTYPE     SIZE MOUNTPOINT                        LABEL
loop0  squashfs  66.8M /snap/core24/1225                 
loop1  squashfs 104.2M /snap/core/17247                  
loop2  squashfs  63.8M /snap/core20/2669                 
loop3  squashfs  66.8M /snap/core24/1196                 
loop4  squashfs   8.1M /snap/certbot-dns-cloudflare/4856 
loop5  squashfs 104.2M /snap/core/17212                  
loop6  squashfs   8.2M /snap/certbot-dns-cloudflare/4697 
loop7  squashfs  63.8M /snap/core20/2682                 
sda             931.5G                                   
├─sda1 ntfs       500M                                   System Reserved
├─sda2 ntfs     438.5G                                   
├─sda3 ntfs       521M                                   
├─sda4              1K                                   
├─sda5 ntfs     154.5G                                   New Volume
├─sda6 swap      15.3G [SWAP]                            
├─sda7 ext4      14.9G /                                 
├─sda8 ext4      27.9G /home                             
└─sda9 ext4     279.4G /var                              
sr0              1024M                    


# df -h
du -sh /var/www/
du -sh /var/lib/mysql/
du -sh /var/moodledata/
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  1.2M  1.6G   1% /run
/dev/sda7        15G  5.2G  8.7G  38% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda8        28G   52K   26G   1% /home
/dev/sda9       274G   46G  215G  18% /var
/dev/loop5      105M  105M     0 100% /snap/core/17212
/dev/loop1      105M  105M     0 100% /snap/core/17247
/dev/loop3       67M   67M     0 100% /snap/core24/1196
/dev/loop6      8.3M  8.3M     0 100% /snap/certbot-dns-cloudflare/4697
/dev/loop2       64M   64M     0 100% /snap/core20/2669
/dev/loop0       67M   67M     0 100% /snap/core24/1225
/dev/loop7       64M   64M     0 100% /snap/core20/2682
/dev/loop4      8.2M  8.2M     0 100% /snap/certbot-dns-cloudflare/4856
tmpfs           1.6G  4.0K  1.6G   1% /run/user/0
3.2G    /var/www/
1.9G    /var/lib/mysql/
297M    /var/moodledata/

# sudo lshw -short | grep disk
sudo lsblk -o NAME,SIZE,MODEL
/0/100/17/0      /dev/sda    disk           1TB WDC WD10EZEX-21W
/0/100/17/1      /dev/cdrom  disk           DVDRAM GHD0N
NAME     SIZE MODEL
loop0   66.8M 
loop1  104.2M 
loop2   63.8M 
loop3   66.8M 
loop4    8.1M 
loop5  104.2M 
loop6    8.2M 
loop7   63.8M 
sda    931.5G WDC_WD10EZEX-21WN4A0
├─sda1   500M 
├─sda2 438.5G 
├─sda3   521M 
├─sda4     1K 
├─sda5 154.5G 
├─sda6  15.3G 
├─sda7  14.9G 
├─sda8  27.9G 
└─sda9 279.4G 
sr0     1024M HL-DT-ST_DVDRAM_GHD0N

# sudo lspci | grep -i sata
00:17.0 SATA controller: Intel Corporation Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] (rev 31)


# sudo lshw -class disk -class storage
  *-sata                    
       description: SATA controller
       product: Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode]
       vendor: Intel Corporation
       physical id: 17
       bus info: pci@0000:00:17.0
       logical name: scsi0
       logical name: scsi2
       version: 31
       width: 32 bits
       clock: 66MHz
       capabilities: sata msi pm ahci_1.0 bus_master cap_list emulated
       configuration: driver=ahci latency=0
       resources: irq:126 memory:df228000-df229fff memory:df22c000-df22c0ff ioport:f090(size=8) ioport:f080(size=4) ioport:f060(size=32) memory:df22b000-df22b7ff
     *-disk
          description: ATA Disk
          product: WDC WD10EZEX-21W
          vendor: Western Digital
          physical id: 0
          bus info: scsi@0:0.0.0
          logical name: /dev/sda
          version: 1A01
          serial: WCC6Y3UNVZEY
          size: 931GiB (1TB)
          capabilities: partitioned partitioned:dos
          configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096 signature=ee238f62
     *-cdrom
          description: DVD-RAM writer
          product: DVDRAM GHD0N
          vendor: HL-DT-ST
          physical id: 1
          bus info: scsi@2:0.0.0
          logical name: /dev/cdrom
          logical name: /dev/cdrw
          logical name: /dev/dvd
          logical name: /dev/dvdrw
          logical name: /dev/sr0
          version: 1.00
          capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
          configuration: ansiversion=5 status=nodisc


# sudo grep -i ahci /sys/class/scsi_host/host*/proc_name
/sys/class/scsi_host/host0/proc_name:ahci
/sys/class/scsi_host/host1/proc_name:ahci
/sys/class/scsi_host/host2/proc_name:ahci
/sys/class/scsi_host/host3/proc_name:ahci

# ls /sys/class/ata_port
ata1  ata2  ata3  ata4

# sudo ls -l /sys/class/ata_port
total 0
lrwxrwxrwx 1 root root 0 Dec  9 13:30 ata1 -> ../../devices/pci0000:00/0000:00:17.0/ata1/ata_port/ata1
lrwxrwxrwx 1 root root 0 Dec  9 13:30 ata2 -> ../../devices/pci0000:00/0000:00:17.0/ata2/ata_port/ata2
lrwxrwxrwx 1 root root 0 Dec  9 13:30 ata3 -> ../../devices/pci0000:00/0000:00:17.0/ata3/ata_port/ata3
lrwxrwxrwx 1 root root 0 Dec  9 13:30 ata4 -> ../../devices/pci0000:00/0000:00:17.0/ata4/ata_port/ata4

Friday, 28 November 2025

CBT via LAN, lebih pakai HTTP daripada HTTPS

 

Guru Duan… untuk CBT via LAN, khususnya jaringan lokal tertutup seperti kelas ujian, jawabannya sebenarnya tegas, sederhana, dan didukung pengalaman banyak sekolah:

🟩 CBT via LAN: LEBIH BAIK menggunakan HTTP (NON-HTTPS).

Dan berikut alasannya — saya jelaskan dengan bahasa yang enak dibaca tapi tetap teknis dan presisi.


🟢 1. LAN = lingkungan aman dan tertutup

Siswa tidak bisa:

  • memasang Sniffer (karena tidak punya akses raw socket)

  • melakukan man-in-the-middle dari luar

  • masuk dari luar jaringan

LAN adalah ruang makan keluarga: semuanya sudah kenal dan aman.

Pada LAN, HTTPS tidak menambah keamanan yang berarti.


🟢 2. HTTPS menambah beban CPU server Moodle

Meskipun kecil, pada CBT beban itu terasa.

HTTPS berarti:

  • encryption

  • decryption

  • handshake

  • certificate validation

Untuk server dengan banyak siswa, ini bisa menambah 20–35% overhead.

HTTP hanya lewat seperti angin — ringan, cepat, tanpa beban.


🟢 3. HTTPS lokal sering menimbulkan masalah browser

Dalam LAN:

Jika pakai sertifikat self-signed:

  • Chrome munculkan warning merah

  • “Your connection is not private”

  • Siswa bingung

  • Akses ditolak kecuali klik “Advanced → Proceed”

  • Menghabiskan waktu CBT

Jika pakai sertifikat resmi Internet:

  • Tidak bisa dipakai untuk 192.168.x.x tanpa DNS domain

  • Mengharuskan akses via domain (yang malah dicegat Cloudflared)

Browser sangat sensitif terhadap HTTPS di LAN.


🟢 4. HTTP lebih stabil untuk klien lama

Banyak komputer sekolah, laptop pinjaman, dan HP lama siswa:

  • punya SSL library yang kadang error

  • memiliki jam sistem salah (certificate invalid)

  • atau cache SSL kacau saat ujian

HTTP menghindari semua masalah itu.


🟢 5. Akses LAN lebih cepat tanpa enkripsi

CBT butuh kecepatan dan stabilitas.

HTTP → paket langsung lewat
HTTPS → ada proses kriptografi

Selisihnya memang kecil per request, tetapi untuk:

  • 36 siswa

  • 50 siswa

  • 100 siswa

perbedaan itu terasa saat submit soal.


🟢 6. Pengalaman sekolah lain

Sekolah-sekolah yang menggunakan:

  • Moodle CBT

  • AKM mandiri

  • Exambrowser

  • e-Learning lokal

  • Latihan UTBK lokal

semuanya memakai:

http://192.168.xx.xx

karena paling stabil, paling ringan, dan paling tidak bikin keributan.


🟩 KESIMPULAN BESAR

Untuk CBT dalam jaringan lokal 192.168.100.x, pilihan terbaik adalah:

HTTP (NON-HTTPS)

Karena:

  • ✔ Tidak ada risiko keamanan di LAN

  • ✔ Lebih ringan

  • ✔ Lebih cepat

  • ✔ Tidak ada warning browser

  • ✔ Lebih stabil saat siswa submit

  • ✔ Bebas masalah sertifikat


🟦 Jika Guru tetap ingin HTTPS LAN

Bisa juga, tetapi harus:

  • pakai domain lokal dengan CA internal

  • atau pakai cert self-signed dan install di semua client

  • atau pakai domain publik via Cloudflare (tapi ini tidak LAN-only)

Tidak praktis untuk CBT.


🟢 Jadi rekomendasi final saya:

Gunakan:

http://192.168.100.14

Fokus pada stabilitas — itu yang paling penting dalam ujian.

Kalau Guru ingin, saya bisa buatkan:

  • panduan akses LAN-only

  • SOP network CBT

  • Best practice firewall supaya hanya LAN yang boleh akses

  • Blok semua akses internet siswa

Tinggal bilang saja 🙏

Thursday, 27 November 2025

Backup Moodle di debian server cbt

  # Backup code Moodle
sudo tar -czvf /home/admincbt/moodle-code-$(date +%F).tar.gz -C /var/www/html moodle

# Backup moodledata
sudo tar -czvf /home/admincbt/moodledata-$(date +%F).tar.gz -C /var moodledata

# Backup database
sudo mysqldump -u root -p moodle > /home/admincbt/moodle-db-$(date +%F).sql



============================
Untuk mengecek detail semua file di dalam /home/admincbt, termasuk ukuran (size), waktu, dan hak akses, jalankan perintah berikut di terminal:
ls -lh /home/admincbt

# ls -lh /home/admincbt/*$(date +%F)*
-rw-r--r-- 1 root root 125M Feb 20 09:25 /home/admincbt/moodle-code-2026-02-20.tar.gz
-rw-r--r-- 1 root root  21M Feb 20 09:29 /home/admincbt/moodledata-2026-02-20.tar.gz
-rw-r--r-- 1 root root 394M Feb 20 09:31 /home/admincbt/moodle-db-2026-02-20.sql

============================
Kompresi database agar hemat ruang:
gzip /home/admincbt/moodle-db-2025-12-12.sql

============================
kirim ke laptop dari laptop jalankan
rsync -avzP admincbt@debian-cbt:/home/admincbt/moodle-code-2025-12-12.tar.gz ~/cbt/
rsync -avzP admincbt@debian-cbt:/home/admincbt/moodledata-2025-12-12.tar.gz ~/cbt/
rsync -avzP admincbt@debian-cbt:/home/admincbt/moodle-db-2025-12-12.sql.gz ~/cbt/


verifikasi:
ls -lh ~/cbt/{moodle-code-2025-12-12.tar.gz,moodledata-2025-12-12.tar.gz,moodle-db-2025-12-12.sql.gz}


-rw-r--r-- 1 dhwan dhwan 125M Dec 12 13:18 /home/dhwan/cbt/moodle-code-2025-12-12.tar.gz
-rw-r--r-- 1 dhwan dhwan  40M Dec 12 13:21 /home/dhwan/cbt/moodledata-2025-12-12.tar.gz
-rw-r--r-- 1 dhwan dhwan  50M Dec 12 13:22 /home/dhwan/cbt/moodle-db-2025-12-12.sql.gz

Monday, 24 November 2025

interface debian-cbt dengan set metric

 # cat /etc/network/interfaces
# Loopback interface
auto lo
iface lo inet loopback

# eno1 = LAN ujian + Indihome (Internet utama)
auto eno1
iface eno1 inet static
    address 192.168.100.14
    netmask 255.255.255.0
    gateway 192.168.100.1
    dns-nameservers 8.8.8.8 1.1.1.1
    metric 100

# enp1s0 = Orbit (Internet backup)
auto enp1s0
iface enp1s0 inet dhcp
    metric 200

Interface debian-cbt sebelum set metric

 root@debian-cbt:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
#auto lo
#iface lo inet loopback
# Konfigurasi jaringan manual Debian 11 (server CBT)
auto lo
iface lo inet loopback

auto eno1
iface eno1 inet static
    address 192.168.100.14
    netmask 255.255.255.0
    gateway 192.168.100.1
    dns-nameservers 8.8.8.8 1.1.1.1

# The primary network interface pakai dhcp
#allow-hotplug eno1
#iface eno1 inet dhcp

Sunday, 23 November 2025

hdd server cbt

 root@debian-cbt:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           778M  1.1M  777M   1% /run
/dev/sda6        37G   13G   23G  36% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda2        96M   33M   64M  34% /boot/efi
/dev/sda8        56G   63M   53G   1% /home
tmpfs           778M     0  778M   0% /run/user/0

pukul 07:34
# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           778M  1.1M  777M   1% /run
/dev/sda6        37G   16G   20G  45% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda2        96M   33M   64M  34% /boot/efi
/dev/sda8        56G   63M   53G   1% /home
tmpfs           778M     0  778M   0% /run/user/0


pukul 07:45 setelah dipindah ke home
# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           778M  1.1M  777M   1% /run
/dev/sda6        37G  4.1G   31G  12% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda2        96M   33M   64M  34% /boot/efi
/dev/sda8        56G   12G   42G  22% /home
tmpfs           778M     0  778M   0% /run/user/0


Friday, 21 November 2025

Backup Moodle dari SiM

Backup moodle di server SiM
masuk sim:
sudo mysqldump -u root -p moodle2 > /root/moodle-db-$(date +%F).sql
sudo tar -czvf /root/moodledata-$(date +%F).tar.gz /var/moodledata
sudo tar -czvf /root/moodlecode-$(date +%F).tar.gz /var/www/html/moodle

kirim ke laptop, jalankan di dalam folder 

 dhwan@dhwan-Aspire-A514-51K:~/backup_sim$ scp root@debian:/root/moodle-*$(date +%F)* .
root@debian's password: 
moodle-db-2025-11-21.sql                                                                      100% 1500MB  27.6MB/s   00:54    
dhwan@dhwan-Aspire-A514-51K:~/backup_sim$ scp root@debian:/root/moodlecode-*$(date +%F)* .
root@debian's password: 
moodlecode-2025-11-21.tar.gz                                                                  100%  123MB  14.2MB/s   00:08    
dhwan@dhwan-Aspire-A514-51K:~/backup_sim$ scp root@debian:/root/moodledata-*$(date +%F)* .
root@debian's password: 
moodledata-2025-11-21.tar.gz                                                                  100%  119MB  11.6MB/s   00:10    

Monday, 3 November 2025

cek client lab komputer untuk tka

 $ sudo nmap -sn 10.10.10.0/24
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-11-03 09:32 WITA
Nmap scan report for _gateway (10.10.10.1)
Host is up (0.0071s latency).
MAC Address: E4:8D:8C:39:7E:6B (Routerboard.com)
Nmap scan report for 10.10.10.2
Host is up (0.0072s latency).
MAC Address: 84:16:F9:64:09:2A (TP-Link Technologies)
Nmap scan report for 10.10.10.115
Host is up (0.16s latency).
MAC Address: E8:FB:1C:5D:C6:1D (AzureWave Technology)
Nmap scan report for 10.10.10.117
Host is up (0.090s latency).
MAC Address: 14:D4:24:12:FC:73 (AzureWave Technology)
Nmap scan report for 10.10.10.118
Host is up (0.097s latency).
MAC Address: 76:58:08:B2:52:B5 (Unknown)
Nmap scan report for 10.10.10.121
Host is up (0.11s latency).
MAC Address: 68:7A:64:E4:58:36 (Intel Corporate)
Nmap scan report for 10.10.10.122
Host is up (0.10s latency).
MAC Address: 28:6B:35:3B:1E:B0 (Intel Corporate)
Nmap scan report for 10.10.10.123
Host is up (0.094s latency).
MAC Address: 94:E7:0B:E3:D8:3E (Intel Corporate)
Nmap scan report for 10.10.10.125
Host is up (0.0076s latency).
MAC Address: 50:7B:9D:33:DF:43 (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.126
Host is up (0.011s latency).
MAC Address: 68:F7:28:7C:EE:5E (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.127
Host is up (0.012s latency).
MAC Address: 68:F7:28:7C:E7:36 (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.128
Host is up (0.012s latency).
MAC Address: 50:7B:9D:33:DD:6B (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.129
Host is up (0.016s latency).
MAC Address: 68:F7:28:46:EF:D0 (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.134
Host is up (0.088s latency).
MAC Address: 00:0A:1D:08:0B:25 (Optical Communications Products)
Nmap scan report for 10.10.10.135
Host is up (0.088s latency).
MAC Address: 98:29:A6:94:E7:11 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.136
Host is up (0.091s latency).
MAC Address: F4:4D:30:69:DB:1F (Elitegroup Computer Systems)
Nmap scan report for 10.10.10.139
Host is up (0.091s latency).
MAC Address: 00:04:0B:08:33:3B (3COM Europe)
Nmap scan report for 10.10.10.148
Host is up (0.091s latency).
MAC Address: 30:65:EC:C5:0A:F5 (Wistron (ChongQing))
Nmap scan report for 10.10.10.153
Host is up (0.091s latency).
MAC Address: 38:2C:4A:82:08:84 (ASUSTek Computer)
Nmap scan report for 10.10.10.154
Host is up (0.091s latency).
MAC Address: 68:F7:28:7C:F0:B5 (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.155
Host is up (0.091s latency).
MAC Address: 68:F7:28:7C:FA:9E (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.156
Host is up (0.091s latency).
MAC Address: F0:76:1C:51:EB:93 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.157
Host is up (0.091s latency).
MAC Address: 68:F7:28:7C:FE:4C (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.158
Host is up (0.091s latency).
MAC Address: 9C:5A:44:87:BA:27 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.167
Host is up (0.077s latency).
MAC Address: F8:75:A4:20:F8:75 (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.168
Host is up (0.099s latency).
MAC Address: 98:E7:43:11:62:5A (Dell)
Nmap scan report for 10.10.10.169
Host is up (0.085s latency).
MAC Address: 38:2C:4A:7F:D0:18 (ASUSTek Computer)
Nmap scan report for 10.10.10.172
Host is up (0.091s latency).
MAC Address: 38:2C:4A:7F:C0:DA (ASUSTek Computer)
Nmap scan report for 10.10.10.181
Host is up (0.10s latency).
MAC Address: 1C:39:47:E0:4A:97 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.182
Host is up (0.10s latency).
MAC Address: 50:7B:9D:89:8E:D6 (LCFC(HeFei) Electronics Technology)
Nmap scan report for 10.10.10.183
Host is up (0.10s latency).
MAC Address: 9C:5A:44:87:C5:F8 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.184
Host is up (0.13s latency).
MAC Address: 98:29:A6:94:EE:2A (Compal Information (Kunshan))
Nmap scan report for 10.10.10.186
Host is up (0.19s latency).
MAC Address: 30:65:EC:C5:0A:51 (Wistron (ChongQing))
Nmap scan report for 10.10.10.188
Host is up (0.19s latency).
MAC Address: 9C:5A:44:87:C5:2F (Compal Information (Kunshan))
Nmap scan report for 10.10.10.192
Host is up (0.19s latency).
MAC Address: 38:2C:4A:7F:C9:0A (ASUSTek Computer)
Nmap scan report for 10.10.10.195
Host is up (0.011s latency).
MAC Address: 98:29:A6:94:ED:80 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.197
Host is up (0.18s latency).
MAC Address: 98:29:A6:94:EB:32 (Compal Information (Kunshan))
Nmap scan report for 10.10.10.199
Host is up (0.017s latency).
MAC Address: B8:AE:ED:2C:74:9C (Elitegroup Computer Systems)
Nmap scan report for dhwan-Aspire-A514-51K (10.10.10.120)
Host is up.
Nmap done: 256 IP addresses (39 hosts up) scanned in 49.61 seconds

Tuesday, 12 August 2025

hdd server root penuh

 # df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            2.9G     0  2.9G   0% /dev
tmpfs           585M  1.2M  584M   1% /run
/dev/sda6       247G  235G     0 100% /
tmpfs           2.9G     0  2.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/loop3      105M  105M     0 100% /snap/core/17210
/dev/loop4       64M   64M     0 100% /snap/core20/2582
/dev/loop1       64M   64M     0 100% /snap/core20/2599
/dev/loop2       55M   55M     0 100% /snap/certbot/4737
/dev/loop5       67M   67M     0 100% /snap/core24/1006
/dev/loop7      105M  105M     0 100% /snap/core/17212
/dev/loop0       67M   67M     0 100% /snap/core24/1055
/dev/sda2        96M   26M   71M  27% /boot/efi
/dev/loop8       55M   55M     0 100% /snap/certbot/4892
tmpfs           585M  4.0K  585M   1% /run/user/0


===========

# du -xh --max-depth=1 /var | sort -h
4.0K    /var/local
4.0K    /var/opt
28K    /var/tmp
68K    /var/snap
3.4M    /var/mail
137M    /var/spool
212M    /var/moodledata
308M    /var/backup
497M    /var/backups
729M    /var/cache
1.7G    /var/lib
1.9G    /var/www
220G    /var/log
225G    /var
 

 

======================

find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
 

 

Thursday, 24 July 2025

Hapus log lama yang besar di server guru

 # ls -lh /var/log/syslog*
ls -lh /var/log/daemon.log*
-rw-r----- 1 root adm 2.6M Jul 24 13:57 /var/log/syslog
-rw-r----- 1 root adm 2.9M Jul 24 13:56 /var/log/syslog.1
-rw-r----- 1 root adm 124K Jul 24 13:55 /var/log/syslog.2.gz
-rw-r----- 1 root adm   20 Jul 24 13:49 /var/log/syslog.3.gz
-rw-r----- 1 root adm 298M Jul 13 00:04 /var/log/syslog.4.gz
-rw-r----- 1 root adm  48K Jun 29 00:00 /var/log/syslog.6.gz
-rw-r----- 1 root adm  47K Jun 28 00:00 /var/log/syslog.7.gz
-rw-r----- 1 root adm  122 Jul 24 13:56 /var/log/daemon.log
-rw-r----- 1 root adm 1.2K Jul 24 13:56 /var/log/daemon.log.1
-rw-r----- 1 root adm  86K Jul 24 13:55 /var/log/daemon.log.2.gz
-rw-r----- 1 root adm   20 Jul 24 13:49 /var/log/daemon.log.3.gz
-rw-r----- 1 root adm 297M Jul 13 00:04 /var/log/daemon.log.4.gz

# rm /var/log/syslog.4.gz
rm /var/log/daemon.log.4.gz

Saturday, 19 July 2025

BACKUP MOODLE Sabtu 19 Juli 2025

 # Backup code Moodle
sudo tar -czvf /var/backup/moodle-code-$(date +%F).tar.gz -C /var/www/html moodle

# Backup moodledata
sudo tar -czvf /var/backup/moodledata-$(date +%F).tar.gz -C /var moodledata

# Backup database
mysqldump -u root -p moodle2 > /var/backup/moodle-db-$(date +%F).sql



============================
Untuk mengecek detail semua file di dalam /var/backup, termasuk ukuran (size), waktu, dan hak akses, jalankan perintah berikut di terminal:
ls -lh /var/backup
============================
Kompresi database agar hemat ruang:
gzip /var/backup/moodle-db-2025-07-19.sql

============================
kirim ke laptop
PERHATIKAN ADA TITIK DI AKHIR tanda titik (.) di akhir perintah itu penting untuk menunjukkan bahwa file akan disalin ke direktori saat ini.

dari terminal laptop:
cd ~/Downloads
scp root@36.90.101.113:/var/backup/*2025-07-19* .


rsync -avP 'root@36.90.101.113:/var/backup/moodle-db-2025-07-19.sql.gz' .

scp root@36.90.101.113:/var/backup/moodledata-2025-07-19.tar.gz .


Monday, 7 July 2025

Analisis Penggunaan Disk

 

Terima kasih, Guru Duan. Ini hasilnya sangat jelas:


📌 Analisis Penggunaan Disk

Folder Ukuran Keterangan
/root 11 GB Sumber utama masalah, file besar tersimpan di home root user.
/usr 2.8 GB Wajar
/snap 1.5 GB Bisa dibersihkan jika tidak digunakan
/var 29 GB (tapi di partisi berbeda /dev/sda9, jadi tidak menyebabkan masalah)
/tmp hanya 76 KB Tidak ada file besar di sini, tapi tetap gagal karena partisi / penuh.

✅ Solusi Utama: Kosongkan /root

Jalankan ini untuk melihat file besar:

sudo du -sh /root/* 2>/dev/null | sort -h

Biasanya file besar berupa:

  • Backup (*.tar.gz, *.zip, .sql)

  • File upload manual

  • Error log atau file .bak

Jika ada file lama, bisa dipindahkan ke /var:

sudo mv /root/namafile /var/moodledata/temp/

atau hapus jika tidak perlu:

sudo rm /root/namafile

🔄 Setelah ruang lega:

Pastikan:

df -h

menunjukkan bahwa / sudah tidak 100% lagi.

Kemudian coba ulang upload file di Moodle.


🚀 Bonus (Opsional Tapi Disarankan):

Ubah lokasi upload sementara PHP ke partisi besar:

Karena /var luas, langkah aman jangka panjang:

  1. Buat folder temp:

    sudo mkdir -p /var/moodledata/temp
    sudo chown www-data:www-data /var/moodledata/temp
    
  2. Edit php.ini (cek lokasinya via php --ini) dan tambahkan:

    upload_tmp_dir = /var/moodledata/temp
    
  3. Restart PHP:

    sudo systemctl restart php8.2-fpm
    

Silakan jalankan:

sudo du -sh /root/*

dan beri tahu file mana yang bisa kita bersihkan atau pindahkan. Saya bantu instruksinya, Guru.

partisi root / (tempat sistem dan folder /tmp) sudah penuh.

 

Terima kasih, Guru Duan. Ini dia penyebab utama error upload_error_cant_write:


🔥 Masalah Utama:

/dev/sda7        15G   14G     0 100% /

Artinya: partisi root / (tempat sistem dan folder /tmp) sudah penuh.


💥 Dampak:

Karena /tmp berada di partisi /, maka semua proses PHP (termasuk move_uploaded_file) gagal menyimpan file sementara, sehingga Moodle menampilkan:

Error: Failed to write file to disk.
Error code: upload_error_cant_write

✅ Solusi Segera: Kosongkan ruang di partisi /

Jalankan:

sudo du -sh /* 2>/dev/null | sort -h

Untuk melihat apa yang paling memakan ruang. Fokus pada direktori seperti:

  • /var/log

  • /tmp

  • /root

  • /usr


🔧 Contoh Tindakan:

1. Bersihkan file log lama:

sudo journalctl --vacuum-time=3d
sudo rm -rf /var/log/*.gz /var/log/*.1 /var/log/*-???????? /var/log/*/*.gz

2. Bersihkan cache APT dan Snap:

sudo apt clean
sudo rm -rf /var/cache/apt/*
sudo rm -rf /var/lib/snapd/cache/*

3. Hapus file sementara (jika aman):

sudo rm -rf /tmp/*

🔒 Alternatif Aman: Pindahkan upload_tmp_dir ke partisi besar

Karena partisi /var masih lega 233 GB, kita bisa arahkan folder upload PHP ke sana:

🔧 Langkah-langkah:

  1. Buat folder baru:

    sudo mkdir -p /var/moodledata/temp
    sudo chown www-data:www-data /var/moodledata/temp
    
  2. Edit php.ini:
    Lokasi bisa dicari dengan:

    php --ini
    

    Kemudian buka dan ubah:

    upload_tmp_dir = /var/moodledata/temp
    
  3. Restart PHP:

    sudo systemctl restart php8.2-fpm
    
  4. Uji ulang upload pengguna di Moodle.


🔁 Kesimpulan

Masalah Solusi
/ penuh Bersihkan ruang atau pindahkan upload folder ke /var
Upload gagal Karena PHP tidak bisa tulis file sementara

Kalau Guru Duan ingin saya bantu bersihkan ruang secara spesifik, silakan kirim:

sudo du -sh /tmp /var/log /usr /root 2>/dev/null

atau lanjutkan dengan pengalihan upload_tmp_dir ke /var/moodledata/temp. Saya siap bantu arahkan.