CentOS6和CentOS7的時候,很多指令和環境都很不一樣了,所以設定方式完全不同。
在CentOS7中,gnome的介面會有問題,因此需要改用xfce。
[root@centos7 ~]# yum install -y epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* extras: ftp.tc.edu.tw
.................
Installed:
epel-release.noarch 0:7-6
Complete!
[root@centos7 ~]# yum install -y lightdm && yum groupinstall -y xfce
Loaded plugins: fastestmirror, langpacks
epel/x86_64/metalink | 5.2 kB 00:00
epel | 4.3 kB 00:00
(1/3): epel/x86_64/group_gz | 170 kB 00:00
.....................................
Complete!
[root@centos7 ~]# vi /etc/lightdm/lightdm.conf
................
[XDMCPServer]
Enable=true
Port=177
.............
存檔退出。
[root@centos7 ~]# systemctl disable gdm && systemctl enable lightdm
Removed symlink /etc/systemd/system/display-manager.service.
Created symlink from /etc/systemd/system/display-manager.service to /usr/lib/systemd/system/lightdm.service.
[root@centos7 ~]# systemctl start lightdm //啟動lightdm
[root@centos7 ~]# systemctl stop firewalld.service //關閉防火牆
[root@centos7 ~]# systemctl status lightdm //檢查lightdm的狀態是否正確。
● lightdm.service - Light Display Manager
Loaded: loaded (/usr/lib/systemd/system/lightdm.service; enabled; vendor preset: enabled)
Active: active (running) since 二 2016-09-06 16:12:30 CST; 57s ago
Docs: man:lightdm(1)
Main PID: 8248 (lightdm)
CGroup: /system.slice/lightdm.service
├─8248 /usr/sbin/lightdm
├─8256 /usr/bin/X -background none :1 -seat seat0 -auth /var/run/l...
└─8309 lightdm --session-child 14 21
9月 06 16:12:30 centos7.vb systemd[1]: Starting Light Display Manager...
9月 06 16:12:30 centos7.vb systemd[1]: Started Light Display Manager.
9月 06 16:12:30 centos7.vb lightdm[8272]: pam_unix(lightdm-greeter:session...)
Hint: Some lines were ellipsized, use -l to show in full.
(原則上上面的顯示表示正常,但萬一有錯誤,請把xsessions下的gnome的設定檔都刪除,強迫系統抓xfce)
[root@centos7 ~]# cd /usr/share/xsessions/
[root@centos7 xsessions]# ls
gnome-classic.desktop gnome.desktop
gnome-custom-session.desktop xfce.desktop
[root@centos7 xsessions]# mkdir old
[root@centos7 xsessions]# mv gnome* old
[root@centos7 xsessions]# ls
old xfce.desktop
[root@centos7 xsessions]# init 3 && init 5 //重新啟動desktop,或是reboot也可以。
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
PolicyKit daemon reconnected to bus.
Attempting to re-register as an authentication agent.
We are now a registered authentication agent.
做完之後,登入畫面從:
變成下面這種樣子了:
進入之後的畫面也完全不一樣了喔。
開啟Xmanager,在browser下就會看見這台機器了:
連線後的xfce畫面如下:
老實說,xfce還蠻好看的,有一點點像mac os呢。
開機時關閉防火牆:CentOS, Redhat都是一樣的用法。
# chkconfig iptables off //開機時關閉防火牆。若是要開啟,off改成on。
# service iptables stop //立刻關閉防火牆。若是要啟動,stop改成start。
參考文獻:https://www.zybuluo.com/wuzhimang/note/392271
http://blog.netsarang.com/89/connecting-to-centos-7/