Cara Install WordPress dengan Apache di Ubuntu 20.04

00.install-wordpress-apache-ubuntu2004.png

WordPress adalah sebuah perangkat lunak content management system (CMS) yang dapat memudahkan kita dalam membuat website. WordPress menjadi CMS paling populer saat ini, di mana terdapat 40% website di internet yang berbasis WordPress. Pada tutorial kali ini, kita akan belajar bagaimana cara install WordPress di Ubuntu 20.04 dengan menggunakan Apache web server.

*0.Tutorial Environment*

Spesifikasi dan konfigurasi yang digunakan di tutorial ini:

· Server: VPS Ubuntu 20.04 · IP server: 188.166.229.126 · Web server: Apache · SSL: Let’s Encrypt · PHP: versi 7.4 · MariaDB: versi 10.5 · WordPress: versi 5.7 · Domain: domain.com

*1.DNS Record*

Arahkan domain ke IP server terlebih dahulu dengan melakukan konfigurasi DNS record.

· Type = A, Name = domain.com, Target = 188.166.229.126 · Type = CNAME, Name = www, Target = domain.com

*2.Update System*

Update dan upgrade Ubuntu.

[INPUT]

1 2 apt update apt upgrade -y

*3.Install Apache*

Install Apache web server.

[INPUT]

1 apt install apache2 -y

*4.Install PHP*

Pasang repository PPA untuk PHP.

[INPUT]

1 add-apt-repository ppa:ondrej/php

Install PHP dan extensionnya.

[INPUT]

1 apt install php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-common php7.4-mbstring php7.4-gd php7.4-intl php7.4-xml php7.4-mysql php7.4-zip php7.4-json -y

*5.Konfigurasi Apache*

Ubah konfigurasi default virtual host.

[INPUT]

1 nano /etc/apache2/sites-available/000-default.conf

Aktifkan opsi ServerName dengan menghapus karakter # dan ganti www.example.com dengan IP server. Untuk menyimpan file di nano editor CTRL+O dan keluar CTRL+X.

[INPUT]

1 ServerName 188.166.229.126

Membuat konfigurasi virtual host untuk domain.com.

[INPUT]

1 nano /etc/apache2/sites-available/domain.com.conf

Masukkan konfigurasi virtual host.

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12     ServerName domain.com     ServerAlias www.domain.com     DocumentRoot /var/www/domain.com              Options Indexes FollowSymLinks MultiViews         AllowOverride All         Require all granted          ErrorLog /var/log/apache2/domain.com_error.log     CustomLog /var/log/apache2/domain.com_access.log combined

Download WordPress, ekstrak, dan pindahkan ke /var/www.

[INPUT]

1 2 3 wget https://wordpress.org/latest.tar.gz -O wordpress.tar.gz tar xzvf wordpress.tar.gz mv wordpress /var/www/domain.com

Ubah ownership dan permission file WordPress.

[INPUT]

1 2 chown -R www-data:www-data /var/www/domain.com chmod -R 755 /var/www/domain.com

Aktifkan virtual host, modul rewrite, restart service apache2, dan cek statusnya apakah berjalan dengan baik.

[INPUT]

1 2 3 4 a2ensite domain.com a2enmod rewrite systemctl restart apache2 systemctl status apache2

*6.Let’s Encrypt SSL*

Install certbot.

[INPUT]

1 2 snap install –classic certbot ln -s /snap/bin/certbot /usr/bin/certbot

Request SSL untuk domain.com yang terpasang di Apache.

[INPUT]

1 certbot –apache -d domain.com -d www.domain.com

Masukkan alamat email untuk menerima notifikasi ketika SSL akan habis masa berlakunya, perlu dilakukan pembaruan SSL.

[INPUT]

1 2 Enter email address (used for urgent renewal and security notices) (Enter ‘c’ to cancel): saya@email.com

Jawab ‘Y (Yes)’ untuk menyetujui Terms of Service.

[INPUT]

1 2 3 4 5 Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server. Do you agree? – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – (Y)es/(N)o: Y

Jawab ‘Y (Yes)’ jika ingin dikirimkan informasi ke email.

[INPUT]

1 2 3 4 5 6 7 Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let’s Encrypt project and the non-profit organization that develops Certbot? We’d like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – (Y)es/(N)o: Y

SSL berhasil terpasang.

[INPUT]

1 2 Congratulations! You have successfully enabled HTTPS on https://domain.com and https://www.domain.com

SSL dari Let”€™s Encrypt hanya berlaku selama 3 bulan, harus diperbarui secara berkala. Untuk memperbarui SSL dari Let”€™s Encrypt cukup menjalankan certbot dengan parameter renew.

[INPUT]

1 certbot renew

*7.Install MariaDB*

Pasang repository MariaDB versi 10.5 untuk Ubuntu 20.04 yang berada di server mirror DigitalOcean Singapura.

[INPUT]

1 2 3 apt install software-properties-common -y apt-key adv –fetch-keys ‘https://mariadb.org/mariadb_release_signing_key.asc’ add-apt-repository ‘deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main’

Update dan upgrade.

[INPUT]

1 2 apt update apt upgrade -y

Install MariaDB server.

[INPUT]

1 apt install mariadb-server -y

Mengamankan Instalasi MariaDB.

[INPUT]

1 mysql_secure_installation

Jawab pertanyaan yang diajukan.

[INPUT]

1 2 3 4 5 6 7 Enter current password for root (enter for none): ENTER Switch to unix_socket authentication [Y/n] y Change the root password? [Y/n] y 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

Login ke MariaDB.

[INPUT]

1 mysql

Membuat database, username, dan memberikan hak akses ke database.

[INPUT]

1 2 3 4 5 CREATE DATABASE wordpress; CREATE USER ‘wordpress’@’localhost’ IDENTIFIED BY ‘rahasia’; GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpress’@’localhost’; FLUSH PRIVILEGES; exit

*8.Install WordPress*

Browse domain.com untuk menyelesaikan instalasi WordPress.

1. Bahasa = English (United States), Continue. 2. Let’s go! 3. Database Name = wordpress, Username = wordpress, Password = rahasia. Submit. 4. Run the installation. 5. Masukkan Site Title, Username, Password, dan Your Email. Install WordPress.

WordPress sudah siap digunakan.

Selamat mencoba 🙂

Leave a Reply

Your email address will not be published.

scroll to top