Moodle: Ubuntu 24.04 - Instalasi Moodle, Apache2, MariaDB, PHP

From OnnoWiki
Jump to navigation Jump to search

Update Repo

sudo apt update
sudo apt -y install software-properties-common ca-certificates lsb-release apt-transport-https net-tools

Install Apache2

apt -y install apache2


Install PHP Terakhir

Install PHP

sudo su
sudo apt update
apt -y install php-common php-mysql php-xml php-xmlrpc \
php-curl php-gd php-imagick php-cli php-dev \
php-imap php-mbstring php-opcache php-soap \
php-zip php-intl php-cli \
imagemagick git zip libgd-dev libapache2-mod-php \
php php-common libapache2-mod-php php-cli

Edit

sudo vi /etc/php/8.3/apache2/php.ini
upload_max_filesize = 100M
post_max_size = 48M
memory_limit = 512M
max_execution_time = 600
max_input_vars = 5000
max_input_time = 1000

Switch ke PHP8.3

sudo update-alternatives --config php


There are 2 choices for the alternative php (providing /usr/bin/php).
  Selection    Path                  Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php.default   100       auto mode
  1            /usr/bin/php.default   100       manual mode
  2            /usr/bin/php8.3        83        manual mode

Press <enter> to keep the current choice[*], or type selection 
number: 0

Restart apache2

sudo systemctl restart apache2.service
sudo systemctl enable apache2.service

Test

sudo vi /var/www/html/phpinfo.php
<?php phpinfo( ); ?>

Install MariaDB

sudo apt -y install mariadb-server

Restart & Enable

sudo systemctl start mariadb
sudo systemctl enable mariadb

OPTIONAL: Secure Installation

sudo mysql_secure_installation
Enter current password for root (enter for none): 
Set root password? [Y/n] y
New password: 
Re-enter new 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

OPTIONAL: Cek & Test

sudo mysql -u root -p
CREATE DATABASE testdb;
CREATE USER 'testuser' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON testdb.* TO 'testuser';
FLUSH PRIVILEGES;
exit

Install Moodle

Setup Database

Kalau Operasional

Setup root password (jika di perlukan saja)

mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD('password');

Setup database operasonal dengan username & password akses

# mysql -u root -p
Enter password:
create database moodle;
ALTER DATABASE moodle charset=utf8mb4;
ALTER DATABASE moodle CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
grant INSERT,SELECT on moodle.* to root@localhost;
grant CREATE, INSERT, SELECT, DELETE, UPDATE on moodle.* to usermoodle@localhost identified by "moodlepassword";
grant CREATE, INSERT, SELECT, DELETE, UPDATE on moodle.* to usermoodle identified by "moodlepassword";
exit

Kalau hanya Latihan

Password root 123456

# mysql -u root -p123456
create database moodle;
ALTER DATABASE moodle charset=utf8mb4;
ALTER DATABASE moodle CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
grant ALL on moodle.* to root@localhost;
grant ALL on moodle.* to moodle@localhost identified by "moodle";
grant ALL on moodle.* to moodle identified by "moodle";
exit
service mysqld start
service mysqld restart

Siapkan folder /var/moodledata/

Download language pack lewat web

https://download.moodle.org/download.php/langpack/4.0/id.zip

transfer menggunakan scp ke

/usr/local/src

Install language pack

cd /usr/local/src
mkdir -p /var/moodledata/lang
cp id.zip /var/moodledata/lang
cd /var/moodledata/lang
unzip id.zip
chmod -Rf 777 /var/moodledata/lang/
chown -Rf www-data: /var/moodledata/lang/

Install Moodle

Download oleh manusia dari

https://download.moodle.org/download.php/stable404/moodle-latest-404.tgz

Copykan menggunakan scp ke

/usr/local/src


Install

cd /usr/local/src
cp moodle-latest-404.tgz /var/www/html/
cd /var/www/html/
tar zxvf moodle-latest-404.tgz
chown -Rf www-data: /var/moodledata/
chmod -Rf 777 /var/www/html/moodle	
chown -Rf www-data: /var/www/html/moodle

Lanjutkan dengan konfigurasi via web

http://localhost/moodle
http://ip-address/moodle


Language       -> id  -> Selanjutnya
Web Address           http://ip-address/moodle
Moodle Directory      /var/www/html/moodle
Data Directory        /var/moodledata/
Confirm paths         -> Selanjutnya
Choose database driver
Type -> MySQL         -> Selanjutnya
Database settings
  Improved MySQL (mariadb)
  Database host      localhost
  Database name      moodle
  Database user      moodle
  Database password  moodle
  Tables prefix      mdl_ 
  unix socket (check) -> Selanjutnya
Installation      -> Lanjut
Server checks     -> Selanjutnya
Installation
  Nama Pengguna
  Password 
  Nama Depan
  Nama akhir
  Alamat Email
  Kota
  Pilih Negara             -> Perbaharui Profile

Installation
  Nama lengkap situs
  Nama singkat untuk situs (mis. kata tunggal)
  Keterangan halaman depan -> Save Changes

Akses Moodle

http://localhost/moodle/
http://ip-address/moodle/


Youtube

Pranala Menarik