1、说明
虚拟机上安装 redhat6.3sever版本的系统,该系统安装完毕后只具备命令行界面,而不具备图形界面。
我选择配置本地yum源再用本地yum源安装图形界面的方式。
2、用本地文件创建本地yum源
VMware下的虚拟光驱位于/dev/sr0,所以,只需在redhat系统下挂载VMware中作为yum源的redhat6.3镜像,就可以配置yum库了。具体步骤及相关代码如下:
1、挂载镜像
[root@localhost~]# mkdir /mnt/iso
[root@localhost~]# mount -o loop /dev/sr0 /mnt/iso
2、修改/etc/fstab配置文件使redhat镜像能开机自动挂载
[root@localhost~]#vi /etc/fstab
#在/etc/fstab的最下面添加下面一句
/dev/sr0 /mnt/iso iso9660 ro,loop 0 0
3、编辑/etc/yum.repos.d/local.repo配置文件,新建一个本地repo文件
[root@localhost~]#vi /etc/yum.repos.d/local.repo
[Server]
name=Server
baseurl=file:///mnt/iso/Server
enabled=1
gpgcheck=0
[HighAvailability]
name=HighAvailability
baseurl=file:///mnt/iso/HighAvailability
enabled=1
gpgcheck=0
[LoadBalancer]
name=LoadBalancer
baseurl=file:///mnt/iso/LoadBalancer
enabled=1
gpgcheck=0
4、测试yum源是否设置完成,使用yum list即可查看是否存在大量安装软件
[root@localhost iso]# yum list|grep ftp
至此,本地yum源配置完成,可以利用本地yum源安装必要软件。
3、利用本地yum源为Linux系统安装图形界面
3.1、说明
区别于redhat5系统,Redhat6版本的桌面在软件组desktop中,在开始安装桌面前必须先安装Xwindow软件组;
3.2、安装图形界面,步骤及相关代码如下
1、检查软件组,查看桌面位于哪个软件组里
[root@localhost~]#yumgrouplist
Loadedplugins: refresh-packagekit
Setting up Group Process
Installed Groups:
Additional Development
……
Desktop
Desktop Debugging and Performance Tools
……
X WindowSystem
……
2、安装图形界面软件组
[root@localhost~]#yum groupinstall “X Window System”
[root@localhost ~]#yumgroupinstall “Desktop”
3、创建一个普通用户避免使用root用户直接登录图形界面
[root@localhost~]# useraddfieldyang
创建fieldyang的密码
[root@localhost~]# passwdfieldyang
4、启动图形界面
[root@localhost~]# su -fieldyang
[fieldyang@localhost~] $startx
至此图形界面安装完毕,启动后即可直接切换至图形界面。
5、为了在图形见面进行一些必要操作以简化过程,此处更改启动模式,调整开机时默认启动方式为图形桌面,通过修改配置文件/etc/inittab即可
打开终端,输入“ vim /etc/inittab”,回车;
找到id:3:initdefault:
修改默认启动方式值为5,即“id:5:initdefault:”;
Esc退出插入模式后输入“:wq”保存退出;
[root@localhost ~]#vim /etc/inittab
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not havenetworking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
【附】、centos6.5配置本地yum源
1、挂载镜像并设置开机自动挂载
[[email protected]]# mkdir /mnt/iso
[[email protected]]# mount -o loop /dev/sr0 /mnt/iso
[[email protected]]# df -h
[[email protected]]# vi /etc/fstab
#
# /etc/fstab
# Created byanaconda on Mon Jun 6 08:22:55 2016
#
# Accessiblefilesystems, by reference, are maintained under '/dev/disk'
# See manpages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=87e997b7-b9b4-49b9-83ca-f37548b7e71e/ ext4 defaults 1 1
UUID=f60df2aa-3a58-43e3-9f73-30ea7d87993d/boot ext4 defaults 1 2
UUID=2c43c63f-d338-4ab2-bc58-541771ced9df/home ext4 defaults 1 2
UUID=45569a42-6750-4280-8a9f-26dd0fefaa7fswap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sr0 /mnt/iso iso9660 ro,loop 0 0
~
2、创建本地repos.d文件并使之生效
[[email protected]]# cd /etc/yum.repos.d/
[[email protected]]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[[email protected]]# mv CentOS-Base.repo CentOS-Base.repo.bak
#使默认yum源失效
CentOS-Base.repo.bak CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[[email protected]]# vim CentOS6.5-Media.repo
[c6-media]
name=CentOS-$releasever- Media
#本地yum源名称(可随意修改)
baseurl=file:///mnt/iso
#光盘挂载目录/mnt/iso
gpgcheck=1
enabled=1
#使用此yum源(等于0为不启用)
gpgkey=file:///mnt/sr0/RPM-GPG-KEY-CentOS-6
#本地yum源密钥
3、查看成功与否
[root@localhost yum.repos.d]# yum list | grephttpd
Repositoryc6-media is listed more than once in the configuration
httpd.x86_64 2.2.15-29.el6.centos @base/$releasever
httpd-tools.x86_64 2.2.15-29.el6.centos @base/$releasever