Vultr adalah perusahaan cloud computing asal Amerika Serikat yang telah beroperasi sejak tahun 2014. Untuk melayani konsumennya di seluruh dunia, Vultr saat ini memiliki 21 data center yang berlokasi di Amerika, Eropa, Australia, dan Asia (Jepang, India, Korea Selatan, dan Singapura). VPS Vultr yang paling murah mulai $5/bulan dengan spesifikasi 1vCPU, 1GB RAM, 25GB SSD, dan 1TB Bandwidth. Untuk sistem operasinya tersedia Linux (AlmaLinux, Arch Linux, CentOS, Debian, Fedora, Rocky Linux, Ubuntu, VzLinux), FreeBSD/OpenBSD, dan Windows.
Tutorial Environment
VPS dan software yang digunakan:
- VPS Ubuntu 22.04, 1CPU 1GB RAM
- IP Server 45.77.175.231
- Domain musaamin.my.id
- DNS Vultr
Membuat VPS
Membuat VPS (instance) di Vultr:
- Deploy New Server
- Choose Server, Pilih Cloud Compute
- CPU & Storage Technology, Pilih Regular Performance
- Server Location, Pilih Asia – Singapore
- Server Image, Pilih Operating System – Ubuntu 22.04 LTS
- Server Size, Pilih $5/month
- Enable Auto Backups, OFF
- Server Hostname & Label, misal server.musaamin.my.id
- Deploy Now
Update DNS Records
Update DNS records untuk mengarahkan domain ke IP VPS.
Type | Name | Value |
---|---|---|
A | musaamin.my.id atau @ | 45.77.175.231 |
CNAME | www | musaamin.my.id |
Untuk mengetahui bahwa domain sudah mengarah ke IP VPS, ping nama domain, reply harus dari IP VPS.
Mengakses VPS
Remote VPS dengan menggunakan aplikasi SSH client seperti PuTTY (Windows) atau OpenSSH (Linux, macOS). Informasi dari VPS yang dibutuhkan yaitu IPv4, username (root), dan password.
Remote VPS di Linux atau macOS.
1 | ssh root@45.77.175.231 |
Ketik yes, dan masukkan password.
1 2 3 4 5 | The authenticity of host '45.77.175.231 (45.77.175.231)' can't be established. ECDSA key fingerprint is SHA256:PFF7B6amJy5a3cHEw3NotPXyaPw9ZsXAyfvSSo84aHU. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '45.77.175.231' (ECDSA) to the list of known hosts. |
Sudah masuk ke VPS.
1 | root@myserver:~# |
Time Zone dan Update
Ubah time zone ke WIB.
1 | timedatectl set-timezone Asia/Jakarta |
Update apt cache.
1 | apt update |
Upgrade jika ada yang harus diupgrade.
1 | apt upgrade |
Install Apache
Install Apache web server.
1 | apt install apache2 -y |
Konfigurasi Virtual Host
Membuat folder document root, folder untuk tempat penyimpanan file website.
1 | mkdir /var/www/musaamin.my.id |
Membuat file index.html untuk pengujian dengan menggunakan perintah echo.
1 | echo "hello musaamin.my.id" > /var/www/musaamin.my.id/index.html |
Membuat file konfigurasi virtual host untuk musaamin.my.id.
1 | nano /etc/apache2/sites-available/musaamin.my.id.conf |
Masukkan konfigurasi virtual host.
1 2 3 4 5 6 7 8 9 10 11 12 | <VirtualHost *:80> ServerName www.musaamin.my.id ServerAlias musaamin.my.id DocumentRoot /var/www/musaamin.my.id <Directory /var/www/musaamin.my.id> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> ErrorLog /var/log/apache2/musaamin.my.id_error.log CustomLog /var/log/apache2/musaamin.my.id_access.log combined </VirtualHost> |
Mengaktifkan virtual host, restart Apache service, dan cek statusnya.
1 2 | a2ensite musaamin.my.id.conf systemctl restart apache2 |
Buka port 80 (HTTP) di firewall UFW.
1 | ufw allow http |
Uji browse http://musaamin.my.id, hasilnya teks “hello musaamin.my.id”.
Install SSL Let’s Encrypt
Buka port 443 (HTTPS) di firewall UFW.
1 | ufw allow https |
Install certbot Let’s Encrypt.
1 | apt install certbot python3-certbot-apache -y |
Request SSL untuk musaamin.my.id.
1 | certbot --non-interactive -m trial@musaamin.web.id --agree-tos --no-eff-email --apache -d musaamin.my.id -d www.musaamin.my.id --redirect |
Uji browse http://musaamin.my.id, harus redirect ke https://musaamin.my.id.
Install PHP
Install PHP dan extension yang dibutuhkan.
1 | apt install php libapache2-mod-php php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-json php-curl -y |
Cek versi PHP yang terpasang.
1 2 3 4 5 6 | php -v PHP 8.1.2 (cli) (built: Jun 13 2022 13:52:54) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies |
Install MariaDB
Install MariaDB database.
1 | apt install mariadb-server -y |
Login ke MariaDB.
1 | mysql |
Membuat database untuk WordPress.
1 2 3 4 | create database wordpress; grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by 'rahasia'; flush privileges; exit |
Install WordPress via WP-CLI
Download WP-CLI.
1 2 3 | curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar mv wp-cli.phar /usr/local/bin/wp |
Berpindah ke folder document root dan hapus file index.html
1 2 | cd /var/www/musaamin.my.id rm index.html |
Download WordPress core.
1 | wp core download --allow-root |
Membuat file konfigurasi WordPress wp-config.php yang memuat koneksi ke database.
1 2 3 4 5 6 | wp config create \ --dbname="wordpress" \ --dbuser="wordpress" \ --dbpass="rahasia" \ --dbhost="localhost" \ --allow-root |
Menjalankan perintah instalasi, mendefinisikan URL akses WordPress, admin user, admin password, admin email, dan title website.
1 2 3 4 5 6 7 | wp core install \ --url="https://musaamin.my.id" \ --title="Blog MusaAmin.my.id" \ --admin_user="admin123" \ --admin_password="rahasia123" \ --allow-root |
Mengubah ownership folder document root.
1 | chown -R www-data:www-data /var/www/musaamin.my.id |
Browse https://musaamin.my.id, WordPress telah terinstall.
Selamat mencoba 🙂