Content
- page: Installing and configuring MariaDB, Apache and PHP7.3
- page: Manually install, configure, and test phpMyAdmin
- page: Creating and configuring a PHP-FPM pool for phpMyAdmin (optional)
2. page content
Continuation
The description on the first page we installed the MariaDB-t, Apache web server, and PHP 7.3 at. On this page we end the LAMP server construction: we install and configure the phpMyAdmin web database management interface, which we do in a unique way because the Debian 10 package does not include this software by default.
Installing phpMyAdmin
A The Debian 10 (Buster) package does not contain the phpMyAdmin packagethat we don't know APT package manager you can simply install it. Instead, download the source code package manually and complete the installation and setup process yourself. However, for those who like to have fun in the terminal - as I do - this installation will be a real gourmet wall!
Since we need to install phpMyAdmin individually, there are a number of ways to do this. However, if you want to build a perfect server later on from this installation, it is important that you proceed as described here so that you do not have problems later.
Debian has meanwhile made the phpMyAdmin installation package available in the Buster Backports repository, so you can install it from there. So if you don’t want to install and configure it manually, visit the link below:
For manual installation, continue with the description.
Creating a library structure
To remain root, first create the necessary directories and the HTTP authentication configuration file, which is left blank:
mkdir /usr/share/phpmyadmin
mkdir /etc/phpmyadmin
mkdir -p /var/lib/phpmyadmin/tmp
touch /etc/phpmyadmin/htpasswd.setup
Download and unpack
A phpMyAdmin official download site scrolling down we find a section called "Latest Stable Version". Here we look for the link "phpMyAdmin-latest-all-languages.tar.gz", for which we will now use the URL.
Go to the / tmp directory and download:
cd /tmp
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
Unzip and transfer the contents to the directory you created above:
tar -xzf phpMyAdmin-latest-all-languages.tar.gz
mv phpMyAdmin-4.9.1-all-languages/* /usr/share/phpmyadmin/
(Here, of course, the unzipped directory name will be based on the current version)
Delete unnecessary things:
rm phpMyAdmin-latest-all-languages.tar.gz
rm -rf phpMyAdmin-4.9.1-all-languages/
Adjust the www data user the phpMyAdmin directory and its entire contents, because this user will need to be able to access PHP on their behalf:
chown -R www-data:www-data /var/lib/phpmyadmin
Beállítások
The program package is already in place, we still need to make some settings before we can get started with the database settings.
Database settings
Create a PMA control user and database
PhpMyAdmin is a so-called. maintains and synchronizes its own internal information boards in the background with the help of a control user. We won't have to deal with this user later, but we need to create one manually here. In essence, this is the earlier one Ubuntu 18.04 LTS, Respectively Debian 9 (Stretch) It is the manual equivalent of automatic settings for control users also on LAMP servers. So let's figure out a password here that we'll use soon.
Enter the MariaDB console a configured defaults file via:
mysql --defaults-file=/etc/mysql/debian.cnf
Then issue the following SQL commands one line at a time, replacing 'password'to the password we invented:
CREATE DATABASE phpmyadmin;
CREATE USER 'pma'@'localhost' IDENTIFIED BY 'jelszo';
GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'jelszo' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
Normally, the story should look like this:
Create your own phpMyAdmin tables
Pma has its own user and database created, we just need to populate this database with phpMyAdmin's own tables. For this purpose, there is an SQL file in the downloaded package that you just need to run in the database:
mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/phpmyadmin/sql/create_tables.sql
Normally, this command will not output any output, but if you re-enter the console, you can simply check that the tables are created:
mysql --defaults-file=/etc/mysql/debian.cnf
Then in the console:
use phpmyadmin;
show tables;
exit;
Here you can see that 19 created tables with "pma__" starting, so the bundled SQL file ran without problems.
Allow root access
As before Debian 9 (Stretch), or that Ubuntu 18.04 When installing phpMyAdmins for LAMP servers, you also need to enable root access, which is disabled by default for security reasons.
To do this, log in to the MariaDB console again:
mysql --defaults-file=/etc/mysql/debian.cnf
Then we will issue the following SQL commands line by line:
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND plugin = 'unix_socket';
FLUSH PRIVILEGES;
exit;
On the first command you need to return something like this:
Query OK, 1 row affected (0.014 sec) Rows matched: 1 Changed: 1 Warnings: 0
We would do this with parts of the database.
Configure config.inc.php
Config.inc.php is the main configuration file for phpMyAdmin and contains all the necessary settings. Initially, you need to make a copy of a template file and then make the changes. Copy the following command:
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
Before we can open the file, we need a so-called. blowfish secret code, which provides us with cookie-based login, so we can use phpMyAdmin more conveniently than with basic HTTP authentication. The code must be unique, which can be generated on many web pages, or even created on the command line. There are many ways to do this, for example with the following command:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32 && echo
Now so suddenly it came. In the end, the echo only gives a line break so that we can more conveniently copy the resulting code. Example output (do not use this, generate your own):
935N410AWjD5CUe1mPyV36nLVGaUA2Br
After copying this 32 alphanumeric string, open the config.inc.php file:
nano /usr/share/phpmyadmin/config.inc.php
And make the following changes:
[...] $cfg['blowfish_secret'] = 'ide helyezzük be a generált 32 karakter hosszúságú blowfish_secret kódunkat'; [...] // $cfg['Servers'][$i]['controlhost'] = 'localhost'; // $cfg['Servers'][$i]['controlport'] = ''; // $cfg['Servers'][$i]['controluser'] = 'pma'; // $cfg['Servers'][$i]['controlpass'] = 'itt adjuk meg a korábban beállított PMA jelszavunkat'; /* Storage database and tables */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma__relation'; // $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; // $cfg['Servers'][$i]['history'] = 'pma__history'; // $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; // $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; // $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; // $cfg['Servers'][$i]['recent'] = 'pma__recent'; // $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; // $cfg['Servers'][$i]['users'] = 'pma__users'; // $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; // $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; // $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; // $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; // $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; // $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; [...] $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; $cfg['TempDir'] = '/var/lib/phpmyadmin/tmp'; [...]
So, in a row, do the following:
- $ Cfg [ 'blowfish_secret'] here we enter our blowfish_secret code among the apostrophes
- $ Cfg [ 'Servers'] [$ i] [ 'host control'] set the value here: 'localhost'
- $ Cfg [ 'Servers'] [$ i] [ 'pass control'] and in the row the PMA password we invented above.
- Slightly lower, a SaveDirline below the line highlighted in green TempDirvariety.
You can insert it virtually anywhere, but it is logical to place it here in the configuration sections of libraries. - Finally, remove any comments highlighted in red from the lines.
Save the file.
Configuring Apache
As a final step, only the Apache configuration is left. Create the phpMyAdmin Apache configuration file:
nano /etc/apache2/conf-available/phpmyadmin.conf
And let's include the following:
# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
<IfModule mod_php7.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/
php_admin_value mbstring.func_overload 0
</IfModule>
</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
Order Deny,Allow
Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Order Deny,Allow
Deny from All
</Directory>
This is the default configuration for phpMyAdmin.
Then enable the configuration:
a2enconf phpmyadmin
You can also do a configuration test to see if the syntax is correct:
apache2ctl configtest
If so, let's restart Apache:
systemctl restart apache2
Testing phpMyAdmin
And the moment has come when everything is ready, we can try our phpMyAdmin. Load into your browser the right one IP addresses:
http://192.168.1.130/phpmyadmin
Enter your root access here and we will arrive at your homepage:
Here's a fresh, crisp, flawless copy of phpMyAdmin for 4.9.1. However, let's not go far if we still feel like it, because we can still grind it. :)
A next page we continue with the optional fine-tuning of phpMyAdmin for PHP-FPM.
- How to easily install from the backports repository or upgrade your manually installed phpMyAdmin web database management system on Debian 10 (Buster) servers
- Installing Debian 9 (Stretch) LAMP Server v1.0
- Installing Debian 8 (Jessie) LAMP Server v1.0
- Install v18.04 on the Ubuntu 1.0 LTS (Bionic Beaver) LAMP Server
- Install Ubuntu 20.04 LTS (Focal Fossa) LAMP Server v1.0
- Debian 11 (Bullseye) LAMP server v1.0 installation
- Perfect server: Debian 11 (Bullseye) v1.0
- How to install PHP-FPM on a Debian 8 (Jessie) LAMP server
- How to install newer PHP versions on our Debian 9 (Stretch) LAMP server in PHP-FPM mode
- New features and changes to the Debian 10 (Buster) operating system
Navigation
- To post registration and login required
- 1102 views