虛擬機(jī)里裝了CentOS 7的系統(tǒng)。裝好之后發(fā)現(xiàn)啟動默認(rèn)是命令行界面,想要改成默認(rèn)圖形界面啟動。這就需要安裝額外的軟件比如GNOME Desktop。所以第一步要先配置本地repo source:
使用DVD創(chuàng)建本地YUM Repository
創(chuàng)建源
把CD/DVD ROM 掛載到任意的文件夾,這里使用/cdrom。
mkdir /cdrom
mount /dev/cdrom /cdrom
創(chuàng)建Repo文件
創(chuàng)建repo 文件之前,如果不需要的話,把/etc/yum.repos.d目錄中存在的現(xiàn)有repo文件挪一邊去。
mv /etc/yum.repos.d/*.repo /tmp/
在 /etc/repos.d 目錄下創(chuàng)建新的 repo 文件,命名為cdrom.repo。
vi /etc/yum.repos.d/local.repo
Add the following details.
[LocalRepo]
name=LocalRepository
baseurl=file:///cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
對應(yīng)項(xiàng)解釋如下,
[LocalRepo] = Repository Name which will be displayed during package installation
name = Name of the repository
baseurl = Location of the package
Enabled = Enable repository
gpgcheck = Enable secure installation
gpgkey = Location of the key
gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)
安裝一個軟件包檢查一下,沒想好裝什么,這里就清理一下緩存試試吧。
yum clean all
配置完成后執(zhí)行就可以開始軟件安裝了!
安裝服務(wù)器GUI軟件組
先查看一下都有哪些group:
yum group list
輸出:
Loaded plugins: fastestmirror There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile Available Environment Groups: Minimal Install Compute Node Infrastructure Server File and Print Server Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Scientific Support Security Tools Smart Card Support System Administration Tools System Management Done
如果是CentOS 7,安裝:
yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
如果是RHEL 7,安裝:
yum groupinstall "Server with GUI"
設(shè)置系統(tǒng)啟動時使用GUI。在CentOS 7 / RHEL 7中,systemd使用“targets”而不是運(yùn)行級別。 /etc/inittab文件不再用于更改運(yùn)行級別。 因此,使用以下命令以在系統(tǒng)啟動時啟用GUI。
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
重啟機(jī)器即可進(jìn)入圖形模式。
reboot