{"id":8745,"date":"2020-07-01T07:47:44","date_gmt":"2020-07-01T11:47:44","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8745"},"modified":"2021-12-04T08:25:03","modified_gmt":"2021-12-04T08:25:03","slug":"install-latest-phpmyadmin-ubuntu-20-04","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/install-latest-phpmyadmin-ubuntu-20-04\/","title":{"rendered":"How to Install the Latest phpMyAdmin on Ubuntu 20.04"},"content":{"rendered":"\n
This tutorial will guide you in your quest to install the latest phpMyAdmin on your Ubuntu system.<\/p>\n\n\n\n
phpMyadmin is probably the best freely available web-based MySQL<\/a> and MariaDB<\/a> administration application. You can download and install on your server running PHP and a server like Apache<\/a>, Nginx<\/a>, or IIS<\/a> among others.<\/p>\n\n\n\n We are assuming you already have installed the MySQL server on your Ubuntu<\/a> system. In this case, we will be using Ubuntu 20.04. We will also assume you have Apache, PHP<\/a>, and a non-root user with sudo<\/em> privileges, as well as a firewall configured with ufw<\/em>. This tutorial about the LAMP stack<\/a> will help you install the necessary prerequisites.<\/p>\n\n\n\n We will also recommend you have an existing domain configured with an SSL\/TLS certificate. This is because phpMyAdmin communicates directly with your MySQL installation, uses MySQL credentials to authenticate as well as create users, databases, and their objects, as well as executes and returns results for SQL queries.<\/p>\n\n\n\n If you have the above in place you are ready to proceed.<\/p>\n\n\n\n PhpMyAdmin can be installed from the default Ubuntu repositories. This will not install the latest available phpMyAdmin version. The steps to install the latest phpMyAdmin will be highlighted later in this tutorial.<\/p>\n\n\n\n The process involves updating your server’s package index and then using apt install them on your Ubuntu system. Use the following commands:<\/p>\n\n\n\n php-mbstring<\/em> and php-gettext<\/em> extensions will only be installed if they are not already installed.<\/p>\n\n\n\n Follow the prompts in order to configure your installation correctly with the following hints:<\/p>\n\n\n\n The phpMyAdmin Apache configuration file will be added to the \/etc\/apache2\/conf-enabled\/<\/em> directory.<\/p>\n\n\n\n You may need to explicitly enable the mbstring<\/strong> PHP extension if it has not been previously enabled. This can be done by running the following command:<\/p>\n\n\n\n Restart Apache for your changes to be saved:<\/p>\n\n\n\n phpMyAdmin is now installed and configured. Be sure to make sure MySQL users have the privileges required.<\/p>\n\n\n\n let’s take a diversion to install the latest phpMyAdmin on your Ubuntu system seeing the above procedure does not give us the latest version.<\/p>\n\n\n\n Download the latest phpMyAdmin<\/a> archive from the official download page here<\/a>. Also, visit the page to determine the latest version which is currently phpMyAdmin 5.0.2 at the initial publishing of this tutorial.<\/p>\n\n\n\n Use the following commands to download phpMyAdmin 5.0.2 onto your system.<\/p>\n\n\n\n If wget<\/strong> or unzip<\/strong> are missing you can install them using the apt<\/em> install command.<\/p>\n\n\n\n Next, create a tmp directory and set the proper permissions.<\/p>\n\n\n\n Next, you need to configure webserver to serve phpMyAdmin over the network by creating an Apache configuration file for phpMyAdmin:<\/p>\n\n\n\n Add the content below to the configuration file you have just created.<\/p>\n\n\n\n Save and close the file, enable the configuration, and restart apache to pick up the new changes using the following commands:<\/p>\n\n\n\n You now have the latest phpMyAdmin on your Ubuntu system which can be accessed through the server IP address or domain name.<\/p>\n\n\n\n From this point onwards, whether you used the default Ubuntu 20.04 phpMyAdmin or you opted to go for the latest version, everything is pretty much the same from here on.<\/p>\n\n\n\n Sign in with the username and password that you used to access MySQL on the command line. If the user has no privileges then they may have to be set from the MySQL privileged admin user you have. It is important to disable the root user from non-local sources for security reasons seeing phpMyAdmin is generally available off the Internet.<\/p>\n\n\n\n PhpMyAdmin is a popular target for attackers, and you should take extra care to prevent unauthorized access. We are going to do this by adding a gateway in front of the entire application by using Apache\u2019s built-in .htaccess authentication and authorization functionalities.<\/p>\n\n\n\n Enable the use of .htaccess<\/em> file overrides by editing your Apache configuration file with this command.<\/p>\n\n\n\n Add an AllowOverride All<\/em> directive within the Directory \/usr\/share\/phpmyadmin<\/em> section of the configuration file, like this:<\/p>\n\n\n\n Save and close the file.<\/p>\n\n\n\n Restart Apache to implement the changes.<\/p>\n\n\n\n Create a password file outside of the directories that are being served directory using the htpasswd<\/strong> utility:<\/p>\n\n\n\n You will be prompted to select and confirm a password for the user you are creating.<\/p>\n\n\n\n You can create additional users using the command below. Notice that the -c<\/em> flag is not used when adding users.<\/p>\n\n\n\n Now let’s create the .htaccess<\/em> file in your phpMyAdmin root folder<\/p>\n\n\n\n Type in the following rules into the file:<\/p>\n\n\n\n Save and close the file.<\/p>\n\n\n\n These are the options you have for securing the folder:<\/p>\n\n\n\n This setup adds an additional layer of security with a popup dialog that requires a username and password to access files within the folder.<\/p>\n\n\n\n You now have downloaded, install the latest phpMyAdmin, and configured it on your Ubuntu 20.04 server. You can create databases, users, tables, and other database objects as well as perform the usual operations like selecting, deleting, and modifying structures and data.<\/p>\n","protected":false},"excerpt":{"rendered":" This tutorial will guide you in your quest to install the latest phpMyAdmin on your Ubuntu system. phpMyadmin is probably the best freely available web-based MySQL and MariaDB administration application….<\/p>\n","protected":false},"author":1,"featured_media":8746,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,9,28,16,18,20],"tags":[58,164,180,308,313,320,354,365,393,400,424,433,449,452,454,526,531,543,591,598,635],"yoast_head":"\nPrerequisites<\/h2>\n\n\n\n
Default Step (Optional) \u2014 Installing phpMyAdmin<\/h2>\n\n\n\n
$ sudo apt update\n$ sudo apt install phpmyadmin php-mbstring php-gettext<\/code><\/pre>\n\n\n\n
$ sudo phpenmod mbstring<\/code><\/pre>\n\n\n\n
$ sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n
Step 1: Install the Latest phpMyAdmin on Ubuntu 20.04<\/h2>\n\n\n\n
$ wget https:\/\/files.phpmyadmin.net\/phpMyAdmin\/5.0.2\/phpMyAdmin-5.0.2-all-languages.zip\n$ unzip phpMyAdmin-5.0.2-all-languages.zip\n$ mv phpMyAdmin-5.0.2-all-languages \/usr\/share\/phpmyadmin<\/code><\/pre>\n\n\n\n
$ mkdir \/usr\/share\/phpmyadmin\/tmp\n$ chown -R www-data:www-data \/usr\/share\/phpmyadmin\n$ chmod 777 \/usr\/share\/phpmyadmin\/tmp<\/code><\/pre>\n\n\n\n
Step 2: Configure phpMyAdmin<\/h2>\n\n\n\n
$ sudo nano \/etc\/apache\/conf-available\/phpmyadmin.conf<\/code><\/pre>\n\n\n\n
Alias \/phpmyadmin \/usr\/share\/phpmyadmin\nAlias \/phpMyAdmin \/usr\/share\/phpmyadmin\n \n<Directory \/usr\/share\/phpmyadmin\/>\n AddDefaultCharset UTF-8\n <IfModule mod_authz_core.c>\n <RequireAny>\n Require all granted\n <\/RequireAny>\n <\/IfModule>\n<\/Directory>\n \n<Directory \/usr\/share\/phpmyadmin\/setup\/>\n <IfModule mod_authz_core.c>\n <RequireAny>\n Require all granted\n <\/RequireAny>\n <\/IfModule>\n<\/Directory><\/code><\/pre>\n\n\n\n
$ sudo a2enconf PHPMyAdmin\n$ sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n
http:\/\/example.com\/phpmyadmin<\/code><\/pre>\n\n\n\n
<\/figure><\/div>\n\n\n\n
<\/figure>\n\n\n\n
Step 3: Secure Your phpMyAdmin Instance<\/h2>\n\n\n\n
$ sudo nano \/etc\/apache2\/conf-available\/phpmyadmin.conf<\/code><\/pre>\n\n\n\n
<Directory \/usr\/share\/phpmyadmin>\n Options FollowSymLinks\n DirectoryIndex index.php\n AllowOverride All\n . . .\n<\/Directory><\/code><\/pre>\n\n\n\n
$ sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n
$ sudo htpasswd -c \/etc\/phpmyadmin\/.htpasswd username<\/code><\/pre>\n\n\n\n
$ sudo htpasswd \/etc\/phpmyadmin\/.htpasswd anotheruser<\/code><\/pre>\n\n\n\n
$ sudo nano \/usr\/share\/phpmyadmin\/.htaccess<\/code><\/pre>\n\n\n\n
AuthType Basic\nAuthName "Restricted area"\nAuthUserFile \/etc\/phpmyadmin\/.htpasswd\nRequire valid-user<\/code><\/pre>\n\n\n\n
Conclusion<\/h2>\n\n\n\n