• centos环境 epel安装完毕后无法使用的问题解决

    最近在弄些一键脚本玩,偶尔发现我有一台服务器的mediainfo无法安装,原因是没有安装三方源epel-release

    问题环境是发生在centos6下面,这个很简单立马去安装三方源

    wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    显示如下
    Preparing...                ########################################### [100%]
    	package epel-release-6-8.noarch is already installed
    

    然后安装mediainfo,依然提示不存在mdeiainfo package。

    怒了,执行

    yum repolist #查看安装的repo
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.kernel.org
     * extras: mirrors.kernel.org
     * geekery: geekery.epac.to
     * rpmfusion-free-updates: mirror.web-ster.com
     * rpmfusion-nonfree-updates: mirror.web-ster.com
     * updates: mirrors.kernel.org
    repo id                                                                     repo name                                                                                 status
    base                                                                        CentOS-6 - Base                                                                           6706
    extras                                                                      CentOS-6 - Extras                                                                           64
    geekery                                                                     geekery repository for EL6 - x86_64                                                        131
    rpmfusion-free-updates                                                      RPM Fusion for EL 6 - Free - Updates                                                       220
    rpmfusion-nonfree-updates                                                   RPM Fusion for EL 6 - Nonfree - Updates                                                     36
    updates                                                                     CentOS-6 - Updates                                                                         282
    

    竟然没有epel,怎么回事

    [root@local ~]# yum --enablerepo=epel       #强制指定使用epel源也报失败
    Loaded plugins: fastestmirror
    
    
    Error getting repository data for epel, repository not found
    [root@local ~]# cd /etc/yum.repos.d/ 
    [root@localhost yum.repos.d]# ll
    total 48
    -rw-r--r-- 1 root root 1991 Mar 28 18:25 CentOS-Base.repo
    -rw-r--r-- 1 root root  647 Mar 28 18:25 CentOS-Debuginfo.repo
    -rw-r--r-- 1 root root  630 Mar 28 18:25 CentOS-Media.repo
    -rw-r--r-- 1 root root 7989 Mar 28 18:25 CentOS-Vault.repo
    -rw-r--r-- 1 root root  289 Mar 28 18:25 CentOS-fasttrack.repo
    -rw-r--r-- 1 root root 1056 Nov  5  2012 epel-testing.repo
    -rw-r--r-- 1 root root  254 Apr 27  2016 geekery.repo
    -rw-r--r-- 1 root root 1062 Jun 19  2012 rpmfusion-free-updates-testing.repo
    -rw-r--r-- 1 root root 1002 May 15  2011 rpmfusion-free-updates.repo
    -rw-r--r-- 1 root root 1107 Jun 19  2012 rpmfusion-nonfree-updates-testing.repo
    -rw-r--r-- 1 root root 1047 May 15  2011 rpmfusion-nonfree-updates.repo
    

    麻蛋,repo目录下竟然没有epel.repo,只能先卸载看看

    [root@local ~]# rpm -e epel-release-6-8.noarch
    error: Failed dependencies:
    	epel-release >= 6 is needed by (installed) rpmfusion-free-release-6-1.noarch
    	epel-release >= 6 is needed by (installed) rpmfusion-nonfree-release-6-1.noarch
    

    卸载也失败,可能是安装rpmfusion源顺序不对,造成冲突了,查明原因后决定先卸载rpmfusion源

    [root@local ~]# rpm -qa |grep rpmfusion
    rpmfusion-nonfree-release-6-1.noarch
    rpmfusion-free-release-6-1.noarch
    [root@local ~]# rpm -e rpmfusion-nonfree-release
    [root@local ~]# rpm -e rpmfusion-free-release
    

    然后再次安装epel源

    root@local ~]# rpm -ivh epel-release-6-8.noarch.rpm 
    Preparing...                ########################################### [100%]
       1:epel-release           ########################################### [100%]
    [root@local ~]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    epel/metalink                                                                                                                                        | 9.6 kB     00:00     
     * base: mirrors.kernel.org
     * epel: dl.fedoraproject.org
     * extras: mirrors.kernel.org
     * geekery: geekery.epac.to
     * updates: mirrors.kernel.org
    epel                                                                                                                                                 | 4.3 kB     00:00     
    epel/primary_db                                                                                                                                      | 5.9 MB     00:00     
    repo id                                                        repo name                                                                                              status
    base                                                           CentOS-6 - Base                                                                                         6706
    epel                                                           Extra Packages for Enterprise Linux 6 - x86_64                                                         12303
    extras                                                         CentOS-6 - Extras                                                                                         64
    geekery                                                        geekery repository for EL6 - x86_64                                                                      131
    updates                                                        CentOS-6 - Updates                                                                                       282
    repolist: 19486
    

    成功安装好,试下安装mediainfo

    [root@local ~]# yum install mediainfo
    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
     * base: mirrors.kernel.org
     * epel: pubmirror1.math.uh.edu
     * extras: mirrors.kernel.org
     * geekery: geekery.epac.to
     * updates: mirrors.kernel.org
    Resolving Dependencies
    --> Running transaction check
    ---> Package mediainfo.x86_64 0:0.7.94-1.el6 will be installed
    --> Processing Dependency: libzen.so.0()(64bit) for package: mediainfo-0.7.94-1.el6.x86_64
    --> Processing Dependency: libmediainfo.so.0()(64bit) for package: mediainfo-0.7.94-1.el6.x86_64
    --> Running transaction check
    ---> Package libmediainfo.x86_64 0:0.7.94-1.el6 will be installed
    --> Processing Dependency: libtinyxml2.so.1()(64bit) for package: libmediainfo-0.7.94-1.el6.x86_64
    ---> Package libzen.x86_64 0:0.4.35-1.el6 will be installed
    --> Running transaction check
    ---> Package tinyxml2.x86_64 0:1.0.11-4.20130805git0323851.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ============================================================================================================================================================================
     Package                                 Arch                              Version                                                    Repository                       Size
    ============================================================================================================================================================================
    Installing:
     mediainfo                               x86_64                            0.7.94-1.el6                                               epel                             69 k
    Installing for dependencies:
     libmediainfo                            x86_64                            0.7.94-1.el6                                               epel                            2.1 M
     libzen                                  x86_64                            0.4.35-1.el6                                               epel                             99 k
     tinyxml2                                x86_64                            1.0.11-4.20130805git0323851.el6                            epel                             31 k
    
    Transaction Summary
    ============================================================================================================================================================================
    Install       4 Package(s)
    
    Total download size: 2.3 M
    Installed size: 7.2 M
    Is this ok [y/N]: y
    
    ......#省略
    
    Verifying  : tinyxml2-1.0.11-4.20130805git0323851.el6.x86_64                                                                                                          4/4 
    
    Installed:
      mediainfo.x86_64 0:0.7.94-1.el6                                                                                                                                           
    
    Dependency Installed:
      libmediainfo.x86_64 0:0.7.94-1.el6                    libzen.x86_64 0:0.4.35-1.el6                    tinyxml2.x86_64 0:1.0.11-4.20130805git0323851.el6                   
    
    Complete!
    

    果然没有问题

    再次安装rpmfusion源 #ffmpeg的三方源

    后进行检验

    [root@local ~]# yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.syringanetworks.net
     * epel: dl.fedoraproject.org
     * extras: mirrors.syringanetworks.net
     * geekery: geekery.epac.to
     * rpmfusion-free-updates: mirror.web-ster.com
     * rpmfusion-nonfree-updates: mirror.web-ster.com
     * updates: mirrors.syringanetworks.net
    repo id                                                                 repo name                                                                                     status
    base                                                                    CentOS-6 - Base                                                                                6706
    epel                                                                    Extra Packages for Enterprise Linux 6 - x86_64                                                12303
    extras                                                                  CentOS-6 - Extras                                                                                64
    geekery                                                                 geekery repository for EL6 - x86_64                                                             131
    rpmfusion-free-updates                                                  RPM Fusion for EL 6 - Free - Updates                                                            220
    rpmfusion-nonfree-updates                                               RPM Fusion for EL 6 - Nonfree - Updates                                                          36
    updates                                                                 CentOS-6 - Updates                                                                              282
    repolist: 19742
    

    没问题了,和epel可以共存问题到此解决。

    事后分析,可能是当时先安装了非epel的三方源,再安装epel源时起了冲突,导致epel源无法安装,碰到这类问题时先解决冲突后再安装一般可以解决问题。

     

     

     

  • centos环境下中文乱码处理

    最近在一台centos6环境下面的中文显示出现乱码

    这里简单写一下我的处理步骤

    1 安装中文支持包

    yum groupinstall chinese-support
    

    2 配置环境文件

    [root@localhost ~]# locale
    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    [root@localhost ~]# vim /etc/sysconfig/i18n 
    LANG=zh_CN.UTF-8  #将en_US.UTF-8改为zh_CN.UTF-8
    

    3 重启机器就好了。

  • youtube视频下载 you-get一键安装包

    知道you-get是来自逗比大佬的安利,大佬的文章里面介绍了debian的安装,我就这边补个centos的一键安装包了

    cd /root
    wget https://raw.githubusercontent.com/kevin-cn/some-useful-shell/master/youget_install.sh
    chmod +x youget_install.sh
    ./youget_install.sh

    下载很简单

    浏览器里查看一下目前链接的地址,比如 https://www.youtube.com/watch?v=TJlwPUo7-T8

    然后

    you-get https://www.youtube.com/watch?v=TJlwPUo7-T8

    就可以了,如果需要下载高清版本之类的高阶进程请查看逗比大佬的教程 ,我这就不多写了。

    一个很方便的视频/音频等 命令行下载工具 —— You-Get 安装使用教程

  • VNSTAT使用说明

    Vnstat是什么?

    这是一个记录每日流量的程序,占用内存极少,主要是将你vps/独服的网卡流量数据保存到vnstat的文本数据库,然后将其显示出来供各位机主/管理员查看的一个小工具

    安装非常简单

    首先安装第三方软件源

    yum install epel-release

    然后再安装vnstat即可

    yum -y vnstat

    好了,安装结束,设置开机启动

    chkconfig vnstat on

    不想重启并且希望安装完就开始有效的话执行

    vnstatd -d # -d指daemon模式开始后台启动

    这条指令运行完界面应该会出现下面这样的展示

    [root@local ~]# vnstatd -d
    Zero database found, adding available interfaces...
    "venet0" added, -1 Mbit bandwidth limit.
    "gre0" added, -1 Mbit bandwidth limit.
    "gretap0" added, -1 Mbit bandwidth limit.
    "ip6tnl0" added, -1 Mbit bandwidth limit.
    

    这个是显示哪些网卡被加入了统计,我的测试服务器网卡是venet0.明显是OVZ架构的,很多服务器是eth0.

    vnstat默认使用的是eth0,如果你的网卡是eth0,查看命令可以直接是

    vnstat -d #查看按天统计数据

    如果是其他的网卡则需要指出查看哪个网卡的流量,使用-i参数 (interface)

    vnstat -d -i venet0

    其余主要参数是

    -q   查看数据库是否正确,比如我刚刚有4个网卡,但是你不知道那个是对外网卡时,可以使用该命令看下

    # vnstat -q    
    
                          rx      /      tx      /     total    /   estimated
     gretap0: Not enough data available yet.
     gre0: Not enough data available yet.
     venet0:
           May '17     16.56 MiB  /  651.36 MiB  /  667.92 MiB  /    2.25 GiB
             today     16.56 MiB  /  651.36 MiB  /  667.92 MiB  /     685 MiB
    
     ip6tnl0: Not enough data available yet.
    

    明显看到venet0是我们对外接口。

    -h   以小时为单位显示查询内容

    -d   以天为单位显示查询内容

    -m  以月为单位显示查询内容

    -w  以星期为单位显示查询内容

    -t   top10的排名比如vnstat -m -t -vnent0

    这个在下载盒子上可以看出大约的网络质量,最后来个我的盒子截图