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
- Mount-t Iso9660-o Loop/usr/local/src/rhel-server-7.0-x86_64-dvd.iso/media/cdrom #挂载系统镜像
- 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
- Vi/etc/fstab #添加以下代码. Enable automatic mount on boot
- /usr/local/src/rhel-server-7.0-x86_64-dvd.iso/media/cdrom iso9660 defaults,ro,loop 0 0
- : wq! #保存退出
Note: iso9660 use df-t to view devices
5. Configure local Yum Source
- Cd/etc/yum.repos.d/#进入yum配置目录
- Touch Rhel-media.repo #建立yum配置文件
- VI Rhel-media.repo #编辑配置文件, add the following:
- [Rhel-media]
- Name=Red Hat Enterprise Linux 7.0 #自定义名称
- Baseurl=file:///media/cdrom #本地光盘挂载路径
- enabled=1 #启用yum源, 0 is not enabled, 1 is enabled
- gpgcheck=1 #检查GPG-key,0 for no check, 1 for inspection
- gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release #GPG-key Path
- : wq! #保存退出
6. Install the software automatically using the Yum command
- Yum Clean all #清除yum缓存
Yum Makecache #缓存本地yum源中的软件包信息
- Yum Install httpd #安装apache
- RPM-QL httpd #查询所有安装httpd的目录和文件
- Systemctl Start Httpd.service #启动apache
- Systemctl Stop Httpd.service #停止apache
- Systemctl Restart Httpd.service #重启apache
- Systemctl Enable Httpd.service #设置开机启动
RHEL 7.0 defaults to using firewall as the firewall, where the iptables firewall is changed.
Close firewall:
- Systemctl Stop Firewalld.service #停止firewall
- Systemctl Disable Firewalld.service #禁止firewall开机启动
- Yum Install iptables-services #安装iptables
- Vi/etc/sysconfig/iptables #编辑防火墙配置文件
- # Firewall configuration written by System-config-firewall
- # Manual Customization of this file are not recommended.
- *filter
- : INPUT ACCEPT [0:0]
- : FORWARD ACCEPT [0:0]
- : OUTPUT ACCEPT [0:0]
- -A input-m state--state established,related-j ACCEPT
- -A input-p icmp-j ACCEPT
- -A input-i lo-j ACCEPT
- -A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
- -A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
- -A input-j REJECT--reject-with icmp-host-prohibited
- -A forward-j REJECT--reject-with icmp-host-prohibited
- COMMIT
- : 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