通过yum安装phpMyAdmin及配置过程

时间:2021-12-26 20:24:10

【转】通过yum安装phpMyAdmin及配置过程

1. 安装mysql + php环境。

2. 安装phpMyAdmin

yum -y install phpMyAdmin

安装完成后如下配置:

配置文件在/usr/share/phpMyAdmin下,进入libraries目录
a. 修改/etc/phpMyAdmin/config.inc.php,,修改前应先备份一下

['host']='localhost';    //除非数据库不在本机,此处不要更改
['port']='';默认为3306
['auth_type']='config' 
['user']='YOUR_USER_NAME'
['password']='YOUR_PASSWORD'    //注意这里的user和password仅用于auth_type=config的情况下,
密码不要为空
['blowfish_secret']='php' cookie认证字符,可为任意,注意要不为空才行的

b. 修改/etc/httpd/conf.d/phpmyadmin.conf
本文件是phpmyadmin的访问控制文件,保证远程访问。如下修改即可:

<Directory /usr/share/phpMyAdmin/>

   Order Deny,Allow

   Deny  from All

   Allow from 127.0.0.1

   Allow from ipaddress

</Directory>



测试:
http://IP/phpMyAdmin/

c. 如果安装php时没有安装php-mcrypt包,可能会出现错误提示,这时只需将其安装:
yum -y install php-mcrypt

遇到 安装phpmyadmin报错No package phpmyadmin available.时,按如下方案解决:

安装nginx报错No package nginx available

问题:安装nginx,报错如下

yum -y install nginx

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.ustc.edu.cn
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: data.nicehosting.co.kr
Setting up Install Process
No package nginx available.
Nothing to do

原因:EPEL未被启动,且指示的 rpm包不可用

解决方法:1.首先检查系统是否安装epel-release:

[root@flc ~]# rpm -q epel-release
package epel-release is not installed

2.如果没有安装,则install:

[root@flc ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

注意:

32位:http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-6.noarch.rpm

64位:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-6.noarch.rpm

#安装成功

[root@flc ~]# rpm -q epel-release
epel-release-6-8.noarch   

#查看其所依附的软件文件
[root@flc ~]# rpm -qR epel-release  
/bin/sh 

/bin/sh 

config(epel-release) = 6-8

redhat-release >= 6

rpmlib(CompressedFileNames) <= 3.0.4-1

rpmlib(FileDigests) <= 4.6.0-1

rpmlib(PayloadFilesHavePrefix) <= 4.0-1

rpmlib(PayloadIsXz) <= 5.2-1

3导入key:

[root@flc ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

别忘了安装yum-priorities

[root@flc ~]#yum install yum-priorities

[root@flc ~]#cd /etc/yum.repos.d

[root@localhost yum.repos.d]# ls |grep epel

epel.repo

epel-testing.repo


然后安装nginx,即不报错:

[root@wmct-server yum.repos.d]# yum install nginx