Instalasi
Debian 12
Update Repository
Pastikan repository sudah update
Copy sudo apt-get update -y
Install Web Server
Install apache2
Copy sudo apt install apache2 -y
Start dan enable service apache2
Copy sudo systemctl enable apache2 && sudo systemctl start apache2
Pastikan apache2 sudah berjalan
Copy sudo systemctl status apache2
Install PHP
Install PHP8.2 beserta dengan depedensinya
Copy sudo apt-get install php8.2 php8.2-cli php8.2-common php8.2-imap php8.2-redis php8.2-snmp php8.2-xml php8.2-mysqli php8.2-zip php8.2-mbstring php8.2-curl libapache2-mod-php -y
Pastikan PHP sudah terinstall dengan cek versi
Install Database Server
Install mariadb server
Copy sudo apt install mariadb-server -y
Start dan enable mariadb server
Copy sudo systemctl start mariadb && sudo systemctl enable mariadb
Pastikan mariadb sudah berjalan
Copy sudo systemctl status mariadb
Buat Database
Buat Wordpress database
Copy CREATE USER ' wordpress '@ 'localhost' IDENTIFIED BY 'YourStrongPasswordHere' ;
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress. * TO 'wordpress' @ 'localhost' ;
FLUSH PRIVILEGES;
EXIT;
Install Wordpress
Download dan install wordpress
Copy cd /var/www/html
wget https://wordpress.org/latest.zip
unzip latest.zip
rm latest.zip
Set permissions untuk file dan folder
Copy chown -R www-data:www-data wordpress/
cd wordpress/
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Buka file wp-config.php
Copy mv wp-config-sample.php wp-config.php
nano wp-config.php
Sesuaikan database dengan yang sudah dibuat sebelumnya
Copy // ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define ( 'DB_NAME' , 'wordpress' ) ;
/** Database username */
define ( 'DB_USER' , 'wordpress' ) ;
/** Database password */
define ( 'DB_PASSWORD' , 'YourStrongPasswordHere' ) ;
Buat Virtual Host
Buat file konfigurasi untuk virtual host
Copy cd /etc/apache2/sites-available/
touch wordpress.conf
Tambahkan script untuk virtual host
Copy <VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/wordpress
<Directory /var/www/html/wordpress>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enamble konfigurasi apache untuk wordpress
Copy sudo a2enmod rewrite
sudo a2ensite wordpress.conf
Cek sintak apakah sudah benar sebelum restart service dari apache
Reload file konfigurasi yang baru ditambahkan
Copy systemctl reload apache2
Akses WordPress melalui port http: http://127.0.0.1:80
Reference
Last updated 7 months ago