antony@notes:~/suse$ cat "SUSE-Linux-的-study.md"
SUSE Linux 的 study
SUSE Linux 的 study
[TOC]
1. Linux OS上 patch 的方式與步驟
1. 使用 diff 創建 patch 文件
建立一個名為 hello.c 的檔案
int main() {
printf("Hello World\n");
}將 hello.c 複製到 hello_new.c
$ cp hello.c hello_new.c編輯 hello_new.c 進行更改:
int main(int argc, char *argv[]) {
printf("Hello World\n");
return 0;
}使用 diff 命令創建 patch 文件
$ diff -u hello.c hello_new.c > hello.patch上面的命令將創建一個名為“hello.patch”的 patch 文件。
--- hello.c 2023-03-09 07:30:49.853904428 +0800
+++ hello_new.c 2023-03-09 07:32:20.101907319 +0800
@@ -1,3 +1,4 @@
-int main() {
-printf("Hello World\n");
+int main(int argc, char *argv[]) {
+printf("Hello World\n");
+return 0;
}2.使用 patch 命令應用 patch 文件
patch命令將 patch 文件作為輸入並將差異應用到一個或多個原始文件,從而生成補丁版本。
patch -p[num] < patchfile
patch [options] originalfile 補丁文件使用如下所示的 patch 命令將 hello.patch 應用於原始 hello.c 源代碼。
$ patch < hello.patchpatch 文件 hello.c
hello.patch 文件包含要修補的文件的名稱。一旦文件被修補,hello.c 和 hello_new.c 都會有內容。
[註] 參考文章 : 7 Patch Command Examples to Apply Diff Patch Files in Linux
2. Linux OS 是否要上 patch ? why ?
要上 patch,patch 可以修復程式碼的錯誤,改進現有功能的性能,或在 Application 中添加新功能。
3. Linux OS 的 file system 的規劃
我會先根據使用者的需求切足夠大的 partition 讓使用者使用,在持續調整 partition 的大小,如果該顆硬碟不夠,將使用新的硬碟透過 LVM 掛載到他的目錄
4. Linux OS 的 DNS 設定
Install DNS
~> sudo zypper in -t pattern dhcp_dns_serverinstall, in,Install packages.-t, --type <TYPE>,Type of package (package, patch, pattern, product).- pattern means
a group of software packages.
- pattern means
假設要將 rancher.example.com 解析為 192.168.0.32
DNS Server 的 IP 為 192.168.0.31
- 先新增一個 DNS 的 Zone :
example.com - 再新增一個 NS Records :
rancher.lab.- 代表這台 DNS Server 會負責管理 rancher 開頭的網域,當其他機器要打
rancher.example.com時,會來找到這台 DNS Server
- 代表這台 DNS Server 會負責管理 rancher 開頭的網域,當其他機器要打
- 最後新增 A Record :
Record Key: rancherValue: 192.168.0.32- 解釋 :
- A Record 的 A 全名是 Address ,意思是將網域名稱對應到指定伺服器的 IP 位址
- A Record 指向 IPv4位址,AAAA Record 指向 IPv6 位址。
- 在其他主機中的
/etc/resolv.conf檔案中新增nameserver 192.168.0.31,再執行host rancher.example.com就可以成功解析出rancher.example.com has address 192.168.0.32