Monday, November 11, 2024
PHPmyadmin Rocky Linux

Install phpMyAdmin pada rocky linux

phpmyadmin

Pada hari ini saya akan membahas cara Install phpMyAdmin pada rocky linux.

1. Install nginx

- update OS
sudo dnf -y update

- install
dnf -y install nginx

2. install mariadb/mysql

- install
dnf -y install mariadb mariadb-server

- start service
systemctl start mariadb
systemctl enable mariadb

- config mysql

mysql_secure_installation


- Buat DB nya

mysql -u root -p
CREATE DATABASE phpmyadmin CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY '123passwd';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'%';
FLUSH PRIVILEGES;
exit


3. Install php

dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf module -y reset php
dnf module install php:remi-7.4 -y
dnf -y install php php-{cli,common,fpm,curl,gd,mbstring,process,snmp,xml,zip,memcached,mysqlnd,json,mbstring,pdo,pdo-dblib,xml}

- setting time
vi  /etc/php.ini
date.timezone = Asia/Jakarta

- setting php-fpm
vi /etc/php-fpm.d/www.conf

user = nginx

; RPM: Keep a group allowed to write in log dir.
group = nginx

;listen = 127.0.0.1:9000
listen = /run/php-fpm/www.sock

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

- start service

systemctl enable php-fpm
systemctl restart php-fpm
systemctl start nginx
systemctl enable nginx

4. install phpmyadmin

wget https://files.phpmyadmin.net/phpMyAdmin/$VER/phpMyAdmin-$VER-english.tar.gz
gpg --keyserver hkp://pgp.mit.edu --recv-keys 3D06A59ECE730EB71B511C17CE752F178259BD92
gpg --verify phpMyAdmin-$VER-english.tar.gz.asc
mkdir /usr/share/nginx/phpmyadmin
tar xzf phpMyAdmin-${VERSION}-all-languages.tar.gz -C /usr/share/nginx/phpmyadmin --strip-components=1

5. setting nginx

vi /etc/nginx/conf.d/phpmyadmin.conf

server {
    listen       80;
    server_name  phpmyadmin.example.com;
    root         /usr/share/nginx/phpmyadmin;
    
    access_log /var/log/nginx/phpmyadmin_access.log;
    error_log /var/log/nginx/phpmyadmin_error.log;

    index   index.php;

    location / {
        try_files    $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
         try_files $uri =404;
         fastcgi_intercept_errors on;
         include        fastcgi_params;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         fastcgi_pass unix:/run/php-fpm/www.sock;
     }
}

chown nginx:nginx /etc/nginx/nginx.conf

- cek file
nginx -t

systemctl restart nginx

6. Config phpmyadmin

cp /usr/share/nginx/phpmyadmin/config{.sample,}.inc.php
vi /usr/share/nginx/phpmyadmin/config.inc.php

ganti line

/** $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

menjadi

$cfg['blowfish_secret'] = 'm[a9LgO=Yo:n1ayWfi:UcR=sDx;vceBn';

- set permission

chown -R nginx:nginx  /var/lib/php/session/
chown -R nginx:nginx /usr/share/nginx/phpmyadmin

- restart service

systemctl restart nginx php-fpm


- tambahkan firewall

firewall-cmd --zone public --add-service http
firewall-cmd --permanent --zone public --add-service http
firewall-cmd --reload

- set hosts

vim /etc/hosts 
192.168.1.2 phpmyadmin.example.com

- akses web

http://ipaddr

(Visited 223 times, 1 visits today)
Baca Juga :  Video Tutorial Cara Install Docker CE dan Compose pada Almalinux 8 | Rocky Linux 8

Similar Posts