sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server imagemagick libapache2-mod-php php php-common php-intl php-xml php-curl php-gd php-mbstring php-mysql php-apcu
apache2
systemctl status apache2
* apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-07-18 04:59:49 UTC; 1min 15s ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 16906 (apache2)
Tasks: 6 (limit: 38098)
Memory: 16.8M
CPU: 75ms
CGroup: /system.slice/apache2.service
|-16906 /usr/sbin/apache2 -k start
|-16910 /usr/sbin/apache2 -k start
|-16911 /usr/sbin/apache2 -k start
|-16912 /usr/sbin/apache2 -k start
|-16913 /usr/sbin/apache2 -k start
`-16915 /usr/sbin/apache2 -k start
Jul 18 04:59:49 webserver systemd[1]: Starting apache2.service - The Apache HTTP Server...
Jul 18 04:59:49 webserver systemd[1]: Started apache2.service - The Apache HTTP Server.
mariadb
systemctl status mariadb
* mariadb.service - MariaDB 10.11.6 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-07-18 04:59:40 UTC; 3min 45s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 15094 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 9 (limit: 38098)
Memory: 78.5M
CPU: 386ms
CGroup: /system.slice/mariadb.service
`-15094 /usr/sbin/mariadbd
Jul 18 04:59:39 webserver mariadbd[15094]: 2024-07-18 4:59:39 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jul 18 04:59:39 webserver mariadbd[15094]: 2024-07-18 4:59:39 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-secon>
Jul 18 04:59:39 webserver mariadbd[15094]: 2024-07-18 4:59:39 0 [Note] Server socket created on IP: '127.0.0.1'.
Jul 18 04:59:39 webserver mariadbd[15094]: 2024-07-18 4:59:39 0 [Note] InnoDB: Buffer pool(s) load completed at 240718 4:59:39
Jul 18 04:59:39 webserver mariadbd[15094]: 2024-07-18 4:59:39 0 [Note] /usr/sbin/mariadbd: ready for connections.
Jul 18 04:59:39 webserver mariadbd[15094]: Version: '10.11.6-MariaDB-0+deb12u1' socket: '/run/mysqld/mysqld.sock' port: 3306 Debian 12
Jul 18 04:59:40 webserver systemd[1]: Started mariadb.service - MariaDB 10.11.6 database server.
Jul 18 04:59:40 webserver /etc/mysql/debian-start[15108]: Upgrading MySQL tables if necessary.
Jul 18 04:59:40 webserver /etc/mysql/debian-start[15119]: Checking for insecure root accounts.
Jul 18 04:59:40 webserver /etc/mysql/debian-start[15123]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
lines 1-23/23 (END)
PHP
root@webserver:~# php -v
PHP 8.2.20 (cli) (built: Jun 17 2024 13:33:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.20, Copyright (c) Zend Technologies
with Zend OPcache v8.2.20, Copyright (c), by Zend Technologies
sudo nano /etc/php/8.2/apache2/php.ini
edit baris ini
date.timezone = Asia/Jakarta
upload_max_filesize = 80M
memory_limit = 512M
max_execution_time = 360
sudo systemctl restart apache2
mariadb-secure-installation
root@webserver:~# mariadb-secure-installation
Enter current password for root (enter for none): ******
...
Switch to unix_socket authentication [Y/n] n
...
Change the root password? [Y/n] n
...
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
... Success!
...
sudo mariadb -u root -p
CREATE DATABASE mediawiki_db;
CREATE USER mediawiki@localhost IDENTIFIED BY 'password';
GRANT ALL ON mediawiki_db.* TO mediawiki@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
# Download mediawiki source code
cd /var/www/
wget https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.1.tar.gz
# Extrac
tar -xvzf mediawiki-*.tar.gz
mv mediawiki-*/ mediawiki/
# fix permission
sudo chown -R www-data:www-data /var/www/mediawiki
sudo chmod 755 /var/www/mediawiki
sudo nano /etc/apache2/sites-available/mediawiki.conf
<VirtualHost *:80>
ServerName wiki.yaslab.my.id
DocumentRoot /var/www/html/mediawiki
<Directory /var/www/html/mediawiki/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite mediawiki
sudo a2enmod rewrite
sudo apachectl configtest
sudo systemctl restart apache2
Pastikan dns record menunjuk ke ip server
sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d wiki.yaslab.my.id
Sekarang anda dapat mengakses dengan https://wiki.yaslab.my.id
mv LocalSettings.php /var/www/mediawiki/
sudo chown -R www-data:www-data /var/www/mediawiki/LocalSettings.php