6 月 162015
 

C7-0615 CentOS 7.1下phpmyadmin 4.4.9安装配置

安装完默认无ifconfig命令需安装net-tools工具包,使用ifup启用接口
[root@localhost ~]# yum info net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: centos.ustc.edu.cn
Available Packages
Name : net-tools
Arch : x86_64
Version : 2.0
Release : 0.17.20131004git.el7
Size : 304 k
Repo : base/7/x86_64
Summary : Basic networking tools
URL : http://sourceforge.net/projects/net-tools/
License : GPLv2+
Description : The net-tools package contains basic networking tools,
: including ifconfig, netstat, route, and others.
: Most of them are obsolete. For replacement check iproute package.

[root@localhost ~]#

使用ip命令查看当前接口IP

[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:cf:24:88 brd ff:ff:ff:ff:ff:ff
inet 192.168.150.88/24 brd 192.168.150.255 scope global dynamic ens192
valid_lft 691183sec preferred_lft 691183sec
inet6 fe80::20c:29ff:fecf:2488/64 scope link
valid_lft forever preferred_lft forever
[root@localhost ~]#

网卡原始配置
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=ens192
UUID=8729d417-6b79-4076-a231-bd284ffd086f
DEVICE=ens192
ONBOOT=no
系统包最小化数量
[root@localhost ~]# rpm -qa | wc -l
289
[root@localhost ~]# cat /etc/redhat-release
Derived from Red Hat Enterprise Linux 7.1 (Source)
[root@localhost ~]#
更新升级数量(6月15日)
Install 1 Package
Upgrade 39 Packages

Total download size: 80 M

更新后系统包数量
[root@localhost ~]# rpm -qa |wc -l
291
[root@localhost ~]#

Selinux开关
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# vi /etc/sysconfig/selinux

防火墙默认未加载
[root@localhost ~]# systemctl status firewalld
firewalld.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

[root@localhost ~]#

安装防火墙
[root@localhost ~]# yum install firewalld
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
firewalld noarch 0.3.9-11.el7 base 465 k
Installing for dependencies:
ebtables x86_64 2.0.10-13.el7 base 122 k
libselinux-python x86_64 2.2.2-6.el7 base 247 k
python-slip noarch 0.4.0-2.el7 base 30 k
python-slip-dbus noarch 0.4.0-2.el7 base 31 k

Transaction Summary
================================================================================
Install 1 Package (+4 Dependent packages)

启用服务,查看状态,启动服务,查看规则
[root@localhost ~]# systemctl enable firewalld
[root@localhost ~]# systemctl status firewalld
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: inactive (dead)

[root@localhost ~]#
[root@localhost ~]# systemctl start firewalld
[root@localhost ~]# firewall-cmd –list-all
public (default)
interfaces:
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

[root@localhost ~]#

查看预定义防火墙服务
[root@localhost ~]# ls /usr/lib/firewalld/services/
amanda-client.xml ipp-client.xml mysql.xml RH-Satellite-6.xml
bacula-client.xml ipp.xml nfs.xml rpc-bind.xml
bacula.xml ipsec.xml ntp.xml samba-client.xml
dhcpv6-client.xml kerberos.xml openvpn.xml samba.xml
dhcpv6.xml kpasswd.xml pmcd.xml smtp.xml
dhcp.xml ldaps.xml pmproxy.xml ssh.xml
dns.xml ldap.xml pmwebapis.xml telnet.xml
ftp.xml libvirt-tls.xml pmwebapi.xml tftp-client.xml
high-availability.xml libvirt.xml pop3s.xml tftp.xml
https.xml mdns.xml postgresql.xml transmission-client.xml
http.xml mountd.xml proxy-dhcp.xml vnc-server.xml
imaps.xml ms-wbt.xml radius.xml wbem-https.xml
[root@localhost ~]#

查看预定义服务配置文件
[root@localhost ~]# cat /usr/lib/firewalld/services/https.xml
<?xml version=”1.0″ encoding=”utf-8″?>
<service>
<short>Secure WWW (HTTPS)</short>
<description>HTTPS is a modified HTTP used to serve Web pages when security is important. Examples are sites that require logins like stores or web mail. This option is not required for viewing pages locally or developing Web pages. You need the httpd package installed for this option to be useful.</description>
<port protocol=”tcp” port=”443″/>
</service>
[root@localhost ~]#

增加规则,重新加载配置,查看防火墙规则状态
[root@localhost ~]# firewall-cmd –permanent –add-service=http
success
[root@localhost ~]# firewall-cmd –reload
success
[root@localhost ~]# firewall-cmd –list-all
public (default)
interfaces:
sources:
services: dhcpv6-client http ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

[root@localhost ~]#
安装mariadb数据库服务
[root@localhost ~]# yum -y install mariadb mariadb-server

查看服务状态并启动服务
[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# systemctl status mariadb
mariadb.service – MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled)
Active: active (running) since Mon 2015-06-15 10:32:38 CST; 9s ago
Process: 12342 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 12262 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 12341 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─12341 /bin/sh /usr/bin/mysqld_safe –basedir=/usr
└─12498 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysq…

Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: The late…
Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: You can …
Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: http://d…
Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: Support …
Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: Corporat…
Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: Alternat…
Jun 15 10:32:35 localhost.localdomain mariadb-prepare-db-dir[12262]: http://m…
Jun 15 10:32:36 localhost.localdomain mysqld_safe[12341]: 150615 10:32:36 mys…
Jun 15 10:32:36 localhost.localdomain mysqld_safe[12341]: 150615 10:32:36 mys…
Jun 15 10:32:38 localhost.localdomain systemd[1]: Started MariaDB database se…
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#

登录数据库
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>
安装EPEL软件源
[root@localhost ~]# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

[root@localhost ~]# yum makecache
安装phpmyadmin,当前官网最新版本4.4.9,自动解决依赖软件包
================================================================================
Installing:
phpMyAdmin noarch 4.4.9-1.el7 epel 4.4 M
Installing for dependencies:
dejavu-fonts-common noarch 2.33-6.el7 base 64 k
dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M
fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k
gamin x86_64 0.1.10-16.el7 base 128 k
libX11 x86_64 1.6.0-2.1.el7 base 605 k
libX11-common noarch 1.6.0-2.1.el7 base 181 k
libXau x86_64 1.0.8-2.1.el7 base 29 k
libXpm x86_64 3.5.10-5.1.el7 base 52 k
libjpeg-turbo x86_64 1.2.90-5.el7 base 134 k
libmcrypt x86_64 2.5.8-13.el7 epel 99 k
libpng x86_64 2:1.5.13-5.el7 base 212 k
libtidy x86_64 0.99.0-31.20091203.el7 epel 132 k
libxcb x86_64 1.9-5.el7 base 169 k
libxslt x86_64 1.1.28-5.el7 base 242 k
libzip x86_64 0.10.1-8.el7 base 48 k
lighttpd x86_64 1.4.35-1.el7 epel 318 k
php-bcmath x86_64 5.4.16-23.el7_0.3 base 54 k
php-cli x86_64 5.4.16-23.el7_0.3 base 2.7 M
php-common x86_64 5.4.16-23.el7_0.3 base 561 k
php-gd x86_64 5.4.16-23.el7_0.3 base 124 k
php-mbstring x86_64 5.4.16-23.el7_0.3 base 501 k
php-mcrypt x86_64 5.4.16-3.el7 epel 20 k
php-mysql x86_64 5.4.16-23.el7_0.3 base 97 k
php-pdo x86_64 5.4.16-23.el7_0.3 base 95 k
php-php-gettext noarch 1.0.11-10.el7 epel 22 k
php-tcpdf noarch 6.2.8-1.el7 epel 2.1 M
php-tcpdf-dejavu-sans-fonts noarch 6.2.8-1.el7 epel 257 k
php-tidy x86_64 5.4.16-3.el7 epel 22 k
php-xml x86_64 5.4.16-23.el7_0.3 base 122 k
t1lib x86_64 5.1.2-14.el7 base 166 k

Transaction Summary
================================================================================
Install 1 Package (+30 Dependent packages)

Total download size: 15 M

[root@iZ94l01jktpZ ~]# yum install phpmyadmin

安装PHP及Apache服务(调整,先安装此步骤)

[root@localhost ~]# yum install php

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php x86_64 5.4.16-23.el7_0.3 base 1.3 M
Installing for dependencies:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd x86_64 2.4.6-31.el7.centos base 2.7 M
httpd-tools x86_64 2.4.6-31.el7.centos base 79 k
mailcap noarch 2.1.41-2.el7 base 31 k

Transaction Summary
================================================================================
Install 1 Package (+5 Dependent packages)

Total download size: 4.3 M
修改配置文件,默认仅允许本地访问
[root@localhost ~]# cd /etc/httpd/conf.d/

部分原始配置
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
修改Apache配置文件(主机名,索引文件),查看状态并启用服务
[root@localhost conf]# apachectl -t
Syntax OK
[root@localhost conf]# systemctl status httpd
httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: inactive (dead)

[root@localhost conf]# systemctl start httpd
[root@localhost conf]# systemctl status httpd
httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: active (running) since Mon 2015-06-15 11:10:09 CST; 7s ago
Main PID: 12763 (httpd)
Status: “Processing requests…”
CGroup: /system.slice/httpd.service
├─12763 /usr/sbin/httpd -DFOREGROUND
├─12765 /usr/sbin/httpd -DFOREGROUND
├─12766 /usr/sbin/httpd -DFOREGROUND
├─12767 /usr/sbin/httpd -DFOREGROUND
├─12768 /usr/sbin/httpd -DFOREGROUND
└─12769 /usr/sbin/httpd -DFOREGROUND

Jun 15 11:10:09 localhost.localdomain systemd[1]: Starting The Apache HTTP Server…
Jun 15 11:10:09 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
[root@localhost conf]#
修改PMA配置文件
[root@localhost phpMyAdmin]# pwd
/usr/share/phpMyAdmin
手动创建文件并增加配置
[root@localhost phpMyAdmin]# vi config.inc.php
<?php
$cfg[‘blowfish_secret’] = ‘ba17c1ec07d65003ieos83lsh3276dshe63’; // use here a value of your choice

$i=0;
$i++;
$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
?>

登录提示信息(配置phpmyadmin配置存储)

The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why.
Or alternately go to ‘Operations’ tab of any database to set it up there.

The configuration file now needs a secret passphrase (blowfish_secret).
导入管理数据库
[root@localhost sql]# pwd
/usr/share/phpMyAdmin/sql
[root@localhost sql]# mysql -u root -pmysqlpass < create_tables.sql

设置管理用户并授权

MariaDB [(none)]> use phpmyadmin;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [phpmyadmin]> GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO ‘pma’@’localhost’ IDENTIFIED BY ‘pmapass’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [phpmyadmin]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

修改配置文件
$cfg[‘blowfish_secret’] = ‘123456’;

$cfg[‘Servers’][$i][‘controluser’] = ‘pma’;
$cfg[‘Servers’][$i][‘controlpass’] = ‘pmapass’;

正确设置后,不在提示The phpMyAdmin configuration storage is not completely configured