Red Hat Enterprise Linux 7.x 訂閱

參考 免費下載官方 Red Hat Enterprise Linux(RHEL)企業級版本 – G. T. Wang企業級 Red Hat Enterprise Linux(RHEL)安裝教學 – G. T. Wang,下載了 Red Hat Enterprise Linux 7.2 版來試用了一下。

不過,是安裝成文字的 Server 模式,所以無法使用圖形化的 GUI 介面進行訂閱[@more@]

底下文章參考 How to Register and Enable Red Hat Subscription, Repositories and Updates for RHEL 7.0 Server 完成

Step 1: Register and Active Red Hat Subscription
# subscription-manager register –username your’username –password your’password
Registering to: subscription.rhn.redhat.com:443/subscription
The system has been registered with ID: 0xxxxxxx-xxxx-4xxx-bxxx-cbcxxxxxxxx3

Step 2: Get a list of all your available subscriptions
# subscription-manager list –available
+——————————————-+
    Available Subscriptions
+——————————————-+
Subscription Name:   Red Hat Enterprise Linux Developer Suite
Provides:            Red Hat Software Collections (for RHEL Server)
                     Red Hat Container Development Kit
                     MRG Realtime
                     Red Hat EUCJP Support (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux Server – Extended Update Support
                     Red Hat Beta
                     Oracle Java (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux High Performance Networking (for RHEL Compute Node)
                     Red Hat Enterprise Linux High Performance Networking (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux Resilient Storage (for RHEL Server)
                     Oracle Java (for RHEL Server)
                     Red Hat Container Images
                     Red Hat Enterprise Linux for Real Time
                     Red Hat Enterprise Linux Atomic Host
                     Red Hat S-JIS Support (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux Scalable File System (for RHEL Server)
                     Red Hat Enterprise Linux Resilient Storage (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux Atomic Host Beta
                     Red Hat Enterprise Linux High Availability (for RHEL Server) – Extended Update Support
                     Red Hat Container Images Beta
                     Red Hat Enterprise Linux Scalable File System (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux Load Balancer (for RHEL Server) – Extended Update Support
                     Red Hat Enterprise Linux High Availability (for RHEL Server)
                     Red Hat Enterprise Linux Server
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat Enterprise Linux Load Balancer (for RHEL Server)
                     Red Hat Enterprise Linux High Performance Networking (for RHEL Server)
                     Red Hat Developer Toolset (for RHEL Server)
SKU:                 RH2262474
Contract:            10923254
Pool ID:             8xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2
Provides Management: Yes
Available:           1
Suggested:           1
Service Level:       Self-Support
Service Type:        L1-L3
Subscription Type:   Standard
Ends:                04/02/2017
System Type:         Physical

Step 3: Active it a subscription use the Subscription Pool ID
# subscription-manager subscribe –pool=8xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2
Successfully attached a subscription for: Red Hat Enterprise Linux Developer Suite

Step 4: Check your enabled subscriptions
# subscription-manager list

+——————————————-+
    Installed Product Status
+——————————————-+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.2
Arch:           x86_64
Status:         Subscribed
Status Details:
Starts:         04/02/2016
Ends:           04/02/2017

Step 5: Install or Update Packages
# yum install net-tools
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-server-eus-rpms                                                                                                                                  | 3.2 kB  00:00:00
rhel-7-server-rpms                                                                                                                                      | 3.7 kB  00:00:00
rhel-7-server-rt-beta-rpms                                                                                                                              | 3.8 kB  00:00:00
rhel-7-server-rt-rpms                                                                                                                                   | 4.0 kB  00:00:00
rhel-ha-for-rhel-7-server-eus-rpms                                                                                                                      | 3.1 kB  00:00:00
rhel-ha-for-rhel-7-server-rpms                                                                                                                          | 3.7 kB  00:00:00
rhel-rs-for-rhel-7-server-eus-rpms                                                                                                                      | 3.1 kB  00:00:00
rhel-rs-for-rhel-7-server-rpms                                                                                                                          | 3.7 kB  00:00:00
(1/12): rhel-7-server-rt-beta-rpms/x86_64/group                                                                                                         |  130 B  00:00:02
(2/12): rhel-7-server-rt-beta-rpms/x86_64/updateinfo                                                                                                    |  238 B  00:00:02
(3/12): rhel-7-server-rt-rpms/7Server/x86_64/group                                                                                                      |  895 B  00:00:01
(4/12): rhel-7-server-rt-beta-rpms/x86_64/primary_db                                                                                                    |  13 kB  00:00:01
(5/12): rhel-7-server-rt-rpms/7Server/x86_64/updateinfo                                                                                                 |  23 kB  00:00:01
(6/12): rhel-7-server-rt-rpms/7Server/x86_64/primary_db                                                                                                 |  43 kB  00:00:02
(7/12): rhel-ha-for-rhel-7-server-eus-rpms/7Server/x86_64/primary_db                                                                                    | 129 kB  00:00:01
(8/12): rhel-ha-for-rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                        | 129 kB  00:00:01
(9/12): rhel-rs-for-rhel-7-server-eus-rpms/7Server/x86_64/primary_db                                                                                    | 151 kB  00:00:01
(10/12): rhel-rs-for-rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                       | 151 kB  00:00:01
(11/12): rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                                   |  20 MB  00:01:51
(12/12): rhel-7-server-eus-rpms/7Server/x86_64/primary_db                                                                                               |  20 MB  00:02:03
(1/9): rhel-ha-for-rhel-7-server-rpms/7Server/x86_64/group_gz                                                                                           | 3.4 kB  00:00:01
(2/9): rhel-ha-for-rhel-7-server-eus-rpms/7Server/x86_64/updateinfo                                                                                     | 5.7 kB  00:00:01
(3/9): rhel-7-server-rpms/7Server/x86_64/group_gz                                                                                                       | 134 kB  00:00:01
(4/9): rhel-rs-for-rhel-7-server-eus-rpms/7Server/x86_64/updateinfo                                                                                     | 8.4 kB  00:00:00
(5/9): rhel-ha-for-rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                         |  37 kB  00:00:00
(6/9): rhel-rs-for-rhel-7-server-rpms/7Server/x86_64/group_gz                                                                                           | 4.9 kB  00:00:00
(7/9): rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                                     | 1.1 MB  00:00:02
(8/9): rhel-7-server-eus-rpms/7Server/x86_64/updateinfo                                                                                                 | 108 kB  00:00:02
(9/9): rhel-rs-for-rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                         |  49 kB  00:00:00
Resolving Dependencies
–> Running transaction check
—> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
–> Finished Dependency Resolution

客製化 CentOS 6.7 x86_64 LEMP Server 安裝光碟

閒暇時做的,主要是改安裝 Nginx Web Server + MariaDB SQL Server + PHP,並參考 將 CentOS 6、CentOS 7 的核心升級至 Linux 4.x | iLog,把核心升級到 4.x
已經取消 倒數計時

[@more@]安裝完成

CentOS 6.x 目前系統核心
# uname -a
Linux localhost.localdomain 2.6.32-573.18.1.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

CentOS 6.x 更新完後系統核心
# uname -a
Linux localhost.localdomain 4.5.0-1.el6.elrepo.x86_64 #1 SMP Mon Mar 14 12:11:26 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

這個版本的特點:
1. 安裝只要二步驟:設定 root 管理者密碼分割硬碟
2. 套件更新到 2016-03-22
3. 套件更新伺服器改成 頭城國小
4. 預設啟動 LEMP (Linux + Nginx + MariaDBSQL + PHP)
5. MariaDBSQL Server 修改成 UTF-8 的使用環境
6. PHP 部分的設定,僅列出部份的修改
    時區改成 Asia/Taipei
    upload_max_filesize = 500M
    post_max_size = 500M
7. 每天早上 6 點向 time.stdtime.gov.tw 對時
8. 個人使用環境的設定…..等等

客製化 CentOS 7.2-1511 x86_64 LEMP Server 安裝光碟

參考 [CentOS 7] 整合 Nginx、MariaDB、PHP 7 組成 LEMP Server ~ IT 技術家,整合完成 Nginx+MariaDB+PHP Server 安裝光碟。
光碟開機畫面,預設取消倒數

預設只要三個步驟:分割硬碟、設定網路、設定 root 密碼。
客製化內容:
1. 預設安裝 Nginx Web Server / PHP / MariaDB SQL Server,並啟動 Nginx Web Server 及 MariaDB SQL Server
2. 新增一些 Nginx Web Server 與 PHP 的連結設定
3. 修改 php 設定,包含:上傳的檔案大小到 200M,時區改成 Asis/Taipei……等等。
4. 套件更新到 2016-01-18
5. 套件更新伺服器改成頭城國小
6. 每天早上 6 點對時

CentOS 6.x 套件自動更新

1. 安裝 yum-cron 套件
# yum install yum-cron

2. 備份設定檔 /etc/sysconfig/yum-cron
# cp /etc/sysconfig/yum-cron /etc/sysconfig/yum-cron.$(date +%F)

3. 修改設定檔 /etc/sysconfig/yum-cron
# sed -i “s|^MAILTO=|MAILTO= your@email.com|” /etc/sysconfig/yum-cron
# sed -i “s|^CHECK_ONLY=no|CHECK_ONLY=yes|” /etc/sysconfig/yum-cron[@more@]4. 設定開機時啟動
# chkconfig –level 35 yum-cron on

5. 啟動 yum-cron 服務
# service yum-cron start
正在啟用每晚的 yum 更新:                                  [  確定  ]

CentOS 7.x 套件自動更新

一般來說,個人比較不建議讓系統自動更新,因為在第一時間做套件更新,有時候會發生難以復原的災難,所以一般我的做法是讓系統去檢查是否有套件要做更新,如果有的話,利用 mail 通知,再由管理者決定是否要立即做更新。

1. 安裝 yum-cron 套件
# yum install yum-cron

2. 備份設定檔
# cp /etc/yum/yum-cron.conf /etc/yum/yum-cron.conf.$(date +%F)
# cp /etc/yum/yum-cron-hourly.conf /etc/yum/yum-cron-hourly.conf.$(date +%F)[@more@]3. 設定 mail 通知的對象
# sed -i “s|^email_to = root|email_to = your@email.com|” /etc/yum/yum-cron.conf

4. /etc/yum/yum-cron.conf 的其它設定
有下載或更新套件時通知管理者
# sed -i ‘s|^update_messages = no|update_messages = yes|’ /etc/yum/yum-cron.conf
是否自動下載套件的更新檔(個人設定 no)
# sed -i ‘s|^download_updates = no|download_updates = yes|’ /etc/yum/yum-cron.conf
是否自動安裝套件的更新檔(個人設定 no)
# sed -i ‘s|^apply_updates = no|apply_updates = yes|’ /etc/yum/yum-cron.conf
利用 email 通知管理者
# sed -i ‘s|^emit_via = stdio|emit_via = email|’ /etc/yum/yum-cron.conf

5. /etc/yum/yum-cron-hourly.conf 的設定
# sed -i “s|^email_to = root|email_to = your@email.com|” /etc/yum/yum-cron-hourly.conf
設定更新的類別
# sed -i ‘s|^update_cmd = default|update_cmd = security|’ /etc/yum/yum-cron-hourly.conf
# sed -i ‘s|^update_messages = no|update_messages = yes|’ /etc/yum/yum-cron-hourly.conf
# sed -i ‘s|^emit_via = stdio|emit_via = email|’ /etc/yum/yum-cron-hourly.conf

6. 重新啟動 yum-cron 服務
# systemctl restart yum-cron.service 

客製化 CentOS 7.2-1511 x86 Server 安裝光碟

順手完成 CentOS 7.2-1511 x86 Server 安裝光碟
取消時間倒數,預設為 Install CentOS 7

預設只要三個步驟:分割硬碟、設定網路、設定 root 密碼。
客製化內容:
1. 預設安裝 Apache Web Server / PHP / MariaDB SQL Server,並啟動 Apache Web Server 及 MariaDB SQL Server
2. 新增一些 Apache Web Server 的安全性設定
3. MariaDB MySQL Server 修改成 UTF-8 的使用環境
4. 修改 php 設定,包含:上傳的檔案大小到 200M,時區改成 Asis/Taipei……等等。
5. 套件更新到 2016_01_01
6. 每天早上 6 點對時

客製化 CentOS 7.2-1511 x86_64 Server 安裝光碟

本來一直很抗拒升級或是安裝 CentOS 7.x,因為覺得 CentOS 7.x 和之前的 CentOS 6.x 相差很多,在 CentOS 6.x 支援期還很久的情況下,實在沒有什麼動力去仔細研究 CentOS 7.x,不過最近因為一直在使用 Arch Linux 和 Debian 8,所以慢慢習慣了 CentOS 7.x  中的  systemctl 指令,唯一感覺還不太習慣的是 FirewallD 設定防火牆的部分。

光碟開機畫面,預設取消倒數
[@more@]安裝畫面

分割硬碟

設定網路

開始安裝

設定 root 密碼

完成安裝

預設只要三個步驟:分割硬碟、設定網路、設定 root 密碼。
客製化內容:
1. 預設安裝 Apache Web Server / PHP / MariaDB SQL Server,並啟動 Apache Web Server 及 MariaDB SQL Server
2. 新增一些 Apache Web Server 的安全性設定
3. MariaDB MySQL Server 修改成 UTF-8 的使用環境
4. 修改 php 設定,包含:上傳的檔案大小到 200M,時區改成 Asis/Taipei……等等。
5. 套件更新到 2015_12_29
6. 套件更新伺服器改成臺灣
7. 每天早上 6 點對時

客製化 CentOS 6.7 x86_64 Server 光碟

因為試裝了 CentOS 6.7 x86_64 光碟,也因為最近學校有些 Server,要重新安裝系統,所以就自行製作了這一片安裝 Server 的光碟。
安裝 CentOS 6.7 x86_64 Server 只要二步驟:設定 root 管理者密碼分割硬碟

已經取消倒數計時
[@more@]設定 root 管理者密碼

分割硬碟

不用挑選要安裝的套件,逕行安裝

安裝開機管理程式

安裝後的設定

這個版本的特點:
1. 套件更新到 2015-08-08
2. 套件更新伺服器改成臺灣
3. 預設啟動 LAMP (Linux + Apache + MySQL + PHP) / vsFTP Server
4. Apache Web Server 增加一些安全性上的設定
    ServerTokens Prod
    ServerSignature Off
5. MySQL Server 修改成 UTF-8 的使用環境
6. PHP 部分的設定,僅列出部份的修改
    時區改成 Asia/Taipei
    upload_max_filesize = 500M
    post_max_size = 500M
7. 修改 SELinux 讓 vsFTP Server 能正常使用(SELINUX=enforcing)
8. 每天早上 6 點向 time.stdtime.gov.tw 對時
9. 個人使用環境的設定…..等等

使用 GRUB2 掛載 Linux ISO 來執行

因為在電腦教室常常會利用 Clonezilla / DRBL Live 來備份及還原電腦,雖然已經將 Clonezilla / DRBL Live 利用 grub4dos,製作成開機隨身碟,但隨身碟也不是都會放在身上,最好的方式就是直接放在本機上,所以利用 Linux 本身的 GRUB2 掛載 ISO 檔來啟動  Clonezilla / DRBL Live。
參考網站:
Grub2 設定以 Linux LiveCD 的 ISO 檔啟動系統 – 石頭閒語 – 樂多日誌

1. 首先下載 Clonezilla / DRBL Live(有時最新版本不一定能正確執行),這裡是放置在第一顆硬碟的第一個分割區/home/test 目錄
$ wget http://jaist.dl.sourceforge.net/project/clonezilla/clonezilla_live_alternative/20150217-utopic/clonezilla-live-20150217-utopic-i386.iso -P /home/test
$ wget http://downloads.sourceforge.net/project/drbl/drbl_live_stable/2.3.1-6/drbl-live-xfce-2.3.1-6-i686-pae.iso -P /home/test[@more@]2. 修改設定檔 /etc/grub.d/40_custom
$ sudo vim /etc/grub.d/40_custom
加入下面選項
insmod loopback

menuentry “CloneZilla live 20150217-utopic” {
    set isofile=”/home/test/clonezilla-live-20150217-utopic-i386.iso”
    loopback loop (hd0,1)$isofile
    linux (loop)/live/vmlinuz boot=live config locales=”zh_TW.UTF-8″ keyboard-layouts=”NONE” noswap noprompt nosplash vga=788 ip=frommedia findiso=$isofile
    initrd (loop)/live/initrd.img
}

menuentry “DRBL live XFCE 2.3.1-6-i686-pae” {
    set isofile=”/home/test/drbl-live-xfce-2.3.1-6-i686-pae.iso”
    loopback loop (hd0,1)$isofile
    linux (loop)/live/vmlinuz boot=live username=user config quiet nomdoeset locales=”zh_TW.UTF-8″ keyboard-layouts=”NONE” noswap noprompt nosplash vga=791 ip=frommedia findiso=$isofile
    initrd (loop)/live/initrd.img
}

3. 修改 /etc/default/grub
把 GRUB_HIDDEN_TIMEOUT 和 GRUB_HIDDEN_TIMEOUT_QUIET 這二行前面加上 # 註解
$ cp /etc/default/grub ~/grub.default
$ sudo sed -i ‘s/^GRUB_HIDDEN_TIMEOUT/#GRUB_HIDDEN_TIMEOUT/’ /etc/default/grub
$ sudo sed -i ‘s/^GRUB_HIDDEN_TIMEOUT_QUIET/#GRUB_HIDDEN_TIMEOUT_QUIET/’ /etc/default/grub

4. 更新 GRUB2
$ sudo update-grub
正在產生 grub 設定檔 …
找到 linux 映像檔:/boot/vmlinuz-3.13.0-32-generic
找到 initrd 映像檔:/boot/initrd.img-3.13.0-32-generic
找到 linux 映像檔:/boot/vmlinuz-3.13.0-24-generic
找到 initrd 映像檔:/boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
完成
$ sudo update-grub2
正在產生 grub 設定檔 …
找到 linux 映像檔:/boot/vmlinuz-3.13.0-32-generic
找到 initrd 映像檔:/boot/initrd.img-3.13.0-32-generic
找到 linux 映像檔:/boot/vmlinuz-3.13.0-24-generic
找到 initrd 映像檔:/boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
完成

5. Ubuntu 開機出現的功能表

Ubuntu MATE 開機出現的功能表

6. Clonezilla 開機

7. DRBL Live 開機