更换国内yum源、yum下载rpm包

五周第二次课(11月14日)
7.6 yum更换国内源

yum install -y epel-release #安装扩展源epel

默认yum源地址,国内有163和搜狐速度比较快

[root@wwlinux701 yum.repos.d]# cat CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[root@wwlinux701 yum.repos.d]# 

7.7 yum下载rpm包

•yum install -y 包名 –downloadonly
• ls /var/cache/yum/x86_64/7/
• yum install -y 包名 –downloadonly –downloaddir=路径
• yum reinstall -y 包名 –downloadonly –downloaddir=路径 #已经下过会重新安装
yum 下载rom包:
yum install libaio-devel –downloadonly –downloaddir=/tmp/
yum reinstall 包名 –downloadonly –downloadddir=/tmp/ #已经安装过的

下载整个目录
wget -c -r -np -k -L -p www.xxx.org/pub/path/
wget -c -r -np -k -L -p http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/repodata/

7.8/7.9 源码包安装
源码包放在:cd /usr/local/src/
•wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
• tar zxvf httpd-2.2.32.tar.gz
• cd httpd-2.2.32
• ./configure –prefix=/usr/local/apache2
echo $? #上一条命令非0即有问题
更换国内yum源、yum下载rpm包_第1张图片
• make
• make install
更换国内yum源、yum下载rpm包_第2张图片
• 卸载就是删除安装的文件

扩展
1. 配置yum源优先级 http://ask.apelearn.com/question/7168
2. 把源码包打包成rpm包 http://www.linuxidc.com/Linux/2012-09/70096.htm

你可能感兴趣的:(linux学习之路)