Centos挂载镜像制作本地yum源,并补装图形界面
- 内网环境centos7.9安装图形页面
- 内网环境制作本地yum源
- 上传镜像到服务器目录
- 创建目录并挂载镜像
#创建目录
cd /mnt/
mkdir iso
#挂载
mount -o loop ./CentOS-7-x86_64-DVD-2009.iso ./iso #前面镜像所在目录,后面所挂载得目录
#检查
[root@localhost mnt]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 189G 0 189G 0% /dev
tmpfs 189G 0 189G 0% /dev/shm
tmpfs 189G 115M 188G 1% /run
tmpfs 189G 0 189G 0% /sys/fs/cgroup
/dev/mapper/centos-root 500G 10G 490G 2% /
/dev/sda2 10G 143M 9.9G 2% /boot
/dev/sda1 10G 12M 10G 1% /boot/efi
/dev/mapper/centos-opt 243G 476M 243G 1% /opt
/dev/mapper/centos-home 20G 33M 20G 1% /home
/dev/mapper/centos-var 100G 243M 100G 1% /var
tmpfs 38G 0 38G 0% /run/user/0
tmpfs 38G 0 38G 0% /run/user/1000
/dev/loop0 4.4G 4.4G 0 100% /mnt/iso
- yum源制作
#备份yum源
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak/
配置yum源
cp -r ./bak/CentOS-Media.repo ./
vim CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-7. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/iso/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#修改得两处地方
file:///mnt/iso/
enabled=1
- 清除缓存及测试
yum clean all
yum repolist
yum -y install vim
- 安装GNOME图形界面
yum groupinstall "Server with GUI" #运行以下命令以安装 GNOME 桌面环境(示例)
#设置默认启动模式:更新系统的默认启动目标,使系统在启动时自动进入图形界面。运行以下命令:
systemctl set-default graphical.target
#重启服务
reboot
- 安装KDE图形界面
#安装KED界面
yum -y install kde*
#重启服务器
reboot
根据自己的需求安装图形页面,研发反馈KDE更好用