Linux的yum源配置
查看 yum 中有哪些文件
cd /etc/yum.repos.d/ ll
输出5个后缀为 repo 的文件夹
-rw-r--r--. 1 root root 1991 Aug 4 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 647 Aug 4 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 289 Aug 4 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Aug 4 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 6259 Aug 4 2015 CentOS-Vault.repo
改后缀名字(因5个文件中只修改其中一个)
把5个文件夹后缀名为 repo 的都改成 repo.old
rename .repo.old * .repo
改名 新名字 所有 旧名字
输出结果:
-rw-r--r--. 1 root root 1991 Aug 4 2015 CentOS-Base.repo.old
-rw-r--r--. 1 root root 647 Aug 4 2015 CentOS-Debuginfo.repo.old
-rw-r--r--. 1 root root 289 Aug 4 2015 CentOS-fasttrack.repo.old
-rw-r--r--. 1 root root 630 Aug 4 2015 CentOS-Media.repo.old
-rw-r--r--. 1 root root 6259 Aug 4 2015 CentOS-Vault.repo.old
把需要配置的文件夹名字在改回来
mv CentOS-Media.repo.old CentOS-Media.repo
旧名字 新名字
配置文件
vim CentOS-Media.repo
需要配置的文件夹名字
dd 进行编辑
进入编辑模式:
配置会话
修改:
[ ] 改名字,但不许有空格
[my_yum]
name= 改名字
name=my_yum
cd /mnt/local_yum/ ll 注: 查看yum源的文件,并pwd输出路径
pwd
输出:
/mnt/local_yum 路径
放到:
baseurl=file:///mnt/local_yum mnt/local_yu
设置enabled
enabled=0 改成1
删除
file:///media/cdrom/
file:///media/cdrecorder/
保存退出 强制保存
:wq!
清楚原数据
yum clean all
输出内容:
Loaded plugins: fastestmirror, security Cleaning repos: my_yum Cleaning up Everything
加载所有yum
yum repolist all
输出结果:
Loaded plugins: fastestmirror, security Determining fastest mirrors my_yum | 4.0 kB 00:00 ... my_yum/primary_db | 4.6 MB 00:00 ... repo id repo name status my_yum my local-yum enabled: 6,575 repolist: 6,575
试验安装 HHPD服务
yum -y install httpd
输出结果
Loaded plugins: fastestmirror, security Setting up Install Process Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.2.15-45.el6.centos will be installed --> Processing Dependency: httpd-tools = 2.2.15-45.el6.centos for package: httpd-2.2.15-45.el6.centos.x86_64 --> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-45.el6.centos.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-45.el6.centos.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-45.el6.centos.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed ---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed ---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed ---> Package httpd-tools.x86_64 0:2.2.15-45.el6.centos will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================= Installing: httpd x86_64 2.2.15-45.el6.centos my_yum 829 k Installing for dependencies: apr x86_64 1.3.9-5.el6_2 my_yum 123 k apr-util x86_64 1.3.9-3.el6_0.1 my_yum 87 k apr-util-ldap x86_64 1.3.9-3.el6_0.1 my_yum 15 k httpd-tools x86_64 2.2.15-45.el6.centos my_yum 77 k Transaction Summary ============================================================================================================================================================= Install 5 Package(s) Total download size: 1.1 M Installed size: 3.6 M Downloading Packages: ------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 6.2 MB/s | 1.1 MB 00:00 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Importing GPG key 0xC105B9DE: Userid : CentOS-6 Key (CentOS 6 Official Signing Key) centos-6-key@centos.org Package: centos-release-6-7.el6.centos.12.3.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : apr-1.3.9-5.el6_2.x86_64 1/5 Installing : apr-util-1.3.9-3.el6_0.1.x86_64 2/5 Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/5 Installing : httpd-tools-2.2.15-45.el6.centos.x86_64 4/5 Installing : httpd-2.2.15-45.el6.centos.x86_64 5/5 Verifying : apr-1.3.9-5.el6_2.x86_64 1/5 Verifying : httpd-2.2.15-45.el6.centos.x86_64 2/5 Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/5 Verifying : apr-util-1.3.9-3.el6_0.1.x86_64 4/5 Verifying : httpd-tools-2.2.15-45.el6.centos.x86_64 5/5 Installed: httpd.x86_64 0:2.2.15-45.el6.centos Dependency Installed: apr.x86_64 0:1.3.9-5.el6_2 apr-util.x86_64 0:1.3.9-3.el6_0.1 apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 httpd-tools.x86_64 0:2.2.15-45.el6.centos Complete!
》》》》》》》》》》》》》》》》HTTPD 服务安装成功!《《《《《《《《《《《《《《《《《《《《
如果有输出内容和上述相同,说明你的yum源配置成功了