Establishment of Yum repository under Linux system and establishment of directory sharing (script file)

Source: Internet
Author: User

Vim yum.sh # #建立脚本文件


*!/bin/bash
################ #creat local yum source############
Mkdir/westos # #建立挂载点
Mount/iso/rhel-server-7.0-x86_64-dvd.iso/westos # #将镜像文件挂哉在建立文件案目录剧下
Mkdir/backup
mv/etc/yum.repos.d/*/backup # #将干扰文件放在其他新建的目录下
Cat >/etc/yum.repos.d/yum.repo << End # # Edit Yum.repo
[Test]
Name=test
Baseurl=file:///westos
Gpgcheck=0
End
Yum Clean All # #刷新仓库配置################### #install Share server##########
Yum Intall httpd-y # #安装http
Systemctl Start httpd # #开启http指令
Systemctl Enable httpd
Systemctl Disable FIREWALLD # #表示开机就关闭防火墙
Systemctl Stop Firewalld
################## #mount ISO to share directory##########
Umount Westos # #弹出westos挂载点
mkdir/var/www/html/rehl7.0 # #新建在共享文当下的目录
mount/iso/rhel-server-7.0-x86_64-dvd.iso/var/www/html/rhel7.0 # #重新挂载
echo "/iso/rhel-server-7.0-x86_64-dvd.iso/var/www/html/rhel7.0 iso9660 ro 0 0" >>

/etc/fstab # #mount为临时挂载, to change the mount to permanent the configuration file needs to be changed (>> Plus additional content)

############### #cofig Local yum##############
Rm-fr/etc/yum.repos.d/yum.repo
Cat >/etc/yum.repos.d/yum.repo << End # #重新编辑yum. repo file
[Test]
Name=test
baseurl=file:///var/www/html/rhel7.0 # #路径改变
Gpgcheck=0
End


A script to create a yum shared directory is written, and you can see the shared directory by typing the address on the browser.

You should be aware of two ways to write URLs on your browser

: file:///var/www/html/rhel7.0 (the root of the machine is represented by the third/number)

: http://172.25.39.172 (IP of the Access host)/rhel7.0 (IP back/number indicates the root directory of Apache)


This article from "11897256" blog, declined reprint!

Establishment of Yum repository under Linux system and establishment of directory sharing (script file)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.