USB OFFLINE: Ubuntu 22.04 Install Moodle, Apache2, MariaDB, PHP 8

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 unzip mariadb-server

Install Apache2

apt -y install apache2


Install PHP 8.1 Extension

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

Edit

sudo vi /etc/php/8.1/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.1

sudo update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.2   82        auto mode
* 1            /usr/bin/php8.1   81        manual mode
  2            /usr/bin/php8.2   82        manual mode

Press <enter> to keep the current choice[*], or type selection number: 0 
update-alternatives: using /usr/bin/php8.2 to provide /usr/bin/php (php) in auto mode

Atau kalau cuma ada 1 PHP

There is only one alternative in link group php (providing /usr/bin/php): /usr/bin/php8.1
Nothing to configure.

Restart apache2

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

Install MariaDB

sudo apt -y install mariadb-server

Restart & Enable

sudo systemctl start mariadb
sudo systemctl enable mariadb

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
systemctl restart mysqld
systemctl enable mysqld

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/stable403/moodle-latest-403.tgz

Copykan menggunakan scp ke

/usr/local/src


Install

cd /usr/local/src
cp moodle-latest-403.tgz /var/www/html/
cd /var/www/html/
tar zxvf moodle-latest-403.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