Difference between revisions of "USB OFFLINE: Debian 11.7 Install Moodle, Apache2, MariaDB, PHP 8"

From OnnoWiki
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
  sudo apt update
 
  sudo apt update
 
  sudo apt -y install software-properties-common ca-certificates lsb-release apt-transport-https
 
  sudo apt -y install software-properties-common ca-certificates lsb-release apt-transport-https
  sudo apt -y install gnupg-agent
+
  sudo apt -y install gnupg-agent unzip
  sudo add-apt-repository ppa:ondrej/php  
+
  wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
 +
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
 
  sudo apt update
 
  sudo apt update
  
Line 15: Line 16:
  
 
  sudo su
 
  sudo su
  apt -y install php-common php-mysql php-xml php-xmlrpc \
+
  apt -y install php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc \
  php-curl php-gd php-imagick php-cli php-dev \
+
  php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php-dev \
  php-imap php-mbstring php-opcache php-soap \
+
  php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap \
  php-zip php-intl php-cli \
+
  php8.1-zip php8.1-intl php8.1-cli \
  imagemagick git zip libgd-dev libapache2-mod-php \
+
  imagemagick git zip libgd-dev libapache2-mod-php8.1 \
  php php-common libapache2-mod-php php-cli
+
  php8.1 php8.1-common libapache2-mod-php8.1 php8.1-cli
 +
 
  
 
Edit
 
Edit
  
  sudo vi /etc/php/7.4/apache2/php.ini
+
  sudo vi /etc/php/8.1/apache2/php.ini
  
 
  upload_max_filesize = 100M
 
  upload_max_filesize = 100M
Line 33: Line 35:
 
  max_input_time = 1000
 
  max_input_time = 1000
  
Switch ke PHP7.4
+
Switch ke PHP 8.1
  
 
  sudo update-alternatives --config php
 
  sudo update-alternatives --config php
  
 
+
There are 2 choices for the alternative php (providing /usr/bin/php).
 +
 
   Selection    Path            Priority  Status
 
   Selection    Path            Priority  Status
 
  ------------------------------------------------------------
 
  ------------------------------------------------------------
  * 0            /usr/bin/php8.1   81       auto mode
+
  * 0            /usr/bin/php8.2   82       auto mode
   1            /usr/bin/php7.4   74       manual mode
+
   1            /usr/bin/php8.1   81       manual mode
   2            /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: 1
 
  Press <enter> to keep the current choice[*], or type selection number: 1
 +
update-alternatives: using /usr/bin/php8.1 to provide /usr/bin/php (php) in manual mode
  
  
Line 98: Line 102:
 
  exit
 
  exit
  
  service mysqld start
+
  systemctl start mariadb
  service mysqld restart
+
  systemctl enable mariadb
 +
systemctl status mariadb
  
 
==Siapkan folder /var/moodledata/==
 
==Siapkan folder /var/moodledata/==
Line 137: Line 142:
  
 
  cd /usr/local/src
 
  cd /usr/local/src
  cp moodle-latest-400.tgz /var/www/html/
+
  cp moodle-4.2.1.tgz /var/www/html/
 
  cd /var/www/html/
 
  cd /var/www/html/
  tar zxvf moodle-latest-400.tgz
+
  tar zxvf moodle-4.2.1.tgz
 
  chown -Rf www-data: /var/moodledata/
 
  chown -Rf www-data: /var/moodledata/
 
  chmod -Rf 777 /var/www/html/moodle
 
  chmod -Rf 777 /var/www/html/moodle

Latest revision as of 09:02, 17 June 2023

Update Repo

sudo apt update
sudo apt -y install software-properties-common ca-certificates lsb-release apt-transport-https
sudo apt -y install gnupg-agent unzip
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
sudo apt update

Install Apache2

apt -y install apache2


Install PHP 8.x 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 php-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-php8.1 \
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 PHP 8.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: 1
update-alternatives: using /usr/bin/php8.1 to provide /usr/bin/php (php) in manual mode


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
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb

Siapkan folder /var/moodledata/

Download language pack lewat web

https://download.moodle.org/download.php/langpack/4.2/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/stable400/moodle-latest-400.tgz
https://download.moodle.org/download.php/stable402/moodle-4.2.1.tgz

Copykan menggunakan scp ke

/usr/local/src


Install

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