CentOS 8.x phpMyAdmin

From Notes_Wiki
Revision as of 04:18, 22 May 2023 by Saurabh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > CentOS > CentOS 8.x > Web based tools > CentOS 8.x phpMyAdmin

To setup phpMyAdmin use:

  1. Install required packages
    dnf -y install wget epel-release php httpd tar php-mysqlnd expect php-json php-xml
  2. Download latest version of phpMyAdmin from https://www.phpmyadmin.net/downloads/ For Example
    wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-english.tar.gz
  3. Extract the downloaded archive using tar. For example:
    tar xzf phpMyAdmin-5.1.0-english.tar.gz
  4. Move extracted folder to /usr/share/phpmyadmin location. For example
    mv phpMyAdmin-5.1.0-english /usr/share/phpmyadmin
  5. Go to /usr/share/phpmyadmin and rename config file.
    cd /usr/share/phpmyadmin
    mv config.sample.inc.php config.inc.php
  6. Edit config.inc.php file and insert 32 byte random secret for '$cfg['blowfish_secret']'. For example 'mkpasswd -l 32 -s 0'
    $cfg[‘blowfish_secret’]=’brsfgegjvxwRCoeeencssmmsq1athw7n’;
  7. Create temporary folder and set appropriate permissions
    mkdir /usr/share/phpmyadmin/tmp
    chown -R apache:apache /usr/share/phpmyadmin
    chmod 777 /usr/share/phpmyadmin/tmp
  8. Create '/etc/httpd/conf.d/phpmyadmin.conf' with
    Alias /phpmyadmin /usr/share/phpmyadmin
     
    <Directory /usr/share/phpmyadmin/>
        AddDefaultCharset UTF-8
     
        <IfModule mod_authz_core.c>
          # Apache 2.4  
          <RequireAny>
           Require all granted
          </RequireAny>
         </IfModule>
         <IfModule !mod_authz_core.c>
           # Apache 2.2
           Order Deny,Allow
           Deny from All
           Allow from 127.0.0.1
           Allow from ::1
        </IfModule>
     </Directory>
        
    <Directory /usr/share/phpmyadmin/setup/>
        <IfModule mod_authz_core.c>
          # Apache 2.4
          <RequireAny>
            Require all granted
          </RequireAny>
        </IfModule>
        <IfModule !mod_authz_core.c>
          # Apache 2.2
          Order Deny,Allow
          Deny from All
          Allow from 127.0.0.1
          Allow from ::1
        </IfModule>
    </Directory>
  9. Start and enable httpd
    systemctl start httpd
    systemctl enable httpd
  10. Optionally configure SELinux, Firewall and restrict access to phpMyAdmin to some IPs/via password


Refer:


Home > CentOS > CentOS 8.x > Web based tools > CentOS 8.x phpMyAdmin