Sunday, May 8, 2016

Auto Updating phpMyAdmin without hassle

You can use below bash code on CentOS/Fedora and RedHat to auto update phpMyAdmin:

GitHub Code: https://github.com/mason-chase/phpMyAdmin-auto-update

Edit two options: PHPMYADMIN_FULL_PATH=/var/www/ and PHPMYADMIN_FOLDER_NAME=phpmyadmin

install.sh
#!/bin/bash  
# Copyright Mason Chase (sid@moontius.com)
# DISCLAIMER: install.sh SCRIPT AND ITS CONTENT ARE DESIGNED AND TESTED UNDER CENTOS/FEDORA/REDHAT AND YOU MAY USE IT AT YOUR RISK ONLY.

# Download latest rpmforge to get 7zip in our system
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm -O /usr/src/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

# install yum reposity
rpm -ivh  rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

# install 7zip with yum
yum install p7zip -y

# append some cron entry 
crontab -l | { cat; echo "
# Auto Update phpMyAdmin everyday at 4AM
0 4 * * * /usr/bin/phpmyadmin_update.sh"; } | crontab -

# 
cat >/usr/bin/phpmyadmin_auto_update.sh << 
EOL
#!/bin/bash  

# Copyright Mason Chase (sid@moontius.com)
# DISCLAIMER: install.sh SCRIPT AND ITS CONTENT ARE DESIGNED AND TESTED UNDER CENTOS/FEDORA/REDHAT AND YOU MAY USE IT AT YOUR RISK ONLY.

#echo on
set -x


# must have beginning slash and trailing slash
PHPMYADMIN_FULL_PATH=/var/www/

# must not have beginning or trailing slash
PHPMYADMIN_FOLDER_NAME=phpmyadmin

#  Download phpmyadmin download page
/usr/bin/wget https://www.phpmyadmin.net/downloads/ -O /tmp/phpmyadmin-download.html
# Map Latest phpmyadmin English with 7-zip format using regex
MYSQL_URL=\$(cat /tmp/phpmyadmin-download.html|grep -e "

Then:
sudo ./install.sh

No comments:

Post a Comment