redhad借用CentOs yum 安装

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

[root@host2 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安装包
    [root@stonex ~]# 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安装包。
    
    [root@stonex ~]# 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%]
    [root@stonex ~]#
     
    再搜索(首次执行会下载epel/primary_db)
    [root@stonex ~]# 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
    省略了一些行......
    [root@stonex ~]# 
    
    安装
    [root@stonex ~]# yum install ganglia-gmond -y
    yum安装会自动解决头疼的依赖包问题

 

S2、安装gmetad

    和gmond安装中介绍的相同,如果本地软件库不提供gmetad,那么需要安装EPEL。
    [root@stonex ~]# 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
    [root@stonex ~]# 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
    [root@stonex ~]# wget http://ncu.dl.sourceforge.net/project/ganglia/ganglia-web/3.5.12/ganglia-web-3.5.12.tar.gz
    [root@stonex down]# tar -zxvf ganglia-web-3.5.12.tar.gz
    [root@stonex down]# cd ganglia-web-3.5.12
    
    编译Makefile
    [root@stonex 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是否启动:
    [root@stonex ~]# service httpd status
    启动httpd:
    [root@stonex ~]# service httpd start
    
    检查gmetad是否启动:
    [root@stonex ~]# service gmetad status
    启动gmetad:
    [root@stonex ~]# service gmetad start
    
    检查本地gmond是否启动:
    [root@stonex ~]# service gmond status
    启动gmond:
    [root@stonex ~]# 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状态:
    [root@stonex ~]# sestatus
    SELinux status:                 enabled
    SELinuxfs mount:                /selinux
    Current mode:                   permissive
    Mode from config file:          enforcing
    Policy version:                 24
    Policy from config file:        targeted
    
    关闭SELinux:
    [root@stonex ~]# 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

 

posted @ 2016-07-15 16:51  dy9776  阅读(1005)  评论(0编辑  收藏  举报