Showing posts with label mariadb. Show all posts
Showing posts with label mariadb. Show all posts

Thursday, 23 April 2026

🚀 Install Moodle 🔥

 🔥 kita langsung gas install stack Moodle (LEMP: Nginx + MariaDB + PHP) yang stabil & ringan untuk server Guru.


🚀 1. Install semua paket sekaligus

apt install nginx mariadb-server php-fpm php-mysql php-xml php-gd php-curl php-zip php-intl php-mbstring php-soap php-bcmath php-cli php-opcache php-ldap php-imagick unzip git -y

🐘 2. Aktifkan service penting

systemctl enable nginx
systemctl enable mariadb
systemctl enable php8.2-fpm

systemctl start nginx
systemctl start mariadb
systemctl start php8.2-fpm

🔐 3. Amankan MariaDB

mysql_secure_installation

👉 Jawaban:

  • Set root password → YES

  • Remove anonymous → YES

  • Disallow root remote → YES

  • Remove test DB → YES


🧠 4. Buat database Moodle

Masuk MariaDB:

mysql -u root -p

Lalu:

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'passwordku';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

👉 Ganti:

  • passwordku → password aman versi Guru


⚙️ 5. Setting PHP (WAJIB)

nano /etc/php/8.2/fpm/php.ini

Cari & ubah:

memory_limit = 512M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300

Simpan lalu:

systemctl restart php8.2-fpm

📁 6. Siapkan folder Moodle

mkdir -p /var/www/moodle
mkdir -p /var/moodledata

chown -R www-data:www-data /var/www/moodle
chown -R www-data:www-data /var/moodledata

chmod -R 755 /var/www/moodle
chmod -R 770 /var/moodledata

🌐 7. Config Nginx (siap pakai)

nano /etc/nginx/sites-available/moodle

Isi:

server {
    listen 80;
    server_name _;

    root /var/www/moodle;
    index index.php index.html;

    client_max_body_size 100M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg)$ {
        expires max;
        log_not_found off;
    }
}

Aktifkan:

ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx

📦 8. Download Moodle

cd /var/www/
git clone -b MOODLE_405_STABLE git://git.moodle.org/moodle.git moodle

Set permission lagi:

chown -R www-data:www-data /var/www/moodle

⏰ 9. Setup cron Moodle

crontab -e

Isi:

* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null

🌍 10. Akses Moodle

Buka browser:

👉 http://IP_SERVER


🎯 STATUS SEKARANG

Kalau semua benar:

  • Nginx ✅

  • PHP ✅

  • MariaDB ✅

  • Moodle siap install via web ✅


🚀 NEXT STEP

Nanti di browser:

  • pilih bahasa

  • isi database:

    • DB name: moodle

    • user: moodleuser

    • password: (yang dibuat tadi)



Thursday, 12 March 2026

Service yang WAJIB hidup untuk Moodle

 

Guru Duan, untuk mengakses Moodle di http://localhost, ada 3 service utama yang harus hidup.


Service yang WAJIB hidup untuk Moodle

1️⃣ Web Server

Menampilkan halaman web Moodle.

Service:

nginx.service

Start:

sudo systemctl start nginx

2️⃣ PHP Engine

Menjalankan kode PHP Moodle.

Service:

php8.2-fpm.service

Start:

sudo systemctl start php8.2-fpm

3️⃣ Database

Menyimpan data Moodle.

Service:

mariadb.service

Start:

sudo systemctl start mariadb

Jalankan semua sekaligus

Supaya cepat:

sudo systemctl start nginx php8.2-fpm mariadb

Setelah itu buka browser:

http://localhost/moodle

atau jika di root:

http://localhost

Service yang TIDAK wajib untuk Moodle

Ini tidak mempengaruhi Moodle:

  • pihole-FTL

  • cloudflared

  • docker

  • redis (kecuali dipakai cache)

  • openvpn


Cara cek apakah sudah hidup

systemctl status nginx php8.2-fpm mariadb

Harus muncul:

Active: active (running)

Tips supaya cepat

Guru Duan bisa buat alias:

Tambahkan di ~/.bashrc

alias moodleon="sudo systemctl start nginx php8.2-fpm mariadb"
alias moodleoff="sudo systemctl stop nginx php8.2-fpm mariadb"

Lalu reload:

source ~/.bashrc

Sekarang cukup ketik:

moodleon

Jika Guru Duan mau, saya juga bisa tunjukkan cara mengetahui dalam 3 detik apakah Moodle tidak bisa diakses karena nginx, php, atau database. Ini trik yang sangat membantu saat debugging server.

Saturday, 19 July 2025

Perintah sql milih user aktif moodle

 SELECT id, username, firstname, lastname
FROM mdl_user
WHERE deleted = 0
  AND suspended = 0
  AND confirmed = 1
  AND username <> 'guest';
785 rows in set (0.004 sec)



SELECT id, username, firstname, lastname
FROM mdl_user
WHERE deleted = 0
  AND suspended = 0
  AND confirmed = 1
  AND username <> 'guest'
INTO OUTFILE '/tmp/user_Active2025.csv'
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' 
LINES TERMINATED BY '\n';

Tuesday, 15 July 2025

Hapus Entry di database mariadb mysql

batu saya hapus entry |  83 |   1149 |      62 |            39 | Izin keluae                           | uji coba           | 2025-07-11 11:10:53 |

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

Baik, Guru Duan. Untuk menghapus entri dengan id = 83 di tabel mdl_local_jurnalmengajar_suratizin, jalankan perintah SQL berikut di MySQL:

DELETE FROM mdl_local_jurnalmengajar_suratizin WHERE id = 83;

Jika ingin memverifikasi dulu entri yang akan dihapus, jalankan:

SELECT * FROM mdl_local_jurnalmengajar_suratizin WHERE id = 83;

⚠️ Catatan:

Karena Guru sudah melakukan backup sebelumnya (mdl_local_jurnalmengajar_suratizin_backup), tidak perlu khawatir jika nanti perlu mengembalikan data ini.

Kalau sudah dieksekusi dan ingin konfirmasi bahwa entri terhapus, gunakan:

SELECT * FROM mdl_local_jurnalmengajar_suratizin WHERE id = 83;

Hasilnya harus:

Empty set (0.000 sec)

Silakan kabari kalau ingin hapus entri lain juga.

Wednesday, 25 June 2025

🧹 3. Hapus plugin dari database

 

✅ Solusi 1: Masuk sebagai root MariaDB

Coba perintah ini:

sudo mariadb
 

SHOW DATABASES;
 

USE moodle2;
 

DELETE FROM mdl_config_plugins WHERE plugin = 'local_moodle_webshellxyz';
DELETE FROM mdl_plugins WHERE name = 'moodle_webshellxyz' OR plugin = 'local_moodle_webshellxyz';
 

EXIT;
 

 Catatan: Jika prefix tabel Anda bukan mdl_, sesuaikan dengan yang ada di config.php:

$CFG->prefix = 'mdl_';  // ← ini yang dipakai default
 

PHP and DBMS compatibility of major Moodle releases

 

PHP and DBMS compatibility of major Moodle releases

We get a non-ending stream of requests in the moodle.org forums from people having trouble in marching old Moodle installations to newer and supported versions. Things break easily since along the path the system requirements have been evolving too. The following table summarizes their dependencies. (Last edited 2025-04-22 08:49 UTC)

Target  Earliest 
from
 PHP   MySQL   PgSQL   MariaDB 
 min.   max.   min.   max.   min.   max.   min.   max. 
1.6[1] 1.0 4.3.0 5.6 4.1.16 ? 8.0 ? - -
1.9[2] 1.6 4.3.0 5.6 4.1.16 5.7? 8.0 ? - -
2.2[3] 1.9 5.3.2 5.6 5.0.25 5.7? 8.3 ? - -
2.4 2.2 5.3.2 5.6 5.1.33 5.7? 8.3 ? - -
2.7 (LTS) 2.2 5.4.4 5.6 5.5.31 5.7? 9.1 ? 5.5.31 10.2
3.0 2.2 5.4.4 7.0 5.5.31 5.7? 9.1 ? 5.5.31 10.2
3.1 (LTS) 2.7 5.4.4 7.0 5.5.31 5.7 9.1 ? 5.5.31 10.2
3.2 2.7 5.6.5 7.1 5.5.31 5.7 9.1 ? 5.5.31 10.2
3.3 2.7 5.6.5 7.1 5.5.31 5.7 9.3 ? 5.5.31 10.2
3.4 3.0 7.0 7.1 5.5.31 5.7 9.3 ? 5.5.31 10.2
3.5 (LTS) 3.1 7.0 7.2 5.5.31 8.0 9.3 ? 5.5.31 10.5
3.6 3.1 7.0 7.3 5.6 8.0 9.4 ? 10.0? 10.5
3.7 3.2 7.1 7.3 5.6 8.0 9.4 ? 10.0? 10.5
3.8 3.2 7.1 7.4[4] 5.6 8.0 9.4 ? 10.0? 10.5
3.9 (LTS) 3.5 7.2 7.4 5.6 8.0 9.5 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
3.10 3.5 7.2 7.4 5.7 8.0 9.6 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
3.11 3.6 7.3 8.0[5] 5.7 8.0 9.6 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
4.0 3.6 7.3 8.0[5] 5.7 8.0 10 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
4.1 (LTS) 3.9 7.4 8.1[6] 5.7 latest 12 ? 10.4 10.11
4.2 3.11 8.0[8] 8.2[7] 8.0 latest 13 ? 10.6.7 latest
4.3 3.11.8 8.0[8] 8.2 8.0 latest 13 ? 10.6.7 latest
4.4 4.1.2 8.1[8] 8.3 8.0 latest 13 ? 10.6.7 latest
4.5 (LTS) 4.1.2 8.1[8] 8.3 8.0 latest 13 ? 10.6.7 latest
4.6 (experimental)[9] 4.1.2 8.1[8] 8.3 8.0 latest 13 ? 10.6.7 latest
5.0 4.2.3 8.2 8.3[10] 8.4 latest 14 ? 10.11.0 latest

Footnotes:

  1. Release 1.6 was a de-facto LTS, supported for 3 years
  2. Release 1.9 was a de-facto LTS, supported for 6 years
  3. Upgrade from 1.9 to 2.x broke so many things, it is advisable to rebuild the site - either through course backups and restore or create courses from scratch making use of the numerous new features added since then
  4. PHP 7.4 since release 3.8.3. See MDL-66260.
  5. PHP 8.0 since Moodle 3.11.8 and 4.0.2. See MDL-70745.
  6. PHP 8.1 since Moodle 4.1.2. See MDL-73016.
  7. PHP 8.2 since Moodle 4.2.3. See MDL-76405
  8. 64 bit PHP only. See MDL-76405
  9. Released December 2024 Announcement and discussion
  10. MDL-80117

Monday, 23 June 2025

disable mariadb, phpfpm

 $ sudo systemctl disable --now \
  mariadb.service \
  php8.2-fpm.service \

[sudo] password for dhwan: 
Synchronizing state of mariadb.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install disable mariadb
Synchronizing state of php8.2-fpm.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install disable php8.2-fpm
Removed "/etc/systemd/system/multi-user.target.wants/mariadb.service".
Removed "/etc/systemd/system/multi-user.target.wants/php8.2-fpm.service".


erintah sudo systemctl disable --now mariadb.service php8.2-fpm.service tidak menghapus MariaDB maupun PHP-FPM.
✅ Itu hanya menonaktifkan layanan mereka agar tidak dijalankan otomatis saat boot, dan jika sedang berjalan, dihentikan sekarang juga.


📦 Paket-paket masih tetap terpasang di sistem kamu.


Sunday, 22 June 2025

Cek webserver, php, mariadb version

 

✅ 1. Cek Web Server: Apache atau Nginx

Jalankan:

ps aux | grep -E 'apache2|nginx'

root 1941 0.0 0.0 11156 1532 ? Ss 06:18 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 1942 0.0 0.0 13028 4788 ? S 06:18 0:00 nginx: worker process
www-data 1943 0.0 0.0 13028 4656 ? S 06:18 0:00 nginx: worker process
www-data 1944 0.0 0.0 13028 4444 ? S 06:18 0:00 nginx: worker process
www-data 1945 0.0 0.0 12896 3596 ? S 06:18 0:00 nginx: worker process
dhwan 38805 0.0 0.0 9144 2044 pts/1 S+ 09:55 0:00 grep --color=auto -E apache2|nginx

Contoh output:

  • Jika Anda melihat proses apache2, berarti pakai Apache

  • Jika Anda melihat proses nginx, berarti pakai Nginx

✅ 2. Cek Versi PHP

Jalankan:php -v
$ php -v
PHP 8.2.28 (cli) (built: Mar 13 2025 18:13:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies

✅ 3. Cek Versi MySQL atau MariaDB

Cek apakah Anda pakai MySQL atau MariaDB:


Jalankan: mysql -V
$ mysql -V
mysql Ver 15.1 Distrib 10.11.13-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper


Wednesday, 21 September 2022

Membuat database Moodle

 # mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.3.36-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE moodle;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> CREATE USER 'usrmoodle'@'localhost' IDENTIFIED BY 'secret';
Query OK, 0 rows affected (0.020 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON moodle.* TO 'usrmoodle'@'localhost';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]>

install sampai mysql

 debian login: root


#apt-get update

#apt-get upgrade

#apt-get install nginx

y

 

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

Setelah proses install webserver selesai, untuk memastikan bahwa apache sudah terinstall dengan baik, buka browser dengan mengetikkan IP server pada URL address, maka akan muncul halaman default Nginx. saya ketikkan ip 192.168.100.10

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

 #apt-get install mariadb-server mariadb-client

y


#mysql_secure_installation