PhpMyAdmin is a free project for web developers designed to simplify interaction with MySQL databases. The tool is written in PHP and operates through any web browser. For its normal operation, it is necessary that the system has a web server, PHP and MySQL installed. This article will focus on installing PhpMyAdmin on various operating systems - Ubuntu, Centos, and Debian.
Install PhpMyAdmin on Ubuntu
Before you install the program on this system, you need to have a LAMP bundle in it. The first term in the abbreviation means that the Linux family system will be used.
Apache is one of the most requested web servers. MySql - component for operating with databases of a site or project. Well, PHP is the language in which web services are written. In this context, it means that a translator is being used that will convert the PHP code into instructions that the browser understands. The following is a brief description of the installation process for this kit. Without it, you canβt use PhpMyAdmin.
LAMP Installation
All these components can be installed separately, or you can use a ready-made kit. To understand the configuration process, it is better to do everything manually. Apache in Ubuntu can be installed in two lines:
- sudo apt-get update - this line is needed to update data on applications already existing in the system;
- sudo apt-get install apache2 - the installation itself.
Since these commands must be executed on behalf of the superuser, then sudo is placed in front of them, and a root password is required. The system scans the available space and reports on how much new software will take. Then he will offer to agree by pressing the Y key. Successful server installation is checked by going to the localhost address in the browser. As a result, approximately such a page should be shown, as shown in the figure below.
Next, install and configure MySQL. Like a server, a terminal is used. It types: sudo apt-get install mysql-server. In the process, the system will prompt you to enter the password for the root account. It is worth noting that this is not the root of Ubuntu, namely MySQL.
The final step is to install in Ubuntu PHP. This module will have to be installed in conjunction with several of its add-ons so that it can work correctly and optimally with databases and the server. This command consists of several names: sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql. After entering it, the installation of the LAMP components can be considered completed. It remains to restart the server with the sudo systemctl restart apache2 command.
To test the health of this software package, you need to create a test file in the / var / www / html / directory. In it, you can write several lines in PHP that will output data about the system or an error in case of failure:
Now, at the localhost / file_name.php address, something like this page should appear, as shown in the figure above.
PhpMyAdmin: sequence of actions
Installing PhpMyAdmin on Ubuntu is the same as installing the rest of the application β with a few lines. First, write this command: sudo apt-get install phpmyadmin. In the process, the user will be asked which server will function. In this case, you need to select Apache. The question that follows is whether the dbconfig-common configuration tool will be used, which is yes to the answer. And most importantly, a password for the MySQL database will be requested. Then you need a secret code for PhpMyAdmin. It remains to restart the web server again: sudo systemctl restart apache2. After navigating to the localhost / phpmyadmin address, the login and password input page should appear: After logging in, you can manually manage the databases using the convenient interface.
CentOS and PhpMyAdmin
To install PhpMyAdmin on CentOS, you will also need a LAMP set. The whole procedure is very similar to that described for Ubuntu. The only difference is that it is executed through the Yum manager and the name of the server itself looks a little different: sudo yum install httpd.
The launch is as follows:
- sudo systemctl start httpd
- sudo systemctl enable httpd
If everything is correct, then the test page will be available at the localhost address in the browser.
Next, you will need a MySQL server. Its implementations are slightly different for different Linux distributions, in particular, for CentOS, the MariaDB interpretation is installed: sudo yum install mariadb-server.
The launch is similar to a web server:
- sudo systemctl start mariadb
- sudo systemctl enable mariadb
But to work, you need to specify a password for root, so the command is used: sudo mysql_secure_installation. The new password is indicated.
PHP installation also happens with the connection of such a module: sudo yum install php php-pear php-gd php-mysql.
To apply all the changes made to the system, a web server is rebooted: sudo systemctl restart httpd.
Now it's the turn of PhpMyAdmin itself. There is a command for this: sudo yum install phpmyadmin
Just like in Ubuntu, after the next restart of the web server, the page with PhpMyAdmin will be opened by the command typed in the address bar of the browser: localhost / phpmyadmin. From now on, the installation of PhpMyAdmin on CentOS can be considered complete.
PhpMyAdmin and Debian
Debian and Ubuntu distributions are very similar. Therefore, it is not surprising that the entire installation instructions for PhpMyAdmin in Debian can be copied from the Ubuntu command to the command. The only difference may be that the current user is root, so the sudo command will be superfluous.
Conclusion
The article covered brief instructions on how to easily install the LAMP software package and PhpMyAdmin to it. Of course, the process cannot always go smoothly and errors will occur. But almost all of them are accompanied by their own codes, by which you can find an explanation and solution for them. But in most cases, the installation of PhpMyAdmin should take place without visible obstacles.
In addition, the Network for various distributions has a ready-made set of the LAMP kit, which can be installed in one line. Naturally, its assembly is carried out not by official manufacturers of products, so sometimes their versions may be slightly outdated. Manual installation makes it possible to use the latest versions. And after completing all the procedures, the owner will receive a convenient and fast component for managing their databases.