標籤:
RedHat linux 預設是安裝了yum軟體的,但是由於啟用認證的原因讓redhat無法直接進行yum安裝一些軟體,如果我們需要在redhat下直接yum安裝軟體,我們只用把yum的源修改成CentOS的就好了,然後把源裡面的變數全部修改成實際的值,這樣就能使用yum直接安裝我們需要的軟體了。
使用說明
(先將/etc/yum.repos.d的內容移到其他地方,將下載後的.repo複製到/etc/yum.repos.d中)
cd /etc/yum.repos.d/
mv redhat.repo /home/hadoop/
mv rhel-source.repo /home/hadoop/
1、到http://mirrors.163.com的 centos協助文檔 中下載CentOS6-Base-163.repo檔案,存放到/etc/yum.repos.d中(注意:需要連網)
Centos 5 wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
Centos 6 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
vi /etc/yum.repos.d/CentOS6-Base-163.repo
修改:(將全部的$releasever 改為:6)
如將baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
中的$releasever 改為:6
即:baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
編輯完後儲存,運行:
yum clean all 清除原有緩衝
yum makecache 擷取yum列表
就會看到:
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
base | 3.7 kB 00:00
base/group_gz | 220 kB 00:03
base/filelists_db | 5.3 MB 00:41
.........
後面的省略
安裝好了,即可以試試:yum install gcc g++
下面很上面的內容無關
d) 安裝程式包
yum install rrdtool-devel
yum install compat-expat1
yum install httpd
yum install gcc g++
yum -y install apr-util-devel
yum install pcre-devel
yum install zlib-devel
yum instal php
yum install php-gd
yum install xorg-x11-server-Xorg
準備環境
# lsb_release -a
[[email protected] yum.repos.d]# lsb_release -a
LSB Version::core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID:RedHatEnterpriseServer
Description:Red Hat Enterprise Linux Server release 6.2 (Santiago)
Release:6.2
Codename:Santiago
S1、安裝gmond
在本地軟體庫中搜尋gmond安裝包
[[email protected] ~]# yum search ganglia-gmond
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Warning: No matches found for: ganglia-gmond
No Matches found
顯示搜尋失敗,可能是當前RPM發行版中沒有Ganglia安裝包。
[[email protected] ~]# rpm -Uvh \
> http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.L2dC50: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[[email protected] ~]#
再搜尋(首次執行會下載epel/primary_db)
[[email protected] ~]# yum search ganglia-gmond
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
省略了一些行......
ganglia-gmond.x86_64 : Ganglia Monitoring daemon
ganglia-gmond-python.x86_64 : Ganglia Monitor daemon python DSO and metric modules
省略了一些行......
[[email protected] ~]#
安裝
[[email protected] ~]# yum install ganglia-gmond -y
yum安裝會自動解決頭疼的依賴包問題
S2、安裝gmetad
和gmond安裝中介紹的相同,如果本地軟體庫不提供gmetad,那麼需要安裝EPEL。
[[email protected] ~]# yum install ganglia-gmetad -y
會發現安裝了以下依賴包:
Dependency Installed:
dejavu-fonts-common.noarch 0:2.30-2.el6 dejavu-lgc-sans-mono-fonts.noarch 0:2.30-2.el6 dejavu-sans-mono-fonts.noarch 0:2.30-2.el6 fontpackages-filesystem.noarch 0:1.41-1.1.el6 rrdtool.x86_64 0:1.3.8-6.el6
S3、安裝gweb
Wiki:http://sourceforge.net/apps/trac/ganglia/wiki/ganglia-web-2#Installation
在進行gweb的安裝和配置前,請先檢查是否已經
滿足下面需求:
Apache Web Server
PHP 5.2及更新版本
PHP JSON 擴充的安裝和啟用
首先安裝Apache和PHP 5
[[email protected] ~]# yum install httpd php
會發現安裝了以下依賴包:
Dependency Installed:
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 httpd-tools.x86_64 0:2.2.15-29.el6.centos mailcap.noarch 0:2.1.31-2.el6 php-cli.x86_64 0:5.3.3-27.el6_5 php-common.x86_64 0:5.3.3-27.el6_5
需要啟用PHP的JSON擴充,JSON已經包含在PHP 5.2及更新版本中。
通過檢查/etc/php.d/json.ini檔案來檢查JSON擴充的狀態,如果已經啟用JSON擴充,在該檔案中應該包含類似下面語句的內容:
extension=json.ini
下載最新版本的gweb(https://sourceforge.net/projects/ganglia/files/gweb/)
本樣本當前最新版本為3.5.12
[[email protected] ~]# wget http://ncu.dl.sourceforge.net/project/ganglia/ganglia-web/3.5.12/ganglia-web-3.5.12.tar.gz
[[email protected] down]# tar -zxvf ganglia-web-3.5.12.tar.gz
[[email protected] down]# cd ganglia-web-3.5.12
編譯Makefile
[[email protected] ganglia-web-3.5.12]# vim Makefile
可以查看一些使用者預設配置:
##########################################################
# User configurables:
##########################################################
# Location where gweb should be installed to (excluding conf, dwoo dirs).
GDESTDIR = /usr/share/ganglia-webfrontend
# Location where default apache configuration should be installed to.
GCONFDIR = /etc/ganglia-web
# Gweb statedir (where conf dir and Dwoo templates dir are stored)
GWEB_STATEDIR = /var/lib/ganglia-web
# Gmetad rootdir (parent location of rrd folder)
GMETAD_ROOTDIR = /var/lib/ganglia
APACHE_USER = www-data
##########################################################
修改預設配置:
GDESTDIR = /var/www/html/ganglia2
APACHE_USER = apache
注意:GDESTDIR 和 APACHE_USER 要與APACHE的設定檔(/etc/httpd/conf/httpd.conf)中的 DocumentRoot 、 apache保持一致
make install
S4、狀態檢查
檢查httpd是否啟動:
[[email protected] ~]# service httpd status
啟動httpd:
[[email protected] ~]# service httpd start
檢查gmetad是否啟動:
[[email protected] ~]# service gmetad status
啟動gmetad:
[[email protected] ~]# service gmetad start
檢查本地gmond是否啟動:
[[email protected] ~]# service gmond status
啟動gmond:
[[email protected] ~]# service gmond start
S5、關閉SELinux
如果你跳過這一步,開啟http://<server ip address>/ganglia2會出現以下異常:
There was an error collecting ganglia data (127.0.0.1:8652): fsockopen error: Permission denied
SELinux是什嗎?
http://wiki.centos.org/zh/HowTos/SELinux
查看SELinux狀態:
[[email protected] ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
關閉SELinux:
[[email protected] ~]# setenforce 0
setenforce 這個指令可以即時轉換 Enforcing 及 Permissive 這兩個模式,但這些改動在系統重新開機時不會被保留。
要想在下次開機後生效,需要在 /etc/selinux/config 內修改 SELINUX= 這一行為 enforcing。
S6、訪問Ganglia監控平台
http://<server ip address>/ganglia2/
目錄“/ganglia2”可以在 ganglia-web的Makefile檔案中GDESTDIR被修改,修改後需要重新編譯
來源:http://blog.csdn.net/xxd851116/article/details/21527055
redhad借用CentOs yum 安裝