CentOS6.x和CentOS7.x字符界面安装图形界面方法

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

测试yum

一、CentOS 6.x字符界面安装图形界面方法

#mount /dev/sr0 /mnt                       \ 把光盘挂载到“/mnt”上面
#df                                                  \查看是否已经挂载

太阳集团所有网址16877 1

systemctl set-default graphical.target \设置默认图形化运行级别
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'
[root@localhost Desktop]# systemctl get-default                    \查看默认运行级别
graphical.target                                                    \图形化设置OK
[root@localhost Desktop]#

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-10/147646.htm

CentOS的yum源对应CentOS的源

1、配置好yum源,可以使用光盘镜像源(配置方法同centos6.x),也可以使用网络源,这里同样使用国内的阿里源作为实例,执行下面的命令即可配置成功。
wget -O /etc/yum.repos.d/CentOS-Base.repo
 
2、通过 yum 为纯字符系统,安装图形化桌面
[root@localhost ~]# yum groupinstall "X Window System""GNOME Desktop" kde-l10n-Chinese
 
3、当以上的三个软件包组都安装成功之后,执行startx即可进入图形化桌面。
[root@localhost ~]# startx
[root@localhost ~]# systemctl get-default    查看默认的运行级别
multi-user.target
[root@localhost ~]# cat /etc/inittab
……………………………..省略若干
# multi-user.target: analogous to runlevel 3      运行级别3:多用户界面
# graphical.target: analogous to runlevel 5      运行级别5:图形化界面
 
[root@localhost ~]# systemctl set-default graphical.target  设置默认图形化运行级别
[root@localhost ~]# systemctl get-default          查看默认的运行级别
graphical.target
[root@localhost ~]# systemctl set-default  multi-user.target  设置默认字符界面运行级别
[root@localhost ~]# systemctl get-default    查看默认的运行级别
multi-user.target
 
4、修改永久主机名不再使用/etc/sysconfig/network 在centos7中修改主机名有以下几种方法
方法1
修改主机名配置文件/etc/hostname可以进行vi编辑主机名,然后执行bash命令立即永久生效
 
方法2
hostnamectl set-hostname “更改的主机名”
然后执行bash命令立刻永久生效
 
方法3
使用nmtui命令执行后会弹出窗口然后可以编辑网卡和主机名等信息,修改好之后保存退出,然后执行bash命令即可立刻永久生效

yum makecache

1、配置好yum源,可以使用光盘镜像源,也可以使用网络源都可以
(1)配置本地光盘镜像源方法
    [root@centos6 ~]# cd /etc/yum.repos.d/
    [root@centos6yum.repos.d]# mkdir back
    [root@centos6yum.repos.d]# mv * back/  备份yum文件到创建的目录
      mv: 无法将目录"back"移动至自身的子目录"back/back" 下
    [root@centos6yum.repos.d]# mv back/CentOS-Media.repo ./
    [root@centos6yum.repos.d]# vim CentOS-Media.repo  把这个文件修改成如下
    [c6-media]
    name=CentOS-$releasever- Media
    baseurl=file:///media/dvd1
            file:///media/dvd2
      gpgcheck=0
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
                                                                                   
    :wq
    [root@centos6yum.repos.d]# mkdir /media/dvd1 /media/dvd2
    [root@centos6yum.repos.d]# mount /dev/sr0 /media/dvd1  这里需要挂载使用两张光盘
    [root@centos6yum.repos.d]# mount /dev/sr1 /media/dvd2
 
  (2)配置网络源的方法,这里我们就使用国内阿里的源作为例子,在centos6.x中执行下面的命令即        可自动配置成功
      wget -O/etc/yum.repos.d/CentOS-Base.repo
 
2、通过 yum 为纯字符系统,安装图形化桌面
  [root@centos6~]# yum -y install xorg*
[root@centos6 ~]# yum -y groupinstall "X Window System"
[root@centos6 ~]# yum -y groupinstall Desktop
[root@centos6 ~]# yum -y groupinstall "Chinese Support"
以上软件包和软件包组安装完成之后,图形化桌面就安装完成了,我们执行startx即可启动图形化桌面环境
[root@centos6 ~]# startx  或使用 init 5
如果想开机自动启动图形化桌面,则需要更改/etc/inittab文件中的默认启动级别为5即可
[root@centos6 ~]# vim /etc/inittab
id:5:initdefault:
:wq
 
二、CentOS 7.x字符界面安装图形界面方法

enabled=1

太阳集团所有网址16877 2

太阳集团所有网址16877,ISO挂载

[root@localhost Desktop]# systemctl get-default          \查看默认运行级别
multi-user.target
[root@localhost Desktop]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3                \运行级别3:多用户界面
# graphical.target: analogous to runlevel 5                  \运行级别5:图形化界面
# # To set a default target, run: # # ln -sf /lib/systemd/system/.target

vi /etc/yum.repo.cdrom.repo

启动图形化startx

此组件列表是RHEL6.5的ISO源--X Window System,Centos6.5图形化组件--Server with GUI
[root@jiao ~]# yum grouplist  #查看群组件
Loaded plugins: fastestmirror
Setting up Group Process
Repository 'rhel' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
rhel/group_gz                                      | 204 kB    00:00 ...
Installed Groups:
  Additional Development
  E-mail server
  General Purpose Desktop
  Graphical Administration Tools
  Legacy X Window System compatibility
  Perl Support
  Security Tools
  Web Server
Available Groups:
  Backup Client
  Backup Server
  Base
  CIFS file server
  Client management tools
  Compatibility libraries
  Console internet tools
  Debugging Tools
  Desktop
  Desktop Debugging and Performance Tools
  Desktop Platform
  Desktop Platform Development
  Development tools
  Dial-up Networking Support
  Directory Client
  Directory Server
  Eclipse
  Emacs
  FCoE Storage Client
  FTP server
  Fonts
  Graphics Creation Tools
  Hardware monitoring utilities
  Identity Management Server
  Infiniband Support
  Input Methods
  Internet Browser
  Java Platform
  KDE Desktop
  Large Systems Performance
  Legacy UNIX compatibility
  Mainframe Access
  Messaging Client Support
  MySQL Database client
  MySQL Database server
  NFS file server
  Network Infrastructure Server
  Network Storage Server
  Network file system client
  Networking Tools
  PHP Support
  Performance Tools
  PostgreSQL Database client
  PostgreSQL Database server
  Print Server
  Printing client
  Remote Desktop Clients
  Ruby Support
  SNMP Support
  Scientific support
  Server Platform
  Server Platform Development
  Smart card support
  Storage Availability Tools
  System Management
  System administration tools
  TeX support
  Technical Writing
  TurboGears application framework
  Virtualization
  Virtualization Client
  Virtualization Platform
  Virtualization Tools
  Web Servlet Engine
  Web-Based Enterprise Management
  X Window System
  iSCSI Storage Client
Available Language Groups:
  Afrikaans Support [af]
  Albanian Support [sq]
  Amazigh Support [ber]
   
 #yum -y groupinstall "Server with GUI"      \ 安装图形化程序组

01、挂载ISO配置本地yum源

我演示的CentOS 6.5,我挂载的RHEL6.5的源。作为软件源,仅作思路梳理!

本文由太阳集团所有网址16877发布于www.16877.com,转载请注明出处:CentOS6.x和CentOS7.x字符界面安装图形界面方法

您可能还会对下面的文章感兴趣: