iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 18
0
自我挑戰組

30天學 LAMP 安裝系列 第 18

Day18 CentOS 7 安裝 phpMyAdmin

  • 分享至 

  • xImage
  •  

前言

這幾天收到朋友的許願,希望能夠看到 phpMyAdmin 的安裝。其實 phpMyAdmin 不難,只是它並未收錄在 CentOS 內建的軟體庫,但只要 Extra Packages for Enterprise Linux (EPEL) 軟體庫有裝並且啟用,就可以用 yum 安裝了。(參考資料:https://docs.phpmyadmin.net/en/latest/setup.html#linux-distributions )

另外,先前使用 CentOS 的 Yum 源安裝 MariaDB,版本是 5.5.X,對照 MariaDB 網站,發現雖然都是穩定版本,但覺得版本有點舊,官方版本都已經來到 10.4 了(參考資料:https://downloads.mariadb.org/mariadb/+releases/ )。因此決定使用 MariaDB 官方的 Yum 源,再寫一篇。

因為 phpMyAdmin 是 Web 畫面,因此此次以 CentOS 7 的圖形模式下做操作。

步驟

跑更新並且安裝小工具

$ sudo yum update -y
$ sudo yum install bash-completion net-tools yum-utils epel-release vim wget policycoreutils-python -y

安裝 MariaDB

$ sudo curl -sS <https://downloads.mariadb.com/MariaDB/mariadb_repo_setup> | sudo bash
$ cat /etc/yum.repos.d/mariadb.repo
[mariadb-main]
name = MariaDB Server
baseurl = <https://downloads.mariadb.com/MariaDB/mariadb-10.4/yum/rhel/$releasever/$basearch>
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY
gpgcheck = 1
enabled = 1

[mariadb-maxscale]
# To use the latest stable release of MaxScale, use "latest" as the version
# To use the latest beta (or stable if no current beta) release of MaxScale, use "beta" as the version
name = MariaDB MaxScale
baseurl = <https://downloads.mariadb.com/MaxScale/2.3/centos/$releasever/$basearch>
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-MaxScale-GPG-KEY
gpgcheck = 1
enabled = 1

[mariadb-tools]
name = MariaDB Tools
baseurl = <https://downloads.mariadb.com/Tools/rhel/$releasever/$basearch>
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Enterprise-GPG-KEY
gpgcheck = 1
enabled = 1

$ sudo yum-config-manager --enable mariadb
$ sudo yum --enablerepo=mariadb-main install mariadb-server MariaDB-client -y
$ mysql -V
mysql  Ver 15.1 Distrib 10.4.8-MariaDB, for Linux (x86_64) using readline 5.1
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.4.8 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Sat 2019-09-21 16:57:17 CST; 47s ago
     Docs: man:mysqld(8)
           <https://mariadb.com/kb/en/library/systemd/>
 Main PID: 104997 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─104997 /usr/sbin/mysqld

Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] InnoDB: 10.4.8 started; log sequence number 139827; transaction id 21
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] InnoDB: Buffer pool(s) load completed at 190921 16:57:17
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] Plugin 'FEEDBACK' is disabled.
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] Server socket created on IP: '::'.
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] Reading of all Master_info entries succeeded
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] Added new Master_info '' to hash table
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: 2019-09-21 16:57:17 0 [Note] /usr/sbin/mysqld: ready for connections.
Sep 21 16:57:17 centos7-gui.lab.example.com mysqld[104997]: Version: '10.4.8-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Sep 21 16:57:17 centos7-gui.lab.example.com systemd[1]: Started MariaDB 10.4.8 database server.

$ sudo mysql_secure_installation

安裝 Apache

$ sudo yum install httpd -y
$ sudo systemctl start httpd
$ sudo systemctl enable httpd
$ sudo systemctl status httpd
$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --reload

安裝 PHP

$ sudo yum localinstall <http://rpms.remirepo.net/enterprise/remi-release-7.rpm> -y
$ sudo yum-config-manager --enable remi-php73
$ sudo yum --enablerepo=remi-php73 install php php-mysqlnd -y

安裝 phpMyAdmin

$ sudo yum install phpmyadmin -y
$ sudo systemctl restart httpd

登入 CentOS GUI Console,開啟 Firefox 瀏覽器,網址列輸入 http://localhost/phpmyadmin

https://ithelp.ithome.com.tw/upload/images/20190921/20119707s8FgLdrfDr.png

語言可切換為中文 Chinese Traditional

https://ithelp.ithome.com.tw/upload/images/20190921/20119707oyVGN2Tbfk.png

使用者名稱先輸入 root(此為 MuSQL 資料庫的 root 帳號,而不是作業系統的 root 帳號),再輸入 root 的密碼,即可登入。

https://ithelp.ithome.com.tw/upload/images/20190921/20119707oh68GhaJqD.png

參考資料

  1. https://downloads.mariadb.org/mariadb/repositories/#distro=CentOS&distro_release=centos7-amd64--centos7&mirror=hostag&version=10.4
  2. https://mariadb.com/kb/en/library/yum/
  3. https://docs.phpmyadmin.net/en/latest/setup.html#linux-distributions

上一篇
Day17 安裝 Laravel
下一篇
Day19 以 DVD 進行 RHEL 8 圖形模式的基本安裝
系列文
30天學 LAMP 安裝33
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言