Centmin Mod: Install Phpmyadmin


Step 1:

cd /usr/local/src/centminmod/addons

Step 2

chmod 0700 /usr/local/src/centminmod/addons/phpmyadmin.sh

If you get the error:

[root@tutorialspots addons]# chmod 0700 /usr/local/src/centminmod/addons/phpmyadmin.sh
chmod: cannot access `/usr/local/src/centminmod/addons/phpmyadmin.sh': No such f
ile or directory

You can download it here

wget --no-check-certificate https://raw.githubusercontent.com/centminmod/phpmyadmin/master/phpmyadmin.sh

Result:

[root@tutorialspots addons]# wget --no-check-certificate https://github.com/centminmod/ph
pmyadmin/raw/master/phpmyadmin.sh
--2015-11-08 02:59:32--  https://github.com/centminmod/phpmyadmin/raw/master/php
myadmin.sh
Resolving github.com... 192.30.252.129
Connecting to github.com|192.30.252.129|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/centminmod/phpmyadmin/master/phpmyad
min.sh [following]
--2015-11-08 02:59:32--  https://raw.githubusercontent.com/centminmod/phpmyadmin
/master/phpmyadmin.sh
Resolving raw.githubusercontent.com... 23.235.43.133
Connecting to raw.githubusercontent.com|23.235.43.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26802 (26K) 1
Saving to: `phpmyadmin.sh'

100%[======================================>] 26,802      --.-K/s   in 0s

2015-11-08 02:59:32 (502 MB/s) - `phpmyadmin.sh' saved [26802/26802]

Step 3

./phpmyadmin.sh install

centminmod install phpmyadmin

[root@tutorialspots addons]# ./phpmyadmin.sh install
---------------------------------------------------------------
Create User: phpmyadmin
uid=503(phpmyadmin) gid=503(phpmyadmin) groups=503(phpmyadmin),501(nginx)
---------------------------------------------------------------

---------------------------------------------------------------
Installing phpmyadmin from official git repository...
---------------------------------------------------------------
This process can take some time depending on
speed of the repository and your server...

Initialized empty Git repository in /usr/local/nginx/html/6936_mysqladmin27567/.
git/
Switched to a new branch 'STABLE'
Branch STABLE set up to track remote branch STABLE from origin.
---------------------------------------------------------------
Setup /usr/local/nginx/conf/phpmyadmin.conf ...
---------------------------------------------------------------
---------------------------------------------------------------
Create phpmyadmin htaccess user/pass...
python /usr/local/nginx/conf/htpasswd.py -c -b /usr/local/nginx/conf/htpassphpmy
admin adminneIaPdhPpXo= KyJyzzGNJISyQxkMjgF6kZQa3bg=
---------------------------------------------------------------

\cp -af /usr/local/nginx/conf/php.conf /usr/local/nginx/conf/php_6936_mysqladmin
27567.conf
---------------------------------------------------------------
server {
#         listen   80;
            listen   80 default_server backlog=2048 reuseport;
            server_name lxd1;
            root   html;

        access_log              /var/log/nginx/localhost.access.log     main buf
fer=256k flush=5m;
        error_log               /var/log/nginx/localhost.error.log      error;

# ngx_pagespeed & ngx_pagespeed handler
#include /usr/local/nginx/conf/pagespeed.conf;
#include /usr/local/nginx/conf/pagespeedhandler.conf;
#include /usr/local/nginx/conf/pagespeedstatslog.conf;

# limit_conn limit_per_ip 16;
# ssi  on;

        location /nginx_status {
        stub_status on;
        access_log   off;
        allow 127.0.0.1;
        #allow youripaddress;
        deny all;
        }

            location / {

# block common exploits, sql injections etc
#include /usr/local/nginx/conf/block.conf;

#               Enables directory listings when index file not found
#               autoindex  on;

#               Shows file listing times as local time
#               autoindex_localtime on;

#               Enable for vBulletin usage WITHOUT vbSEO installed
#               try_files               $uri $uri/ /index.php;

            }

        # example nginx-http-concat
        # /csstest/??one.css,two.css
        #location /csstest {
        #concat on;
        #concat_max_files 20;
        #}

include /usr/local/nginx/conf/phpmyadmin.conf;
include /usr/local/nginx/conf/staticfiles.conf;
include /usr/local/nginx/conf/php.conf;
#include /usr/local/nginx/conf/phpstatus.conf;
include /usr/local/nginx/conf/drop.conf;
#include /usr/local/nginx/conf/errorpage.conf;
include /usr/local/nginx/conf/vts_mainserver.conf;

       }---------------------------------------------------------------
NON-STATIC IP configuration
---------------------------------------------------------------
cat /usr/local/nginx/conf/phpmyadmin.conf
---------------------------------------------------------------
location ^~ /6936_mysqladmin27567/ {
        rewrite ^/(.*) https://lxd1/$1 permanent;
}
---------------------------------------------------------------
cat /usr/local/nginx/conf/phpmyadmin_https.conf
---------------------------------------------------------------
location ^~ /6936_mysqladmin27567/ {
        #try_files $uri $uri/ /6936_mysqladmin27567/index.php?$args;
        include /usr/local/nginx/conf/php_6936_mysqladmin27567.conf;

        auth_basic      "Private Access";
        auth_basic_user_file  /usr/local/nginx/conf/htpassphpmyadmin;
        allow 127.0.0.1;
        #allow xx.xx.xx.xx;
        #deny all;
}
---------------------------------------------------------------

touch /usr/local/nginx/conf/phpfpmd/phpfpm_myadmin.conf


Dynamically set PHP memory_limit based on available system memory...

Total Mem: 2048 MB
Real Free Mem: 1730 MB
Mem Limit: 768 MB

-rw-rw-rw- 1 phpmyadmin nginx 0 Nov  8 03:05 /var/log/php_myadmin_error.log
-rw-rw-rw- 1 phpmyadmin nginx 0 Nov  8 03:05 /var/log/php-fpm/www-slowmyadmin.lo
g
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]
Gracefully shutting down php-fpm  done
Starting php-fpm  done
---------------------------------------------------------------
SSL Vhost Setup...
---------------------------------------------------------------

---------------------------------------------------------------
Generating self signed SSL certificate...
Just hit enter at each of the prompts
---------------------------------------------------------------

Generating RSA private key, 2048 bit long modulus
................................................................................
.................................+++
................................................................................
..................................................+++
e is 65537 (0x10001)
Signature ok
subject=/C=US/ST=California/L=Los Angeles/O=lxd1/OU=IT/CN=lxd1
Getting Private key
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]
Gracefully shutting down php-fpm  done
Starting php-fpm  done
---------------------------------------------------------------
Create update script:
/root/tools/phpmyadmin_update.sh
---------------------------------------------------------------
---------------------------------------------------------------
Create cronjob for auto updating phpmyadmin:
/root/tools/phpmyadmin_update.sh
---------------------------------------------------------------
0 */4 * * * /usr/bin/cminfo_updater
19 02 * * * /root/tools/phpmyadmin_update.sh
---------------------------------------------------------------
Create uninstall script:
/root/tools/phpmyadmin_uninstall.sh
---------------------------------------------------------------

---------------------------------------------------------------
Password protected 6936_mysqladmin27567
at path /usr/local/nginx/html/6936_mysqladmin27567
config.inc.php at: /usr/local/nginx/html/6936_mysqladmin27567/config.inc.php
  WEB url:

  https://lxd1/6936_mysqladmin27567

Login with your MySQL root username / password
---------------------------------------------------------------

phpmyadmin htaccess login details:
Username: adminneIaPdhPpXo=
Password: KyJyzzGNJISyQxkMjgF6kZQa3bg=
Allowed IP address: xx.xx.xx.xx

---------------------------------------------------------------
phpmyadmin update script at: /root/tools/phpmyadmin_update.sh
Add your own cron job to automatically run the update script i.e.

  15 01 * * * /root/tools/phpmyadmin_update.sh

---------------------------------------------------------------
phpmyadmin uninstall script at: /root/tools/phpmyadmin_uninstall.sh

  /root/tools/phpmyadmin_uninstall.sh

---------------------------------------------------------------
SSL vhost: /usr/local/nginx/conf/conf.d/phpmyadmin_ssl.conf
php-fpm includes: /usr/local/nginx/conf/php_6936_mysqladmin27567.conf
php-fpm pool conf: /usr/local/nginx/conf/phpfpmd/phpfpm_myadmin.conf
dedicated php-fpm pool user: phpmyadmin
dedicated php-fpm pool group: nginx
dedicated php error log: /var/log/php_myadmin_error.log
---------------------------------------------------------------
SSL vhost access log: /var/log/nginx/localhost_ssl.access.log
SSL vhost error log: /var/log/nginx/localhost_ssl.error.log
---------------------------------------------------------------

---------------------------------------------------------------
Total phpmyadmin Install Time: 106.577658367 seconds
phpmyadmin install log located at:
/root/centminlogs/centminmod_phpmyadmin_install_081115-030339.log
---------------------------------------------------------------

Now you can access phpmyadmin via address: https://tutorialspots.com/6936_mysqladmin27567/

Important note: you only access via server_name defined main hostname in virtual.conf and not via ip access

If you see error 404 not found, please check file /etc/csf/csf.conf

Must place port 9418 in TCP_IN, TCP_OUT (TCP6_IN and TCP6_OUT)

Reset phpmyadmin password:

cd /usr/local/src/centminmod/addons/
./phpmyadmin.sh resetpwd

centminmod reset password phpmyadmin

[root@tutorialspots ~]# cd /usr/local/src/centminmod/addons/
[root@tutorialspots addons]# ./phpmyadmin.sh resetpwd
---------------------------------------------------------------
---------------------------------------------------------------
Create phpmyadmin htaccess user/pass...
python /usr/local/nginx/conf/htpasswd.py -c -b /usr/local/nginx/conf/htpassphpmy
admin admingqrYzYyDCbA= gE7pRnQCJbvvMc/qyCOjNcThHGo=
---------------------------------------------------------------

phpmyadmin htaccess login details:
Username: admingqrYzYyDCbA=
Password: gE7pRnQCJbvvMc/qyCOjNcThHGo=
Allowed IP address: xx.xx.xx.xx

---------------------------------------------------------------

If you can’t login phpmyadmin, you can change the root password by using the command:

mysqladmin -u root password NEWPASS

Leave a Reply