Instal WordPress terbaru dengan LAMP Stack di Ubuntu 20.04

Selamat datang di panduan kami tentang cara menginstal WordPress terbaru dengan LAMP Stack di Ubuntu 20.04. Seperti yang mungkin sudah Anda ketahui, WordPress adalah sistem manajemen konten sumber terbuka dan gratis yang ditulis dalam PHP dan sebagian besar digunakan untuk membuat situs web gratis atau membangun blog pribadi.

Instal WordPress terbaru dengan LAMP Stack di Ubuntu 20.04

Prasyarat

Sebelum Anda dapat menginstal WordPress di Ubuntu 20.04, ada beberapa prasyarat yang harus ditetapkan sebelum Anda dapat melanjutkan.

Jalankan Pembaruan sistem

Pastikan paket sistem Anda mutakhir.

apt update apt upgrade

Instal LAMP/LEMP Stack

WordPress adalah aplikasi berbasis PHP dan karenanya, membutuhkan LAMP atau LEMP stack yang diinstal agar berfungsi dengan baik. Dalam demo ini, kami menjalankan WordPress dengan LAMP stack; Ubuntu 20.04 sebagai OS Linux, PHP 7.4, MySQL 8, dan Apache sebagai web server.

Ikuti tautan di bawah ini untuk menginstal LAMP Stack di Ubuntu 20.04;

Instal LAMP Stack di Ubuntu 20.04

Selanjutnya, instal modul PHP lain yang diperlukan jika belum diinstal;

apt install php7.4-{mysql,cli,json,opcache,xml,gd,curl}

Buat Database MySQL WordPress

Login ke MySQL dan buat database WordPress;

mysql -u root -p

Buat basis data WordPress. Ganti database dan user database yang sesuai.

create database wpdb;

Buat user database WordPress dan berikan semua hak istimewa pada database.

create user [email protected] identified by '[email protected]#';
grant all on wpdb.* to [email protected];

Reload tabel hak istimewa database dan keluar dari database.

flush privileges;
quit

Instal WordPress terbaru (5.x) di Ubuntu 20.04

WordPress 5.4.1 adalah versi terbaru dari penulisan panduan ini. Download arsip WordPress versi terbaru dari  halaman downloadan WordPress.

wget https://wordpress.org/latest.tar.gz

Buat direktori root web Anda tempat menginstal WordPress. Ganti nama yang sesuai.

mkdir /var/www/html/wp.kifarunix-demo.com

Selanjutnya, ekstrak konten arsip WordPress ke direktori root Web Anda yang dibuat di atas.

tar xzf latest.tar.gz -C /var/www/html/wp.kifarunix-demo.com --strip-components=1

Verifikasi bahwa file WordPress sudah ada.

ls /var/www/html/wp.kifarunix-demo.com
index.php wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php license.txt wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php readme.html wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php

Konfigurasikan WordPress di Ubuntu 20.04

WordPress hadir dengan contoh konfigurasi,  wp-config-sample.php. Ganti nama file konfigurasi sampel.

cp /var/www/html/wp.kifarunix-demo.com/wp-config{-sample,}.php

Selanjutnya, edit file konfigurasi dan atur detail koneksi database,

vim /var/www/html/wp.kifarunix-demo.com/wp-config.php

Ganti DB_NAME, DB_USER, DB_PASSWORD dengan nilai yang Anda tetapkan saat membuat database MySQL untuk WordPress.

... // ** MySQL settings - You can get this info from your web host ** // /** name of the database for WordPress */ define( 'DB_NAME', 'wpdb' ); /** MySQL database username */ define( 'DB_USER', 'wpadmin' ); /** MySQL database password */ define( 'DB_PASSWORD', '[email protected]#' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' ); /** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' );...

Selanjutnya, buat kunci dan garam unik otentikasi. Anda cukup membuat kunci dan garam dari service Kunci Rahasia WordPress sebagai berikut;

curl -s https://api.wordpress.org/secret-key/1.1/salt/
define('AUTH_KEY', 'BkIM1nZ`;ni.E(^[email protected],R{bG%[email protected]=~=-];h%|bA{idi ^BTT|[7,l_L&i5UY'); define('SECURE_AUTH_KEY', 'WAgvv#q|d_EOhWk|;kKhE2&jO{h-G#oMz4,W;O)xH}VB63a2FV^*?oR$5w[tP0=h'); define('LOGGED_IN_KEY', '?|&6H,|v3}-_-(m[*m Kd<|3|m3QMLW5|>Tr=[I|b9q)! g*=H9vD<O6fqe>pg(@'); define('NONCE_KEY', '&yq9[1N^f,P l IVMse<[email protected],yFkP!fE;<Q296_vEs t%ZVdT.f&j:9'); define('AUTH_SALT', '-pE?xU-<w-|Y7S~<Bm+HXCVr$b~$vt]KLNd|Za-__]Io#,,gN4y6l.H|$r=6amZ!'); define('SECURE_AUTH_SALT', '+V(D|4%|d$J!D|McEDFOl=x*YTtha4We;=HjkRzHz#(0(YZPIK,!0vI9e{ZBV/=]'); define('LOGGED_IN_SALT', 'hLc|}}b8YjjaRawp={[)},xZkwX%Uun_<>_|+r[uD-?sbJQp|_e0?eXxtP~|$#8E'); define('NONCE_SALT', '[email protected]|+Hg;-w++_l;>-NL>+xB&r{FfQ*@E|ti/[email protected]]');

Catatan, Jangan gunakan tombol di atas. Hasilkan milikmu,

Dalam wp-config.php, ganti baris berikut dengan yang di atas.

... * @since 2.6.0 */ define( 'AUTH_KEY', 'put your unique phrase here' ); define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); define( 'NONCE_KEY', 'put your unique phrase here' ); define( 'AUTH_SALT', 'put your unique phrase here' ); define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); define( 'NONCE_SALT', 'put your unique phrase here' ); /**#@-*/...

Konfigurasi Anda akan terlihat seperti;

... * @since 2.6.0 */ /** * define( 'AUTH_KEY', 'put your unique phrase here' ); * define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); * define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); * define( 'NONCE_KEY', 'put your unique phrase here' ); * define( 'AUTH_SALT', 'put your unique phrase here' ); * define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); * define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); * define( 'NONCE_SALT', 'put your unique phrase here' ); */ define('AUTH_KEY', 'BkIM1nZ`;ni.E(^[email protected],R{bG%[email protected]=~=-];h%|bA{idi ^BTT|[7,l_L&i5UY'); define('SECURE_AUTH_KEY', 'WAgvv#q|d_EOhWk|;kKhE2&jO{h-G#oMz4,W;O)xH}VB63a2FV^*?oR$5w[tP0=h'); define('LOGGED_IN_KEY', '?|&6H,|v3}-_-(m[*m Kd<|3|m3QMLW5|>Tr=[I|b9q)! g*=H9vD<O6fqe>pg(@'); define('NONCE_KEY', '&yq9[1N^f,P l IVMse<[email protected],yFkP!fE;<Q296_vEs t%ZVdT.f&j:9'); define('AUTH_SALT', '-pE?xU-<w-|Y7S~<Bm+HXCVr$b~$vt]KLNd|Za-__]Io#,,gN4y6l.H|$r=6amZ!'); define('SECURE_AUTH_SALT', '+V(D|4%|d$J!D|McEDFOl=x*YTtha4We;=HjkRzHz#(0(YZPIK,!0vI9e{ZBV/=]'); define('LOGGED_IN_SALT', 'hLc|}}b8YjjaRawp={[)},xZkwX%Uun_<>_|+r[uD-?sbJQp|_e0?eXxtP~|$#8E'); define('NONCE_SALT', '[email protected]|+Hg;-w++_l;>-NL>+xB&r{FfQ*@E|ti/[email protected]]'); /**#@-*/...

Simpan dan keluar dari file konfigurasi.

Konfigurasikan Server Web Apache

Buat konfigurasi host virtual Apache untuk situs WordPress Anda.

vim /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80> ServerAdmin [email protected] ServerName wp.kifarunix-demo.com DocumentRoot /var/www/html/wp.kifarunix-demo.com <Directory /var/www/html/wp.kifarunix-demo.com> AllowOverride All </Directory> ErrorLog /var/log/apache2/wp.error.log CustomLog /var/log/apache2/wp.access.log combined </VirtualHost>

Simpan dan keluar dari file konfigurasi.

Setel kepemilikan user dan grup dari konfigurasi situs Anda ke user Apache, www-data.

chown -R www-data:www-data /var/www/html/wp.kifarunix-demo.com

Periksa error sintaks Apache;

apachectl -t

Jika Anda mendapatkan, Syntax OK, lanjutkan untuk mengaktifkan konfigurasi situs WordPress.

a2ensite wordpress.conf

Nonaktifkan situs Apache default;

a2dissite 000-default.conf

Mulai ulang Apache;

systemctl restart apache2

Jika UFW sedang berjalan, buka port 80/tcp untuk mengizinkan akses eksternal.

ufw allow 80/tcp

Selesaikan Pengaturan WordPress di Ubuntu 20.04

Untuk menyelesaikan pengaturan WordPress di Ubuntu 20.04, navigasikan ke browser dan akses situs WordPress Anda, http://<server-IP-Or-hostname>.

Pilih bahasa instalasi WordPress Anda dan klik Continue.

Atur judul situs Anda, nama user Anda, password, alamat email, pilih apakah akan menonaktifkan atau mengaktifkan pengindeksan situs dan menginstal WordPress di Ubuntu 20.04.

Setelah instalasi selesai, login ke WordPress Anda menggunakan nama user dan password yang baru saja Anda buat. Dan di sana Anda pergi. WordPress Anda berhasil diatur.

Anda sekarang dapat menulis dan mempublikasikan barang-barang Anda di blog WordPress Anda. Itu membawa kita ke akhir panduan kami tentang cara menginstal WordPress terbaru dengan LAMP Stack di Ubuntu 20.04

Tutorial Terkait

Instal phpMyAdmin di Ubuntu 20.04

Cara memperbaiki WordPress tidak dapat membuat koneksi aman ke WordPress.org

Instal WordPress dengan Nginx dan MySQL 8 di CentOS 8

Instal WordPress 5 dengan Nginx di Debian 10 Buster