3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
現在才知道原來CentOS跟Redhat一家親了阿 XD  Server進了電信機房 , 就很難像在有Internet環境下那麼方便兒安裝 , 常常因為客戶突然新增的需求 , 才發現有些服務沒有預安裝進去 , 昨日協助朋友研究解決了一個離線安裝問題 , 自己也筆記一下 , 日後應該也是會有機會遇到 : 問題情境 : 上線的服務主機安裝 Red Hat Enterprise Linux Server release 7.4 (Maipo) 需要加裝 Snmpd 供 snmp server 監控 查了一下網路資料 :  snmp服務從rpm打包到離線安裝 手邊剛好有 Virtualbox + Redhat 7.5 $ mkdir /root/snmp $ yum install --downloadonly --downloaddir=/root/snmp net-snmp net-snmp-devel net-snmp-libs net-snmp-utils 指令下完後才發現原來  Redhat 還要註冊 XD This system is not registered to Red Hat Subscription Management 實在不想註冊 , 再去研究了一下 , 才知道原來CentOS已經被 Redhat買下 , 表示太好了~ CentOS7 與 Redhat7  Yum套件應該都可以通用 (參考此篇: Redhat 7使用CentOS 7的Yum网络源 ) /* 引用 : 在学习“第1章 部署虚拟环境安装linux系统—Yum软件仓库”有介绍yum网络源,所以决定尝试一下CentOS的网络源,这样在安装依赖包时就会方便很多,由于redhat 的更新包只对注册的用户生效,所以需要自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,下面是安装步骤。 */ 但這篇叫我把 Yum 那些都移除 , 覺得實在麻煩 XD  ,不管它直接跳過 , 把subscription-manager* 與 rhn-check 移除就好 (參考: 解决redhat的未注册问题) : 1. 解決 Redhat 未註冊問題 :  # 查看一下subscription-manager套件 $ rpm -qa|grep subscription-manager #移除 subscription-manager* $ yum remove subscription-manager* # 查看一下 rhn 套件 $ rpm -qa|grep rhn #移除 rhn-check $ yum remove rhn-check # 此時 repolist 數量應該為 0 $ yum repolist 2. 新增 CentOS Repo /etc/yum.repos.d/  應該只剩下  redhat.repo 如下內容  ================================================ # # Certificate-Based Repositories # Managed by (rhsm) subscription-manager # # *** This file is auto-generated. Changes made here will be over-written. *** # *** Use "subscription-manager repo-override --help" if you wish to make changes. *** # # If this file is empty and this system is subscribed consider # a "yum repolist" to refresh available repos ================================================ 新建一個 repo file : /etc/yum.repos.d/CentOS-Base.repo  ( Ref. ) ================================================ [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 ================================================ 3. 再次執行 yum --downloadonly :  $ yum install --downloadonly --downloaddir=/root/snmp net-snmp net-snmp-devel net-snmp-libs net-snmp-utils 跳過Redhat註冊 改用CentOS Yum套件源下載OK 4. 打包downloaddir目錄並移到離線環境去 , 由於正式環境是 redhat7.4 不敢學網路上用 force安裝 , 只安裝需要的snmpd套件就好 # 進入正式環境解壓目錄  $ yum install net-snmp-5.7.2-37.el7.x86_64.rpm net-snmp-libs-5.7.2-37.el7.x86_64.rpm net- snmp-agent-libs-5.7.2-37.el7.x86_64.rpm $ yum install net-snmp-utils-5.7.2-37.el7.x86_64.rpm $ systemctl enable snmpd $ systemctl start snmpd 5. 確認 snmp 服務是否已啟用 $ netstat -auntp | grep snmp #應該也會看到如下 tcp & udp 在 listen tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      23472/snmpd        udp        0      0 0.0.0.0:161             0.0.0.0:*                           23472/snmpd YES ~ 搞定 收工 !! 現在才知道原來CentOS跟Redhat一家親了阿 XD  Ref: 怎样使用 Red Hat Subscription Manager (RHSM) 将系统注册到红帽客户门户网站? Redhat 7使用CentOS 7的Yum网络源 解决redhat的未注册问题 在 CentOS 7 安裝 snmpd 服務(CentOS 7 SNMP install)

本文由yancey-studyblogspotcom提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦