Moodle: Instalasi Moodle, Apache2, Percona5.7, PHP7.4

From OnnoWiki
Jump to navigation Jump to search

Update Repo

sudo apt update

Install Apache2

apt -y install apache2
sudo ufw allow 'Apache'

Install PHP 7.3

sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt -y install php7.4

Install extension

sudo apt -y install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc \
php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev \
php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap \
php7.4-zip php7.4-int php7.4-cli \
imagemagick git zip libgd-dev libapache2-mod-php 

Edit

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

Restart apache2

sudo systemctl restart apache2.service

Test

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

Install Percona

sudo apt -y install wget
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release setup ps57
sudo apt -y install percona-server-server-5.7

Edit

sudo vi /etc/mysql/percona-server.conf.d/mysqld.cnf
[mysqld]
max_allowed_packet=32M

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 root.* to moodle@localhost;
grant CREATE, INSERT, SELECT, DELETE, UPDATE on moodle.* to moodle@localhost identified by "moodlepassword";
grant CREATE, INSERT, SELECT, DELETE, UPDATE on moodle.* to moodle identified by "moodlepassword";
exit

Kalau hanya Latihan

Password root 123456789

# mysql -u root -p123456789
CREATE USER 'root'@'%' IDENTIFIED BY '123456789';
create database moodle;
ALTER DATABASE moodle charset=utf8mb4;
ALTER DATABASE moodle CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
CREATE USER 'foo'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456789';
GRANT ALL PRIVILEGES ON database_name.* TO'foo'@'localhost';
GRANT ALL PRIVILEGES ON moodle.* TO'foo'@'localhost';
GRANT ALL PRIVILEGES ON moodle.* TO'root'@'localhost';
CREATE USER 'moodle'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456789';
GRANT ALL PRIVILEGES ON moodle.* TO'moodle'@'localhost';
exit
/etc/init.d/mysql restart

Siapkan folder /var/moodledata/

Download language pack

cd /usr/local/src
wget https://download.moodle.org/download.php/direct/langpack/3.8/id.zip

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

cd /usr/local/src
wget https://download.moodle.org/download.php/direct/stable38/moodle-latest-38.tgz

Install

cd /usr/local/src
cp moodle-latest-38.tgz /var/www/html/
cd /var/www/html/
tar zxvf moodle-latest-38.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 (native/mysqli)
  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/