Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 82

Server 觀念

&
Joomla 安裝初體驗
如何學 Unix ?
http://linux.vbird.org/linux_basic/0110whatislinux.php

• 計算機概論與硬體知識
• 網路基礎知識
• 安裝與指令
• 作業系統的基礎技能
• vi 文書編輯器
• Shell 與 Shell Script
• 軟體管理 ( 安裝 & 維護 )

09/19/2023 2
進度
• 計算機概論與硬體知識
• 網路基礎知識
• 安裝與指令
• 作業系統的基礎技能
• vi 文書編輯器
• Shell 與 Shell Script
• 軟體管理 ( 安裝 & 維護 )

09/19/2023 3
一些背景知識…

傳統三層網站架構
3-tier Architecture
3-tier Architecture 三層架構

上圖擷取自: http://blog.simcrest.com/what-is-3-tier-architecture-and-why-do-you-need-it/
名詞解釋 ( 硬體 )
• 伺服器 (Server) 是啥?
– 任何提供多人存取、分享資訊者,皆可稱之。
Our Servers?

朱門酒肉臭 路有凍死骨
但…
• 徒“硬體”不足以自行 …
– 仍需在硬體上安裝作業系統
• Windows, Unix, etc
– 以及,提供某種特定服務之軟體,例如:
• Web 伺服器
– 例如, Apache
• Database 伺服器
• FTP 伺服器
• SSH 伺服器
• etc
名詞解釋 ( 軟體 )
• 作業系統 (Operating System)
– Unix
• Linux
– Ubuntu Desktop, Ubuntu Server
• FreeBSD
– FreeBSD
– Windows
• XP, 7, 8, 10, 11
• 2008~20xx Server
– etc
Ubuntu
Ubuntu
Desktop or Server? X86 or
AMD64?
名詞解釋 ( 軟體 )
• 網頁伺服器 (Web Server)
– Apache
– Nginx
– IIS ( 微軟 )
• 資料庫管理系統 (Database Management
System)
– MySQL (My-S-Q-L) / MariaDB
– Oracle
– SQL server
Apache
3-tier Architecture
三層架構 ( 軟體的角度 )
大致對應

Users Users

程式 + 網 Joomla
頁 (to appear)

資料庫 MySQL
MariaDB

上圖擷取自: http://blog.simcrest.com/what-is-3-tier-architecture-and-why-do-you-need-it/
3-tier Architecture
三層架構 ( 硬體 & 平台的角度 )

Windows
+
Browser

Unix
+
Apache

Unix
+
MySQL
上圖擷取自: http://blog.simcrest.com/what-is-3-tier-architecture-and-why-do-you-need-it/ MariaDB
3-tier Architecture
三層架構 ( 硬體 & 平台的角度 )

Windows
+
Browser

Unix
+
Apache
+
MySQL/
MariaDB

上圖擷取自: http://blog.simcrest.com/what-is-3-tier-architecture-and-why-do-you-need-it/
3-tier Architecture
三層架構 ( 硬體 & 平台的角度 )
Windows
+
Browser

Unix 基本上,仍是三層架構,只是將應
+ 用程式 (Joomla) 與資料庫 (MySQL)
Apache
+ 放在同一個作業系統 (e.g., Unix) 平
MySQL/ 台上。
MariaDB
架站?
• 硬體平台
– 幾千 (budget NAS) ~ 幾萬 (PC) ~ 幾十萬
(or 更多 )
• 作業系統 NAS
Network Attached Storage
– Unix, Windows, or else
• 網頁伺服器
– Apache, nginx, IIS, or else
• 資料庫管理系統
– MariaDB, MySQL, SQL Server, or else
NAS (Synology)
NAS: Network Attached Storage
有種說法:私有雲 ( 類似 Dropbox)

NAS
NAS (QNAP)
NAS: Network Attached Storage
也可以自己安裝架設…
NAS (TrueNAS Core @ Home)
(FreeBSD)
NAS (TrueNAS Scale @
School)
(Linux)
NAS & 備份 / 娛樂 / 生產力
Dropbox
主要 Google
OneDrive

雙向 單向
家 學校
單向

TrueNAS

備份 (no Internet) TrueNAS


前述所有的 NAS 都是基於
Unix-based 的系統
開始安裝 Joomla
Our 平台
Virtual Machine
• 硬體 (PC)
• CPU: 8-core CPU
– CPU:• Intel
Memory: 16CPU
i5-10400 GB @ 2.90GHz (6 cores / 12
• HD: 32GB SSD / 512GB HD
threads)
– Memory: 32 GB
– HD: 480GB SSD / 4TB HD
• 作業系統
– Ubuntu 22.04-x 64- 位元 Server 版  需帳號 / 密碼
• 網頁伺服器 + 應用程式
– Apache 2.4.X + Joomla  後者安裝好後需帳號 / 密
碼管理
• 資料庫管理系統
– MariaDB 10.6.x  需帳號 / 密碼
下載最新版 Joomla
下載最新版 Joomla
• 最新版?
– 4.3.1 (midnight, 2023/05/04)
• https://downloads.joomla.org/
• the newest version recommended for most new
installs.
• It includes the latest and greatest features of
Joomla and mobile/responsive
– /home2/Joomla_4.3.1-Stable-Full_Package.zip
上傳 Joomla 程式
至本課程 “作業系統平台”
IP address: 120.107.152.251
連至課程作業系統
(Ubuntu 22.04 Server, 64-bit)
• SmarTTY
• Putty
$ mkdir www
$ cd www
$ cp /home2/Joomlaxxxx.zip .
$ unzip Joomla_4.3.1-Stable-Full_Package.zip
$ cd ..
$ sudo chown -R www-data www
$ sudo chgrp -R www-data www
資料庫設定

http://120.107.152.251/phpmyadmin/
登入 MySQL 資料庫
1. 輸入帳號 (root)
& 密碼 ( 上課給 )

2. 按“執行

Bingo …

MySQL 系統資料庫 (mysql)


( 與 MySQL 管理有關的設定
都在這裡面。 )
複習:一點點基礎背景知識 …
• 啥是資料庫管理系統?
• 啥是資料庫?
• 啥又是資料表?
• phpMyAdmin 又是啥?
一個簡化的 “資料庫” 應用示
意圖
使用者

提供使用者 Web 介面
phpMyAdmin 連接資料庫管理系統以
管理資料庫

資料庫管理系統 MySQL

資料庫 資料庫 ... 資料庫 邏輯上的資料庫


mysql tkwu-db etc-db

... 實體的資料庫
( 資料如何儲存在硬
碟之類的儲存體 )
啥是資料庫管理系統?
• 資料庫管理系統 (Database Management
System : DBMS )為管理資料庫而設計
的大型電腦軟體管理系統
– 具有代表性的資料管理系統有:
Oracle 、 Microsoft SQL Server 、 MySQL /
MariaDB 及 PostgreSQL 等
– 通常資料庫管理員會使用資料庫管理系統來建
立資料庫系統
MariaDB & MySQL
是資料庫管理系統
MySQL vs MariaDB
• MySQL
– 原開發者為瑞典的 MySQL AB 公司,該公司
於 2008 年被昇陽微系統 (Sun Microsystems)
收購
– 2009 年,甲骨文公司 (Oracle) 收購昇陽微系
統公司, MySQL 成為 Oracle 旗下產品

From: wiki)
MySQL vs MariaDB
• MariaDB
– 作者 Michael Widenius (Monty) 與部分
MySQL 開發團隊成員離開昇揚利用 MySQL
分支加上社群開發的功能推出 MariaDB
– Maria 為 Monty 最小的女兒的名稱,正如同
My 為 Monty 大女兒的名稱一樣的命名方式
– MariaDB 的 API 和協定相容 MySQL ,尤其
是 Client 與 Libaray 等可以共用相當方便

From: https://progressbar.tw/posts/273
MySQL vs MariaDB
phpMyAdmin 是啥?
• phpMyAdmin 是一套連結 MySQL 資料庫
管理系統的電腦程式,它提供比較 user-
friendly 的 Web 介面讓我們得以更方便地
管理資料庫
phpMyAdmin 畫面
phpMyAdmin 畫面

資料庫
( 系統 ) 資料庫
資料庫

點一下 mysql 即相當於前面文字介面的 “ use mysql” 指令


phpMyAdmin 畫面
啥是資料庫?

資料庫
( 系統 ) 資料庫
資料庫
注意大小寫喔 …

MySQL 指的是資料庫管理系統
mysql 指的是資料庫
我是資料庫
啥是資料表 (TABLE) ?
我是資料表
MySQL 系統資料庫 (mysql) 內容

• 資料表 (Table)
– columns_priv 、 db 、 event 、 func
、 general_log 、 help_category 、 hel
p_keyword 、 help_relation 、 help_to
pic 、 host 、 ndb_binlog_index 、 plu
gin 、 proc 、 procs_priv 、 proxies_pr
iv 、 servers 、 slow_log 、 tables_pri
v 、 time_zone 、 time_zone_leap_se
cond 、 time_zone_name 、 time_zon
e_transition 、 time_zone_transition_t
ype 、 user
啥是資料表?
(Back to) 資料庫設定

http://120.107.152.251/phpmyadmin/
mysql 資料庫中與 Joomla 安裝有
關的資料表
• user 資料表
• db 資料表
資料庫設定需做的事兒
1. 新增一個 “資料庫”,以儲存您的
Joomla 網站資料
2. 在 user 資料表中新增一位使用者帳號
( 就是您的 Joomla 程式存取上述資料庫
的帳號 )
3. 在 db 資料表中新增一筆資料,讓第二步
驟新增的“使用者”能夠對第一步驟新增
的“資料庫”為所欲為 ( 具有所有權限 )
登入 MySQL 資料庫 (again)
http://120.107.152.251/phpmyadmin/

1. 輸入帳號 (root)
& 密碼 ( 上課給 )

2. 按 “執行”
Bingo … (again)
Next … (the easy way)

請務必記得您建的
username & Password
記得重新載入權限
(like restart mariadb / mysql)
detailed steps …
(demo in class)
mysql DB

m0861001 DB
db table

user table
user table

db table
一個文字模式的資料庫使用例子 …
MySQL 的文字模式操作登入指令

選擇使用 mysql 資料庫

查詢 user 資料表
But …
use of phpMyAdmin in production may not be a
good idea
( 回顧 … ) Our 平台
Virtual Machine
• 硬體 (PC)
• CPU: 8-core CPU
• Intel
– CPU: Memory: 16CPU
i5-10400 GB @ 2.90GHz
• HD:
– Memory: 3232GB
GB SSD / 512GB HD
– HD: 480GB SSD / 4TB HD
• 作業系統
– Ubuntu 22.04-x 64- 位元 Server 版  需帳號 / 密碼
• 網頁伺服器 + 應用程式
– Apache 2.4.X + Joomla  後者安裝好後需帳號 / 密
碼管理
• 資料庫管理系統
– MariaDB 10.6.x  需帳號 / 密碼
關於資料庫設定 …

我們做了哪些事 ?
甚麼意思?
關於 Joomla 安裝 …

回顧一下,我們做了哪些事 ?
每個步驟又是甚麼意思?
開始安裝囉 …
http://120.107.152.251/~tkwu
tkwu 是啥?
( 回顧 … ) Our 平台
• 硬體 (PC)
– CPU: Intel i5-10400 CPU @ 2.90GHz
– Memory: 32 GB
– HD: 480GB SSD / 4TB HD
• 作業系統
– Ubuntu 20.04-x 64- 位元 Server 版  需帳號 / 密碼
• 網頁伺服器 + 應用程式
– Apache 2.4.X + Joomla  後者安裝好後需帳號 / 密
碼管理
• 資料庫管理系統
– MariaDB 10.3.x  需帳號 / 密碼
後續 …
• 找到你喜歡的 template, 安裝 , 使用
• 搜尋你喜歡的 Joomla 模組 (module), 安裝 , 使

• …
• Google is your friend …
3-tier Architecture
三層架構 ( 軟體 & 平台的角度 )
Windows response
+ Apache
Browser request (port #80) httpd.conf
http://tkwu.im.ncue.edu.tw Apache 設定檔

檔案系統
query
http://120...../~tkwu/
Unix outcome http://tkwu.im.ncue.edu.tw
+ ***.htm
Apache ***.php
/www/htdocs … /home/tkwu/www
+
MySQL
PHP 模組 ***.php

MySQL
https
• https://ui-code.com/archives/305
加密
• 對稱加密
• 非對稱加密
對稱加密
以凱撒密碼為例 (from wiki)

問題是:加密與解密兩方都需知道
字母右移 3 位這個關鍵 字母右移 3 位

如何分享這個祕密而不被第三者知道?
非對稱加密

私鑰會放在身上
公鑰在外流通或傳遞

公鑰做加密
私鑰做簽名
公鑰做加密
私鑰做簽名
使用非對稱加密來溝通對稱加密
的秘密

連線要求
問題是:你說你是
Youtube 公鑰
Youtube ,
你就是 Youtube ?
以公鑰加密我們的秘密
(Y0utube ? ) 我
Youtube.com
以私鑰解開秘密
簽證 Certificate

簽證單位
我是 Youtube ( 公證人 )

你的確是 Youtube
Youtube 公鑰 +

公證人以私鑰簽發的證書
Youtube.com 我
未加密、加密未簽證、加密簽證

You might also like