Rhel Configuring local Yum sources with system image files

Source: Internet
Author: User

1. Upload the system image file Rhel-server-7.0-x86_64-dvd.iso to the/USR/LOCAL/SRC directory using the WinSCP.exe tool

2. Remotely connect to the RHEL server using the Putty.exe tool

3. Mount the system image file

    • Mkdir/media/cdrom #新建镜像文件挂载目录
    • CD/USR/LOCAL/SRC #进入系统镜像文件存放目录
    • LS #列出目录文件, you can see the system image file just uploaded
    1. Mount-t Iso9660-o Loop/usr/local/src/rhel-server-7.0-x86_64-dvd.iso/media/cdrom #挂载系统镜像
    2. Cd/media/cdrom #进入挂载目录, use the LS command to see that a file already exists.

Remark: Umount/media/cdrom #卸载系统镜像

4. Set up automatic mount system image file on boot

    1. Vi/etc/fstab #添加以下代码. Enable automatic mount on boot
    2. /usr/local/src/rhel-server-7.0-x86_64-dvd.iso/media/cdrom iso9660 defaults,ro,loop 0 0
    3. : wq! #保存退出

Note: iso9660 use df-t to view devices

5. Configure local Yum Source

  1. Cd/etc/yum.repos.d/#进入yum配置目录
  2. Touch Rhel-media.repo #建立yum配置文件
  3. VI Rhel-media.repo #编辑配置文件, add the following:
  4. [Rhel-media]
  5. Name=Red Hat Enterprise Linux 7.0 #自定义名称
  6. Baseurl=file:///media/cdrom #本地光盘挂载路径
  7. enabled=1 #启用yum源, 0 is not enabled, 1 is enabled
  8. gpgcheck=1 #检查GPG-key,0 for no check, 1 for inspection
  9. gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release #GPG-key Path
  10. : wq! #保存退出

6. Install the software automatically using the Yum command

    1. Yum Clean all #清除yum缓存

Yum Makecache #缓存本地yum源中的软件包信息

    1. Yum Install httpd #安装apache
    2. RPM-QL httpd #查询所有安装httpd的目录和文件

    1. Systemctl Start Httpd.service #启动apache
    2. Systemctl Stop Httpd.service #停止apache
    3. Systemctl Restart Httpd.service #重启apache
    4. Systemctl Enable Httpd.service #设置开机启动

RHEL 7.0 defaults to using firewall as the firewall, where the iptables firewall is changed.

Close firewall:

  1. Systemctl Stop Firewalld.service #停止firewall
  2. Systemctl Disable Firewalld.service #禁止firewall开机启动
  3. Yum Install iptables-services #安装iptables
  4. Vi/etc/sysconfig/iptables #编辑防火墙配置文件
  5. # Firewall configuration written by System-config-firewall
  6. # Manual Customization of this file are not recommended.
  7. *filter
  8. : INPUT ACCEPT [0:0]
  9. : FORWARD ACCEPT [0:0]
  10. : OUTPUT ACCEPT [0:0]
  11. -A input-m state--state established,related-j ACCEPT
  12. -A input-p icmp-j ACCEPT
  13. -A input-i lo-j ACCEPT
  14. -A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
  15. -A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
  16. -A input-j REJECT--reject-with icmp-host-prohibited
  17. -A forward-j REJECT--reject-with icmp-host-prohibited
  18. COMMIT
  19. : wq! #保存退出
    • Systemctl Start Iptables.service #启动防火墙
    • Systemctl Stop Iptables.service #停止防火墙
    • Systemctl Restart Iptables.service #重启防火墙
    • Systemctl Status Iptables.service #查看防火墙状态
    • Systemctl Enable Iptables.service #设置开机启动

Rhel Configuring local Yum sources with system image files

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.