您好,登录后才能下订单哦!
本地yum仓库搭建:
系统:Centos6.5
去阿里镜像下载Centos6的yum源,安装系统eple-release源:
#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo #yum install epel-release -y
安装nginx服务和createrepo 创建yum仓库的命令:
#yum install nginx -y # yum install createrepo
创建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文件备份.
#mv default.conf default.conf.bak
创建nginx yum.conf文件配置:
server { listen 80; server_name _; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root /data/yum_repo/rhel6_64; } }
编辑nginx.conf文件,开启文件浏览功能,方便web访问yum源,查看是否正确:
http { autoindex on; #开启nginx目录浏览功能 autoindex_exact_size off; #文件大小从KB开始显示 autoindex_localtime on; #显示文件修改时间为服务器本地时间 }
启动nginx服务:
#/etc/init.d/nginx start
web访问nginx地址可以看到软件包目录:
yum源文件配置:
# cat cc.repo [rhrl] name=rhel baseurl=http://192.168.30.128/Packages/ enabled=1 #是否开启仓库,1为开启,0为关闭 gpgcheck=0 #是否检查gpgkey,1为开启,0为关闭
#yum clean all 清除yum机制的本地缓存的 #yum makecache yum服务器上的软件包信息缓存本地;作用以提高搜索安装软件的速度
确认系统中未安装apache软件包,并执行安装,确认yum仓库是否可以提供服务:
#rpm -qa httpd #yum install httpd -y
安装软件包测试yum源是否ok:
更新本地yum源
将定制的软件包放入本地yum仓库,并更新yum源仓库:
[root@sh-puppet-master ~]# mv java-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/ Spawning worker 0 with 1 pkgs Workers Finished Gathering worker results Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete
请本地缓存,缓存yum服务器最新的软件包(如果不清本地缓存,看不到新添加的软件包)
# yum clean all # yum makecache
卸载系统中已存在的java软件包:
yum remove -y java
查看yum源中是否存在自定制的java软件包:
[root@sh-puppet-master ~]# yum list java Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Available Packages java.x86_64 1.7.0_80-1
安装java软件包:
[root@sh-puppet-master ~]# yum install java.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 export JAVA_HOME=/usr/local/java export JRE_HOME=/usr/local/java/jre export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$PATH [root@sh-puppet-master ~]# source /etc/profile [root@sh-puppet-master ~]# java -version java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。