安装环境:VPS,CentOS 6 + devel包
 
一、安装相应的软件
 
1.安装python
 
下载Python源码包
 
[root@akinlau ~]# wget http://www.python.org/ftp/python/2.4.3/Python-2.4.3.tar.bz2
 
解压Python源码包
 
[root@akinlau ~]# tar jxvf Python-2.4.3.tar.bz2
 
编译安装Python
 
[root@akinlau ~]# cd Python-2.4.3
 
[root@akinlau Python-2.4.3]# ./configure
 
checking MACHDEP... linux2
 
checking EXTRAPLATDIR...

checking for --without-gcc... no
 
checking for --with-cxx=<compiler>... no
 
checking for c++... c++
 
 
 
checking for /dev/ptmx... yes
 
checking for /dev/ptc... no
 
checking for socklen_t... yes
 
checking for build directories... done
 
configure: creating ./config.status
 
config.status: creating Makefile.pre
 
config.status: creating Modules/Setup.config
 
config.status: creating pyconfig.h
 
creating Setup
 
creating Setup.local
 
creating Makefile
 
 
 
[root@akinlau Python-2.4.3]# make
 
[root@akinlau Python-2.4.3]# make install
 
running install_scripts
 
copying build/scripts-2.4/smtpd.py -> /usr/local/bin
 
copying build/scripts-2.4/pydoc -> /usr/local/bin
 
copying build/scripts-2.4/idle -> /usr/local/bin
 
changing mode of /usr/local/bin/smtpd.py to 755
 
changing mode of /usr/local/bin/pydoc to 755
 
changing mode of /usr/local/bin/idle to 755
 
if test -f /usr/local/bin/python -o -h /usr/local/bin/python; \
 
       then rm -f /usr/local/bin/python; \
 
       else true; \
 
       fi
 
(cd /usr/local/bin; ln python2.4 python)
 
Creating directory /usr/local/man
 
Creating directory /usr/local/man/man1
 
/usr/bin/install -c -m 644 ./Misc/python.man \
 
              /usr/local/man/man1/python.1
 
2.下载并安装python-urlgrabber,python-pycurl,yum-metadata-parser
 
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-8.el6.noarch.rpm
 
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-8.el6.x86_64.rpm
 
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
 
[root@akinlau ~] rpm -ivh python-urlgrabber-3.9.1-8.el6.noarch.rpm python-pycurl-7.19.0-8.el6.x86_64.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
 
3.创建yum配置文件
 
[root@akinlau ~] touch /etc/yum.conf
 
4.下载yum源码包并安装
 
[root@akinlau ~] wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
 
解压源码包
[root@akinlau ~] tar zxvf yum-3.4.3.tar.gz
 
编译安装yum
[root@akinlau ~] cd yum-3.4.3
 
[root@akinlau yum-3.4.3] ./yummain.py install yum
 
base                                                         | 3.7 kB     00:00

base/primary_db                                              | 4.5 MB     00:07

extras                                                       | 3.5 kB     00:00

extras/primary_db                                            |  23 kB     00:03

出现以上提示就证明yum已经安装成功了。
 
 
 
二、配置yum源(建议使用国内的163和sohu源,速度比较快)
 
1.网易(163) yum源
 
下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
 
CentOS5
 
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
 
CentOS6
 
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
 
运行yum makecache生成缓存
 
2.搜狐(sohu) yum 源
 
下载CentOS-Base-sohu.repo, 放入/etc/yum.repos.d/
 
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
 
运行yum makecache生成缓存
 
3.EPEL源
 
下载相应的RPM包安装
 
第6版企业版 Linux
 
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
 
第5版企业版 Linux
 
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
4.RPMForge源
 
下载对应系统版本的RPM包安装
 
EL 6:

i686:
 
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
 
x86_64:
 
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
 
EL 5:

i386:

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
 
x86_64:

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
 
163和sohu的源直接下载相应的repo文件放到/etc/yum.repos.d/目录,然后运行yum makecache生成缓存就可以使用
 
 
 
EPEL源和RPMForge源(国外的yum源)都是下载相应的RPM包安装后会自动在/etc/yum.repos.d/目录下生成相应的repo文件,然后运行yum makecache生成缓存就可以使用
 
不建议多种源一起用,一般情况下一个官方标准源加一个上面的其中一个源就足够用了,以上源对CentOS等系统完全兼容,但各软件库之间并不能保证完全兼容没有冲突。如果您需要同时使用以上源,您需要安装yum-priorities插件。安装yum-priorities插件后,您可以给各个源设置优先级priority。一般设置官方标准源优先级为1,最高,第三方源推荐>10(priority=N (N为1到99的正整数,数值越小越优先)。如果不想使用某个源的话可以在repo文件中设置 enabled=0不启用该源,如果想启用设成enabled=1就可以了。
 
 
 
下面以官方标准源:CentOS-Base.repo为例子,说明一下主要的设置选项:
 
[base]                   //软件源的名称,将被yum取得并识别
 
name=CentOS-$releasever - Base  //定义软件仓库的名称,没实际作用
 
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
 
//mirrorlist指定镜像服务器的地址列表
 
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
 
//baseurl指定一个源的镜像服务器地址,这里加了#表示注释了yum将忽略这一行
 
priority=1            //设置源优先级,1到99的正整数,数值越小越优先
 
enabled=0             //这个选项表示是否启用repo中定义的这个源,0为禁用,1为启用
 
gpgcheck=1          //这个选项表示是否要对下载的rpm包进行gpg的校验,来确定rpm包的来源是有效和安全的,跟下面的gpgkey成对使用
 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6          //定义用于校验的gpg密钥

CentOS 6编译安装yum和配置常用的yum源的更多相关文章

  1. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  2. CentOS 下编译安装Apache

    CentOS 下编译安装Apache 卸载原有的apache 首先从 http://httpd.apache.or 下载apache源码包httpd-2.4.4.tar.gz然后从 http://ap ...

  3. CentOS 7 编译安装 Code::Blocks

    CentOS 7 编译安装 Code::Blocks yum install cairo-devel yum install pango-devel yum install atk-devel yum ...

  4. 【转】linux 编译安装nginx,配置自启动脚本

    linux 编译安装nginx,配置自启动脚本 本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装ng ...

  5. linux 编译安装nginx,配置自启动脚本

    本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装nginx,记录下安装过程: 参照这篇文章:Linu ...

  6. centos mysql 编译安装

    centos mysql 编译安装 1.安装 创建MySQL用户 sudo useradd mysql 下载MySQL的源码包,我们这里使用的时5.5.18 安装依赖 sudo yum -y inst ...

  7. 【转】编译安装PHP并配置PHP-FPM

    1.前言上一篇讲述了如何编译安装MySQL,虽然可以通过yum install 或者rpm来安装,但是yum install和rpm安装有一个特点,就是有些参数是别人根据大众需求定制的,如果需要进行自 ...

  8. 转:在CentOS下编译安装GCC

    转:https://teddysun.com/432.html 在CentOS下编译安装GCC 技术  秋水逸冰  发布于: 2015-09-02  更新于: 2015-09-02  6519 次围观 ...

  9. php编译安装configure完全配置够日常所用功能

    php编译安装configure完全配置够日常所用功能 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/p ...

随机推荐

  1. html学习第一讲(内容html常规控件的的使用)

    <html> <head> <title> 这是网页的标题</title> </head> <body> <h2>& ...

  2. [转]Vue生态系统中的库

    Vue UI组件库 Vuex vux github ui demo:https://github.com/airyland/vux Mint UI 项目主页:http://mint-ui.github ...

  3. GoogleMapsV3-----基础地图(自定义消息提示OverlayView) (转)

    <html> <head> <title> </title> <title></title>    <style type ...

  4. 也来学学插件式开发续-利用MEF

    前面一个博客:也来学学插件式开发中很多朋友留言说可以用MEF来实现.于是我就试着用MEF实现了一下. 步骤和上一篇差不多,只是加载插件的方式有所不同.这只是一个自己的示例程序,肯定有很多不足之处,欢迎 ...

  5. Android 中 values/strings.xml 取值

    <string name="smsphone_init">15898146863</string> //取值 String strSmsPhone=getR ...

  6. Android Intent Scheme URLs攻击

    0x0 引言 我们知道,在Android上的Intent-based攻击非常普遍.这样的攻击轻则导致应用程序崩溃.重则可能演变提权漏洞.当然,通过静态特征匹配,Intent-Based的恶意样本还是非 ...

  7. mysql 慢查询日志,灾难日志恢复,错误日志

    灾难日志 记录了所有的DDL(Create.Drop和Alter)和DML(insert.update.delete_的语句,但不包括查询的语句 打开mysql.ini 找到Binary Loggin ...

  8. Android Gradle 引用本地 AAR 的几种方式

    折衷方案: 1.方式2 - 不完美解决办法2 2.再使用"自定义Gradle代码"来减轻重复设置的问题. 自定义Gradle代码如下: repositories { flatDir ...

  9. Matlab实现图像切割

    以下使用极小值点阈值选取方法,编写MATLAB程序实现图像切割的功能. 极小值点阈值选取法即从原图像的直方图的包络线中选取出极小值点, 并以极小值点为阈值将图像转为二值图像 clear all; cl ...

  10. 在IntentService中使用Toast与在Service中使用Toast的异同

    1. 表象 Service中能够正常显示Toast,IntentService中不能正常显示Toast.在2.3系统上,不显示toast,在4.3系统上,toast显示.可是不会消失. 2. 问题分析 ...