本地yum仓库搭建:
系统:Centos6.5
去阿里镜像下载Centos6的yum源,安装系统eple-release源:
#wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-6.repo #yuminstallepel-release-y
安装Nginx服务和createrepo 创建yum仓库的命令:
#yuminstallNginx-y #yuminstallcreaterepo
创建yum仓库/data/yum_repo/rhel6_64,和cdrom挂在点:
#mkdir/data/yum_repo/rhel6_64-p #mkdir/mnt/cdrom
将光盘CD挂在到/mnt/cdrom/目录下:
#mount/dev/cdrom/mnt/cdrom/
copy CD中的rpm包到刚创建好的本地yum仓库目录:
#cp/mnt/cdrom/Packages/*/data/yum_repo/rhel6_64/Packages/
将rpm包做成yum仓库的软件包:
#createrepo/data/yum_repo/rhel6_64/Packages/
yum仓库Nginx资源映射:
将默认的default.conf文件备份.
#mvdefault.confdefault.conf.bak
server{ listen80; server_name_; #Loadconfigurationfilesforthedefaultserverblock. include/etc/Nginx/default.d/*.conf; location/{ root/data/yum_repo/rhel6_64; } }
编辑Nginx.conf文件,开启文件浏览功能,方便web访问yum源,查看是否正确:
http{ autoindexon;#开启Nginx目录浏览功能 autoindex_exact_sizeoff;#文件大小从KB开始显示 autoindex_localtimeon;#显示文件修改时间为服务器本地时间 }
启动Nginx服务:
#/etc/init.d/Nginxstart
web访问Nginx地址可以看到软件包目录:
yum源文件配置:
#catcc.repo [rhrl] name=rhel baseurl=http://192.168.30.128/Packages/ enabled=1#是否开启仓库,1为开启,0为关闭 gpgcheck=0#是否检查gpgkey,1为开启,0为关闭
#yumcleanall清除yum机制的本地缓存的 #yummakecacheyum服务器上的软件包信息缓存本地;作用以提高搜索安装软件的速度
确认系统中未安装apache软件包,并执行安装,确认yum仓库是否可以提供服务:
#rpm-qahttpd #yuminstallhttpd-y
安装软件包测试yum源是否ok:
更新本地yum源
将定制的软件包放入本地yum仓库,并更新yum源仓库:
[root@sh-puppet-master~]#mvjava-1.7.0_80-1.x86_64.rpm/data/yum_repo/rhel6_64/Packages/ [root@sh-puppet-master~]#createrepo--update/data/yum_repo/rhel6_64/Packages/ Spawningworker0with1pkgs WorkersFinished Gatheringworkerresults SavingPrimaryMetadata SavingfilelistsMetadata SavingotherMetadata GeneratingsqliteDBs sqliteDBscomplete
请本地缓存,缓存yum服务器最新的软件包(如果不清本地缓存,看不到新添加的软件包)
#yumcleanall #yummakecache
卸载系统中已存在的java软件包:
yumremove-yjava
查看yum源中是否存在自定制的java软件包:
[root@sh-puppet-master~]#yumlistjava Loadedplugins:fastestmirror,security Loadingmirrorspeedsfromcachedhostfile AvailablePackages java.x86_641.7.0_80-1
安装java软件包:
[root@sh-puppet-master~]#yuminstalljava.x86_64-y
#确实是否时自己定制的java版本,java是否安装完成.
[root@sh-puppet-master~]#ls/etc/profile.d/java.sh /etc/profile.d/java.sh [root@sh-puppet-master~]#cat/etc/profile.d/java.sh exportJAVA_HOME=/usr/local/java exportJRE_HOME=/usr/local/java/jre exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH exportPATH=$JAVA_HOME/bin:$PATH [root@sh-puppet-master~]#source/etc/profile [root@sh-puppet-master~]#java-version javaversion"1.7.0_80" Java(TM)SERuntimeEnvironment(build1.7.0_80-b15) JavaHotSpot(TM)64-BitServerVM(build24.80-b11,mixedmode)原文链接:https://www.f2er.com/bash/392327.html