符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
这篇文章主要介绍了rhel6.3中yum源如何配置,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
10年的灵川网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站的优势是能够根据用户设备显示端的尺寸不同,自动调整灵川建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联公司从事“灵川网站设计”,“灵川网站推广”以来,每个客户项目都认真落实执行。
环境:RHEL6.3
创建本地yum源步骤如下:
1、首先检查是否有YUM命令,如果没有请安装
#rpm -ivh yum-3.2.29-30.el6.noarch.rpm
再次检查是否有createrepo,如果没有请安装createrepo包,装这个包之前先装以下两个包;
[root@localhost Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@localhost Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[root@localhost Packages]#rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm
2、新建本地源目录
#mkdir /Packages #存放本地YUM所需的文件
将光盘上的Packages下的所有安装包都放置到这个目录中,还有把光盘上的RPM-GPG-KEY-redhat-release也拷贝到这个目录中
3. 在/Packages 目录下,执行createrepo /Packages
2842/2842 - xorg-x11-fonts-misc-7.2-9.1.el6.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
会生成 repodata目录,并有四个关键文件,现在查看一下
[root@localhost Packages]# ls -d */
HighAvailability/ images/ isolinux/ LoadBalancer/ repodata/
[root@localhost Packages]# cd repodata
[root@localhost repodata]# ls
filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml
注:repodata作为软件的仓库,其目录下有四个必要文件:filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml(md意思是metadata),其中最主要的是repomd.xml文件。一般出现的找不到repodata目录或文件的错误的原因通常有三个:一是路径问题;二是没有生成repodata目录;三是*.repo配置文件冲突(这个需要特别注意,需要将/etc/yum.repos.d下的其他repo文件的enabled=0设置或者删除其他的repo文件)。以上四个文件要建立yum库后才会出现,在下面的示例中,路径为:/Packages /repodata/
4. 在/etc/yum.repos.d下新建一个yum.repo。内容如下:
[RHEL]
name=rhel6.3
baseurl=file:///Packages
gpgcheck=1
gpgkey=file:///Packages/RPM-GPG-KEY-redhat-release
enabled=1
解释:
[....] 代表这个库的名字,必须是唯一的,不可以重复。
name= 是这个库的说明,没有太大的实际意义,只是一个字段说明。
baseurl= 说明采取什么方式传输,具体路径在哪里,可以使用的方式有,file://,ftp://,http://等
enabled=1 说明启用这个更新库,0表示不启用。
gpgcheck=0 表示不使用gpg文件来检查软件包的签名 1表示使用签名
gpgkey= 表示gpg文件所存放的位置,此处也可以有http方式的位置。
到此就可以测试yum库创建是否成功了。
5、测试一下
[root@localhost /]# yum -y install telnet*
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.i686 1:0.17-47.el6 will be installed
---> Package telnet-server.i686 1:0.17-47.el6 will be installed
--> Processing Dependency: xinetd for package: 1:telnet-server-0.17-47.el6.i686
--> Running transaction check
---> Package xinetd.i686 2:2.3.14-34.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
telnet i686 1:0.17-47.el6 RHEL 57 k
telnet-server i686 1:0.17-47.el6 RHEL 36 k
Installing for dependencies:
xinetd i686 2:2.3.14-34.el6 RHEL 121 k
Transaction Summary
===============================================================================================
Install 3 Package(s)
Total download size: 214 k
Installed size: 409 k
Downloading Packages:
Error Downloading Packages:
1:telnet-0.17-47.el6.i686: failure: Packages/telnet-0.17-47.el6.i686.rpm from RHEL: [Errno 256] No more mirrors to try.
2:xinetd-2.3.14-34.el6.i686: failure: Packages/xinetd-2.3.14-34.el6.i686.rpm from RHEL: [Errno 256] No more mirrors to try.
1:telnet-server-0.17-47.el6.i686: failure: Packages/telnet-server-0.17-47.el6.i686.rpm from RHEL: [Errno 256] No more mirrors to try.
发现安装失败,没有自己发现软件包之间的依赖关系。更新一下
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning repos: RHEL
Cleaning up Everything
然后再装,就可以了
[root@localhost yum.repos.d]# yum -y install telnet*
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
RHEL | 1.3 kB 00:00 ...
RHEL/primary | 1.3 MB 00:00 ...
RHEL 2842/2842
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.i686 1:0.17-47.el6 will be installed
---> Package telnet-server.i686 1:0.17-47.el6 will be installed
--> Processing Dependency: xinetd for package: 1:telnet-server-0.17-47.el6.i686
--> Running transaction check
---> Package xinetd.i686 2:2.3.14-34.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
telnet i686 1:0.17-47.el6 RHEL 57 k
telnet-server i686 1:0.17-47.el6 RHEL 36 k
Installing for dependencies:
xinetd i686 2:2.3.14-34.el6 RHEL 121 k
Transaction Summary
===============================================================================================
Install 3 Package(s)
Total download size: 214 k
Installed size: 409 k
Downloading Packages:
-----------------------------------------------------------------------------------------------
Total 4.1 MB/s | 214 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 2:xinetd-2.3.14-34.el6.i686 1/3
Installing : 1:telnet-server-0.17-47.el6.i686 2/3
Installing : 1:telnet-0.17-47.el6.i686 3/3
Installed products updated.
Verifying : 1:telnet-server-0.17-47.el6.i686 1/3
Verifying : 2:xinetd-2.3.14-34.el6.i686 2/3
Verifying : 1:telnet-0.17-47.el6.i686 3/3
Installed:
telnet.i686 1:0.17-47.el6 telnet-server.i686 1:0.17-47.el6
Dependency Installed:
xinetd.i686 2:2.3.14-34.el6
Complete!
做一下YUM的缓存,方便加速
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
RHEL | 1.3 kB 00:00 ...
RHEL/filelists | 2.9 MB 00:00 ...
RHEL/other | 1.3 MB 00:00 ...
RHEL 2842/2842
RHEL 2842/2842
Metadata Cache Created
提醒注意:yum install [软件名] 这里最好不要用全名,虽然有些包的安装也是可以的。但是本人测试,遇到安装失败的麻烦。
一些有用的YUM命令:
yum remove | erase 软件名1 [软件名2] [...]
yum list [...]
yum info [...]
yum provides | whatprovides feature1 [feature2] [...]
yum clean [ packages | headers | metadata | dbcache | all ]
yum makecache
自动分析依赖性关系是YUM最好的一个特点,也是目前最方便的安装方法。
用的上的命令
createrepo --update /Packages/ # 更新本地源,如果新增了RPM包
createrepo /Packages/ # 重新生成metadata
createrepo --update:
有时候你的软件仓库中含有很多的软件包,虽然只是其中的一小部分有所改动但是你却不必为每个软件包重新产生元数据,这样做明显太浪费时间了。createrepo只更新那些在上次产生元数据之后被改变,添加或者删除了的项目.
使用ftp做 yum源
上面的设置只能使本机使用yum源,为了使其他机器也可以使用,所以在源机器上配置ftp server
1. yum install vsftpd
2. 在其他机器上通过ftp命令访问测试,如果出现500 OOPS: cannot change directry, 那么在源机器执行setsebool -P ftp_home_dir on, 然后service vsftpd restart
3. 在 /var/ftp/pub 下面做mount, 而不是做符号链接,因为如果是符号链接那么从浏览器访问会出现550 Failed to change directory.当然也可以把/Packages下的所有拷贝到pub下。
#mkdir /rh75
#umount /dev/sr0
# mount /dev/sr0 /rh75
cd /var/ftp/pub , mkdir yum, mount --bind /rh75 yum
4. 设置yum ftp连接方式(包括源机器也可以这样设置,两边的repo可以一样)
/etc/yum.repos.d下修改一下yum.repo
[RHEL1]
name=rhel6.3
baseurl=ftp://192.168.1.130/pub/yum/
gpgcheck=0
enabled=1
使用HTTP做YUM源
1 安装httpd安装包 #yum -y install httpd
2 如上创建本地更新源
#cd /var/www/html/
#mkdir yum
# mount --bind /rh75 /yum
或者比如yum文件都在/rh75下
[root@localhost html]# vi /etc/yum.repos.d/yum.repo
[root@localhost html]# cat /etc/yum.repos.d/yum.repo
[RHEL]
name=rhel6.3
baseurl=http://192.168.1.130/yum/
gpgcheck=0
enabled=1
3 service httpd start #启动httpd守护进程,否则在其他机器上会提示找不到相关源
4 测试一下
[root@localhost yum.repos.d]# rpm -qa|grep telnet
[root@localhost yum.repos.d]# yum -y install telnet*
Installed:
telnet.i686 1:0.17-47.el6 telnet-server.i686 1:0.17-47.el6
Dependency Installed:
xinetd.i686 2:2.3.14-34.el6
Complete!
使用ISO光盘直接挂成本地YUM源
1、先把ISO光盘挂接到系统,然后mount看一下
[root@localhost network-scripts]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sr0 on /media/RHEL_6.3 i386 Disc 1 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)
2、接着在根下或在其他目录建一个目录
#cd /
#mkdir rhel6
#umount /dev/sr0
# mount /dev/sr0 /rhel6
3、编辑REPO文件
#cd /etc/yum.repos.d
#vi yum.repo
[RHEL]
name=rhel6.3
baseurl=file:///rhel6 (如果是rhel5,则是file:///rhel5/Server,因为repodata/repomd.xml不在光盘根下)
enabled=1
# service iptables stop
# setenforce 0
# yum -y install telnet
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
RHEL | 4.0 kB 00:00 ...
RHEL/primary_db | 2.5 MB 00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.i686 1:0.17-47.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
telnet i686 1:0.17-47.el6 RHEL 57 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 57 k
Installed size: 102 k
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Public key for telnet-0.17-47.el6.i686.rpm is not installed
注意这是出现NOKEY错误,检查YUM.REPO文件没有问题,那么需要看yum.conf主配文件
#cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
将/etc/yum.conf中的gpgcheck=1改为gpgcheck=0(不检查软件包签名)即可。
注:在做YUM源时,确保源和使用源的LINUX主机的REPO文件和yum.conf文件配置一致。
最后再试就正常了
#yum -y install telnet
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:telnet-0.17-47.el6.i686 1/1
Installed products updated.
Verifying : 1:telnet-0.17-47.el6.i686 1/1
Installed:
telnet.i686 1:0.17-47.el6
Complete!
vim /etc/udev/rules.d/70-persistent-net.rules
vim /etc/sysconfig/network-scripts/ifcfg-eth0
感谢你能够认真阅读完这篇文章,希望小编分享的“rhel6.3中yum源如何配置”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!