Install phpMyAdmin Latest Version on Ubuntu 16.04 | 18.04 with Apache2, MariaDB and PHP 7.2
Want to manually install the latest versions of phpMyAdmin on Ubuntu? This brief tutorial shows students and new users how to download the latest version of phpMyAdmin package and manually install and configure it on Ubuntu 16.04 /18.04 with Apache2, MariaDB and PHP 7.2 or PHP 7.3 support…
phpMyAdmin packages are available via Ubuntu default repositories… However, the version that comes with Ubuntu might not necessarily be the latest.. In order to get the latest version, you may have to manually download the archived package from its website and install it and that’s what this brief tutorial is going to show you….
For those who don’t know, phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web…. phpMyAdmin supports a wide range of operations on MySQL and MariaDB….When you’re ready to manually install phpMyAdmin, follow the steps below:
Step 1: Install Apache2 HTTP Server
phpMyAdmin needs a web server to function.. A popular open source web server is Apache2.. Run the commands below to install it on Ubuntu…
sudo apt update sudo apt install apache2
After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots…https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9335073871881367&output=html&h=186&slotname=2470875543&adk=1924800705&adf=3711537765&w=743&fwrn=4&lmt=1601108774&rafmt=11&psa=1&guci=2.2.0.0.2.2.0.0&format=743×186&url=https%3A%2F%2Fwebsiteforstudents.com%2Finstall-phpmyadmin-latest-version-on-ubuntu-16-04-18-04-with-apache2-mariadb-and-php-7-2%2F&flash=0&wgl=1&dt=1601108774582&bpp=16&bdt=1202&idt=77&shv=r20200923&cbv=r20190131&ptt=9&saldr=aa&abxe=1&cookie=ID%3D8c8eb438d58f17b5%3AT%3D1601108712%3AS%3DALNI_MbcT1WS62hz1ToDorLRMg-1jcHsng&correlator=14363089872&frm=20&pv=2&ga_vid=613215081.1569230168&ga_sid=1601108775&ga_hid=749207612&ga_fc=1&iag=0&icsg=48047&dssz=33&mdo=0&mso=0&rplot=4&u_tz=420&u_his=1&u_java=0&u_h=768&u_w=1366&u_ah=738&u_aw=1366&u_cd=24&u_nplug=2&u_nmime=2&adx=111&ady=1274&biw=1351&bih=638&scr_x=0&scr_y=0&eid=21066699%2C21066792%2C21066922%2C21066973&oid=3&pvsid=201549697249377&pem=382&ref=https%3A%2F%2Fwww.google.com%2F&rx=0&eae=0&fc=896&brdim=0%2C0%2C0%2C0%2C1366%2C0%2C0%2C0%2C1366%2C638&vis=1&rsz=%7C%7CpeEbr%7C&abl=CS&pfx=0&fu=8320&bc=31&ifi=1&uci=a!1&btvi=1&fsb=1&xpc=TtbPLCnxCv&p=https%3A//websiteforstudents.com&dtd=126
sudo systemctl stop apache2.service sudo systemctl start apache2.service sudo systemctl enable apache2.service
Now that Apache2 is installed…. to test whether the web server is working, open your browser and browse to the URL below…http://localhost
If you see the page above, then Apache2 is successfully installed…
Step 2: Install MariaDB Database Server
Since we’re going to be managing MariaDB databases via phpMyAdmin, run the commands below to install MariaDB database server on Ubuntu…
sudo apt-get install mariadb-server mariadb-client
After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots…https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9335073871881367&output=html&h=280&slotname=7976466598&adk=3330084803&adf=3259679314&w=743&fwrn=4&fwrnh=100&lmt=1601108775&rafmt=1&psa=1&guci=2.2.0.0.2.2.0.0&format=743×280&url=https%3A%2F%2Fwebsiteforstudents.com%2Finstall-phpmyadmin-latest-version-on-ubuntu-16-04-18-04-with-apache2-mariadb-and-php-7-2%2F&flash=0&fwr=0&fwrattr=true&rpe=1&resp_fmts=3&wgl=1&adsid=ChAI8M27-wUQxtTG3uyjxqdQEj0AoRBMkAmr9w7bi6JcuB1mmH0Bm3TuKcu-HmE8OvZvdImLXhn0apbnie-hvwnajZC1B3Xz_3sXOdZQQVZP&dt=1601108774599&bpp=9&bdt=1218&idt=139&shv=r20200923&cbv=r20190131&ptt=9&saldr=aa&abxe=1&cookie=ID%3D8c8eb438d58f17b5%3AT%3D1601108712%3AS%3DALNI_MbcT1WS62hz1ToDorLRMg-1jcHsng&prev_fmts=743×186%2C327x250%2C327x250%2C0x0&nras=1&correlator=14363089872&frm=20&pv=1&ga_vid=613215081.1569230168&ga_sid=1601108775&ga_hid=749207612&ga_fc=0&iag=0&icsg=2145199&dssz=34&mdo=0&mso=0&u_tz=420&u_his=1&u_java=0&u_h=768&u_w=1366&u_ah=738&u_aw=1366&u_cd=24&u_nplug=2&u_nmime=2&adx=111&ady=3238&biw=1351&bih=638&scr_x=0&scr_y=696&eid=21066699%2C21066792%2C21066922%2C21066973&oid=3&psts=AGkb-H8eDbYoNv88B7bsL29rkyPBYpjteukzkni3rWT7O1VvlxJguupo6JAA-Zkcif8&pvsid=201549697249377&pem=382&ref=https%3A%2F%2Fwww.google.com%2F&rx=0&eae=0&fc=896&brdim=0%2C27%2C0%2C27%2C1366%2C0%2C1366%2C710%2C1366%2C638&vis=1&rsz=%7C%7CpeEbr%7C&abl=CS&pfx=0&fu=8320&bc=31&ifi=2&uci=a!2&btvi=3&fsb=1&xpc=sJETyiFM3p&p=https%3A//websiteforstudents.com&dtd=1370
Run these on Ubuntu 16.04 LTS
sudo systemctl stop mysql.service sudo systemctl start mysql.service sudo systemctl enable mysql.service
Run these on Ubuntu 18.10 and 18.04 LTS
sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation…
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
Now that MariaDB is installed, to test whether the database server was successfully installed, run the commands below…
sudo mysql -u root -p
type the root password when prompted…
If you see a similar screen as shown above, then the server was successfully installed…
Step 3: Install PHP Script
In order to get phpMyAdmin working, you’ll need to install PHP and related modules…https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9335073871881367&output=html&h=186&slotname=2470875543&adk=1924800705&adf=740126775&w=743&fwrn=4&lmt=1601108779&rafmt=11&psa=1&guci=2.2.0.0.2.2.0.0&format=743×186&url=https%3A%2F%2Fwebsiteforstudents.com%2Finstall-phpmyadmin-latest-version-on-ubuntu-16-04-18-04-with-apache2-mariadb-and-php-7-2%2F&flash=0&wgl=1&adsid=ChAI8M27-wUQxtTG3uyjxqdQEj0AoRBMkAmr9w7bi6JcuB1mmH0Bm3TuKcu-HmE8OvZvdImLXhn0apbnie-hvwnajZC1B3Xz_3sXOdZQQVZP&dt=1601108774609&bpp=3&bdt=1228&idt=154&shv=r20200923&cbv=r20190131&ptt=9&saldr=aa&abxe=1&cookie=ID%3D8c8eb438d58f17b5%3AT%3D1601108712%3AS%3DALNI_MbcT1WS62hz1ToDorLRMg-1jcHsng&prev_fmts=743×186%2C327x250%2C327x250%2C0x0%2C743x280&nras=1&correlator=14363089872&frm=20&pv=1&ga_vid=613215081.1569230168&ga_sid=1601108775&ga_hid=749207612&ga_fc=0&iag=0&icsg=2145199&dssz=34&mdo=0&mso=0&rplot=4&u_tz=420&u_his=1&u_java=0&u_h=768&u_w=1366&u_ah=738&u_aw=1366&u_cd=24&u_nplug=2&u_nmime=2&adx=111&ady=5428&biw=1351&bih=638&scr_x=0&scr_y=2905&eid=21066699%2C21066792%2C21066922%2C21066973&oid=3&psts=AGkb-H8eDbYoNv88B7bsL29rkyPBYpjteukzkni3rWT7O1VvlxJguupo6JAA-Zkcif8%2CAGkb-H-Lw2ahzdUFnWKAhDO57tmIUg5hr7svrnjplKUhUsWUF62N414CfYrLAJXbJJs&pvsid=201549697249377&pem=382&ref=https%3A%2F%2Fwww.google.com%2F&rx=0&eae=0&fc=896&brdim=0%2C27%2C0%2C27%2C1366%2C0%2C1366%2C710%2C1366%2C638&vis=1&rsz=%7C%7CpeEbr%7C&abl=CS&pfx=0&fu=8320&bc=31&ifi=3&uci=a!3&btvi=4&fsb=1&xpc=JZuVb5uVdC&p=https%3A//websiteforstudents.com&dtd=4456
However, PHP 7.2 may not be available in Ubuntu default repositories… To run PHP 7.2 on Ubuntu 16.04 and previous, you may need to run the commands below:
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php
Then update and upgrade to PHP 7.2
sudo apt update
Then run the commands below to install
sudo apt-get install php7.2 php-tcpdf php7.2-cgi php7.2-mysqli php-pear php7.2-mbstring php7.2-gettext libapache2-mod-php7.2 php7.2-common php-phpseclib php7.2-mysql
After installing the above PHP required modules, go and download PHP latest version… You can get it from the link below:https://www.phpmyadmin.net/downloads/
When you find the version you want, run the commands below to download it.. replacing the package link.. Next, move the extracted files and create a new phpmyadmin directory…
cd /tmp wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-english.tar.gz tar xvzf phpMyAdmin-4.8.5-english.tar.gz sudo mv phpMyAdmin-4.8.5-english /usr/share/phpmyadmin
After that, create these directory and adjust their permissions to support Apache2…
sudo mkdir -p /var/lib/phpmyadmin/tmp sudo mkdir /etc/phpmyadmin/ sudo chown -R www-data:www-data /var/lib/phpmyadmin
When you’re done, copy phpMyAdmin sample config file and create a new default config file using the commands below:
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
After that edit the line in the file using the secret passphrase… can be anything… You can visit the website below to generate blowfish key using its key generator.http://www.passwordtool.hu/blowfish-password-hash-generator
sudo nano /usr/share/phpmyadmin/config.inc.php
Then edit the highlighted line:
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * phpMyAdmin sample configuration, you can use it as base for * manual configuration. For easier setup you can use setup/ $cfg['blowfish_secret'] = '$2a$07$ln5gsWXQazAkMsKI691mxOVmyDOhmOmS/j8NLyfHAVB/lDKZb24fe'; /* $ /**
Scroll down the file and add a temp directory config line as shown below:
/** * End of servers configuration */ * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; $cfg['TempDir'] = '/var/lib/phpmyadmin/tmp'; /**
Save the file and exit
When you’re done… run the commands below to great phpMyAdmin Apache2 configuration file…
sudo nano /etc/apache2/conf-enabled/phpmyadmin.conf
Then copy and paste the lines below into the file and save…
Alias /phpmyadmin /usr/share/phpmyadmin <Directory /usr/share/phpmyadmin> Options SymLinksIfOwnerMatch DirectoryIndex index.php <IfModule mod_php5.c> <IfModule mod_mime.c> AddType application/x-httpd-php .php </IfModule> <FilesMatch ".+\.php$"> SetHandler application/x-httpd-php </FilesMatch> 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/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/ php_admin_value mbstring.func_overload 0 </IfModule> <IfModule mod_php.c> <IfModule mod_mime.c> AddType application/x-httpd-php .php </IfModule> <FilesMatch ".+\.php$"> SetHandler application/x-httpd-php </FilesMatch> 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/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/ php_admin_value mbstring.func_overload 0 </IfModule> </Directory> # Authorize for setup <Directory /usr/share/phpmyadmin/setup> <IfModule mod_authz_core.c> <IfModule mod_authn_file.c> AuthType Basic AuthName "phpMyAdmin Setup" AuthUserFile /etc/phpmyadmin/htpasswd.setup </IfModule> Require valid-user </IfModule> </Directory> # Disallow web access to directories that don't need it <Directory /usr/share/phpmyadmin/templates> Require all denied </Directory> <Directory /usr/share/phpmyadmin/libraries> Require all denied </Directory> <Directory /usr/share/phpmyadmin/setup/lib> Require all denied </Directory>
Save the file and exit
Restart Apache2 by running the commands below:
sudo systemctl restart apache2
After that, open your web browser and browse to the server hostname or IP address followed by phpmyadminhttp://example.com/phpmyadmin
You should see phpMyAdmin logon page…
You won’t be able to logon with MariaDB root account…
When you attempt to logon using MariaDB root account it will fail… That’s because MariaDB and MySQL have switch their authentication method to auth_socket
The auth_socket plugin authenticates users that connect from the localhost through the Unix socket file… which prevents users from connecting with password… So, you won’t be able to connect via phpMyAdmin…
When you attempt to logon, you see the error “#1698 – Access denied for user ‘root’@’localhost’”
To fix that, run the commands below:
sudo mysql -u root
That should get you into the database server. After that, run the commands below to disable plugin authentication for the root user
use mysql; update user set plugin='' where User='root'; flush privileges; exit
Restart and run the commands below to set a new password.
sudo systemctl restart mariadb.service
Now try again to logon… this time it should work!
Congratulations! You have successfully installed phpMyAdmin with Apache2, MariaDB and PHP 7.2 support…
Source : https://websiteforstudents.com/install-phpmyadmin-latest-version-on-ubuntu-16-04-18-04-with-apache2-mariadb-and-php-7-2/
Posted on: September 26, 2020, by : Julian's | 30 views