How to Install phpMyAdmin on Debian 11

Introduction

phpMyAdmin is a free and open source web-based database management tool written in PHP. It is used to manage MySQL and MariaDB databases. It provides a graphical user interface to manage databases, create and modify tables, add and delete users, and more. Installing phpMyAdmin on Debian 11 is a straightforward process. This guide will walk you through the steps of installing phpMyAdmin on Debian 11.

How to Install phpMyAdmin on Debian 11

1. Update the package list:

sudo apt update

2. Install phpMyAdmin:

sudo apt install phpmyadmin

3. Configure phpMyAdmin:

sudo dpkg-reconfigure phpmyadmin

4. Select Apache2 as the web server.

5. Enter a password for the phpMyAdmin user.

6. Confirm the password.

7. Select Yes to configure a database for phpMyAdmin.

8. Select Yes to use dbconfig-common to set up the database.

9. Enter a password for the database user.

10. Confirm the password.

11. Restart Apache:

sudo systemctl restart apache2

12. Access phpMyAdmin in your web browser:

http://localhost/phpmyadmin
[ad_1]

Introduction

The phpMyAdmin utility is a web-based graphical database management tool. By installing phpMyAdmin, you no longer need to use the default command-line interface to manage databases.

This guide will show you how to lay the groundwork and install phpMyAdmin on Debian 11.

Tutorial on how to Install phpMyAdmin on Debian 11

Prerequisites

  • Debian 11 installed and running.
  • A user account with sudo or root privileges.
  • Access to a terminal window/command line.

Step 1: Install LAMP Stack on Debian 11

phpMyAdmin requires the LAMP stack to work correctly. This section shows you how to install the supporting software to turn your Debian 11 system into a web server.

If you already have a LAMP stack installed, you can skip directly to the Download phpMyAdmin section.

Step 1.1: Update Software Packages and Install wget

Open a terminal window and update your software package lists with the following command:

sudo apt update

Enter the following command to install the wget tool:

sudo apt install wget -y

The wget utility allows you to download files directly from the terminal window.

You now have the tools to install a LAMP stack and phpMyAdmin.

Step 1.2: Install Apache

Apache is a web server software that processes requests and transmits data over an HTTP network. Install Apache by entering the following command in the terminal:

sudo apt install apache2 -y

The process takes a few moments to complete. Enter the following command to confirm the Apache service is running:

systemctl status apache2

The report shows a green status message that says active (running).

Status of Apache web server on Debian 11.

Press Ctrl+z to return to the command prompt.

Step 1.3: Install PHP on Debian 11

The PHP programming language and coding environment are essential for running a web application like phpMyAdmin. Install core PHP packages and Apache and MySQL plugins with the following command:

sudo apt -y install php php-cgi php-mysqli php-pear php-mbstring libapache2-mod-php php-common php-phpseclib php-mysql

Once the installation process is complete, verify that PHP has been installed:

php --version

The system displays the current PHP version along with the release date.

The version of PHP currently installed on Debian 11.

Step 1.4: Install and Set Up MariaDB on Debian 11

This guide uses the MariaDB open-source relational database management system instead of MySQL. MariaDB and MySQL are compatible, and many commands and features are identical.

To install MariaDB, enter the following command:

sudo apt install mariadb-server mariadb-client -y

Once the process is complete, verify the MariaDB installation:

systemctl status mariadb

Like with Apache, you see an active (running) status.

System confirms that the MariaDB service is active and running on Debian 11.

Before installing phpMyAdmin, you need to configure the MariaDB database.

Secure MariaDB

Configure basic MariaDB security features by launching a built-in script:

sudo mysql_secure_installation

As you have not yet set a root password for your database, hit Enter to skip the initial query. Complete the following queries:

  • Switch to unix_socket authentication [Y/n] – Enter n to skip.
  • Set root password? [Y/n] – Type y and press Enter to create a strong root password for your database. If you already have a root password, enter n to answer the Change the root password question.
  • Remove anonymous users? [Y/n] – Type y and press Enter.
  • Disallow root login remotely? [Y/n] – Type y and press Enter.
  • Remove test database and access to it? [Y/n] – Type y and confirm with Enter.
  • Reload privilege tables now? [Y/n] – Type y and confirm with Enter.

The output shows the MariaDB installation is now secure.

screenshot showing you have successfully secured the MariaDB installation on Debian 10

Create a New MariaDB User

The phpMyAdmin utility needs a designated user to connect to your database. Creating a new MariaDB user improves security and allows you to control the level of permissions granted to this user.

Use our detailed guide to create a new MariaDB user and grant privileges. Once you set up a MariaDB user, start the phpMyAdmin installation process.

Step 2: Download phpMyAdmin

Use the wget command to retrieve the latest stable version of phpMyAdmin:

wget -P Downloads https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz

To download the English version only, use this command instead:

wget -P Downloads https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-english.tar.gz

The -P option instructs wget to save the files directly in the Downloads directory. Use any directory to download the file and remember the path.

phpMyAdmin downloading in Debian 11

Note: To download a specific version, or to check the latest version, please refer to the developer’s phpMyAdmin page.

Step 3: Check phpMyAdmin GPG Key

Each downloaded archive has a corresponding .asc file that contains its unique key signature. Once both files are in the same folder, the signature can be verified.

1. To verify the GPG key for phpMyAdmin, download the phpMyAdmin keyring to the directory you used previously. In our case Downloads:

wget -P Downloads https://files.phpmyadmin.net/phpmyadmin.keyring

2. Access the Downloads directory and import the keyring:

cd Downloads
gpg --import phpmyadmin.keyring
System imports gpg keyring to verify phpmyadmin download files

3. Download the corresponding GPG .asc file for your version of phpMyAdmin and stay in the same directory:

wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz.asc

4. Stay in the same directory (in our case Downloads) and verify the .asc file against the keyring you downloaded:

gpg --verify phpMyAdmin-latest-all-languages.tar.gz.asc

The system responds by displaying GPG key information.

Output with the GPG key that verifies the downloaded files

You can now compare the GPG key to the developer credentials on the phpMyAdmin documentation page.

Step 4: Unpack and Configure phpMyAdmin

1. Create a phpMyAdmin directory in the Apache web root directory:

sudo mkdir /var/www/html/phpMyAdmin

2. Access the Downloads directory and unpack the phpMyAdmin tar.gz files to the newly created directory:

sudo tar xvf phpMyAdmin-latest-all-languages.tar.gz --strip-components=1 -C /var/www/html/phpMyAdmin

The terminal shows no response when the file is unpacked.

3. Create a default configuration file:

sudo cp /var/www/html/phpMyAdmin/config.sample.inc.php /var/www/html/phpMyAdmin/config.inc.php

4. Use the nano text editor (or your preferred text editor) to add a secret passphrase to the config.inc.php file:

sudo nano /var/www/html/phpMyAdmin/config.inc.php

Locate the following line:

$cfg['blowfish_secret'] = '';
Add passphrase to the phpmyadmin config file.

Add a secret passphrase between the single quotes. For example:

$cfg['blowfish_secret'] = 'My_Secret_Passphras3!';

Use a complex passphrase of your choice and then exit and save the file (Ctrl+x).

5. Change the permissions for the config.inc.php file:

sudo chmod 660 /var/www/html/phpMyAdmin/config.inc.php

6. Change ownership of the phpMyAdmin directory:

sudo chown -R www-data:www-data /var/www/html/phpMyAdmin

7. Restart Apache:

sudo systemctl restart apache2

Step 5: Access phpMyAdmin from Browser

Use a web browser and navigate to the localhost/your_phpMyAdmin_directory adress to access phpMyAdmin. In our case:

localhost/phpMyAdmin

The system shows the phpMyAdmin login screen and establishes a connection to the local Apache, MariaDB, and PHP files that you have created.

phpMyAdmin login page Debian 11

Log in to phpMyAdmin with the username and password for the MariaDB user you had created.

Conclusion

You have now installed phpMyAdmin on your Debian 11 system. Access the GUI from a browser and start administering your databases more efficiently.

[ad_2]

How to Install phpMyAdmin on Debian 11

phpMyAdmin is a free and open source web-based database management tool written in PHP. It is used to manage MySQL and MariaDB databases. It provides a graphical user interface to manage databases, create and modify tables, add, delete and edit records, execute SQL statements, and manage users and permissions.

Prerequisites

  • A server running Debian 11.
  • A root user or a user with sudo privileges.
  • Apache web server installed and running.
  • MySQL or MariaDB installed and running.

Step 1: Install phpMyAdmin

Before installing phpMyAdmin, you need to install some required packages. You can install them with the following command:

sudo apt-get install php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath

Once all the packages are installed, you can install phpMyAdmin with the following command:

sudo apt-get install phpmyadmin

During the installation, you will be asked to select the web server that should be automatically configured to run phpMyAdmin. Select Apache and press Enter.

Next, you will be asked to configure the database for phpMyAdmin with dbconfig-common. Select Yes and press Enter.

You will be asked to provide the MySQL application password for phpMyAdmin. Provide your password and press Enter.

Step 2: Configure Apache for phpMyAdmin

Once the installation is completed, you will need to configure Apache for phpMyAdmin. You can do this by editing the Apache configuration file:

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

Add the following lines:

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.php
    AllowOverride All
    Require all granted
</Directory>

Save and close the file, then enable the configuration with the following command:

sudo a2enconf phpmyadmin

Next, restart Apache for the changes to take effect:

sudo systemctl restart apache2

Step 3: Access phpMyAdmin

Now, open your web browser and type the URL http://your-server-ip/phpmyadmin. You will be redirected to the phpMyAdmin login page:

Provide your MySQL username and password, then click on the Go button. You should see the phpMyAdmin dashboard in the following page:

Congratulations! You have successfully installed phpMyAdmin on Debian 11.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00