本文以centos4.4为例子,介绍了在只有文本模式的linux下如何利用yum在线加装Xwindows的实例,希望给那些需要xwindows又不想重装的朋友有所帮助。加装其他软件及组件类似。
下面开始在centos4.4上利用yum(Yellowdog Updater Modified)的强大功能来安装xwindows
首先到 http://rpm.pbone.net search linux相应版本的 yum rpm 包。
例如本例查找到的yum rpm包的版本为 yum-2.0.8-2.centos3.src.rpm 。
下载地址为:ftp://ftp.nluug.nl/pub/os/Linux/distr/CentOS/3.9/os/SRPMS/yum-2.0.8-2.centos3.src.rpm
在文本模式下下载上面的yum 安装包
[root@localhost /]# wget -ot ftp://ftp.nluug.nl/pub/os/Linux/distr/CentOS/3.9/os/SRPMS/yum-2.0.8-2.centos3.src.rpm
[root@localhost /]# ls
-rw-r--r-- 1 root root 176333 Nov 3 13:18 yum-2.0.8-2.centos3.src.rpm
[root@localhost /]# ls
-rw-r--r-- 1 root root 176333 Nov 3 13:18 yum-2.0.8-2.centos3.src.rpm
给 yum-2.0.8-2.centos3.src.rpm 加权限
[root@localhost /]# chmod +x *.rpm
安装 yum
[root@localhost /]# rpm –ivh yum-2.0.8-2.centos3.src.rpm
中间可能提示无法创建目录,根据提示手动创建相应目录
安装完成以后运行yum命令看看是否安装成功
[root@localhost /]#yum grouplist
显示系统已经安装的组件,和可以安装的组件
如果系统安装之初采用最小化安装,没有安装xwindow,那么
[root@localhost /]#yum groupinstall "X Window System"
[root@localhost /]#yum groupinstall "GNOME Desktop Environment"
以上两个命令可同时进行,如下:
[root@localhost /]#yum groupinstall "X Window System" "GNOME Desktop Environment"
注意:为了能快速下载,可以设置/etc/yum.repos.d/CentOS-Base.repo 指向国内的站点http://mirror.be10.com
安装完X Window 修改
/etc/X11/xdm/Xaccess (去掉 #* #any host can get a login window前面的 #)
/etc/X11/gdm/gdm.conf (Enable=true,port=177)
/etc/inittab (第一行改为 id:5:initdefault: 最后一行改为 x:5:respawn:/usr/bin/gdm)
全部修改完后重新启动下系统,Xwindows就都装好了,下面附带讲下xmanager的问题。
[root@localhost /]#netstat -ln
检查 177 是否开放
如果没有177端口,那么可能是iptables设置有问题
可以用命令开放端口
[root@localhost /]#iptables -I INPUT -p udp -s 0/0 -d 0/0 --dport 177 -j ACCEPT
最彻底的办法是关闭iptables
/sbin/service iptables stop
或者
[root@localhost /]#chkconfig --level 5 iptables off
然后reboot os
现在应该可以用xmanager连接 linux的图形界面了
附录:
[root@localhost /]# yum grouplist
Setting up Group Process
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
yumgroups.xml 100% |=========================| 558 kB 00:17
yumgroups.xml 100% |=========================| 4.6 kB 00:00
Installed Groups:
Compatibility Arch Support
Mail Server
Available Groups:
Administration Tools
AptRPM
Authoring and Publishing
Compatibility Arch Development Support
DNS Name Server
Development Tools
Editors
Engineering and Scientific
FTP Server
GNOME Desktop Environment
GNOME Software Development
Games and Entertainment
Graphical Internet
Graphics
Horde-Apps
KDE (K Desktop Environment)
KDE Software Development
Legacy Network Server
Legacy Software Development
MySQL Database
Network Servers
News Server
Office/Productivity
PostgreSQL Database
Printing Support
Server Configuration Tools
Sound and Video
System Tools
Text-based Internet
Web Server
Windows File Server
X Software Development
X Window System
XFCE-4.2
drbd-heartbeat
Done
[root@localhost /]# yum grouplist
Setting up Group Process
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
yumgroups.xml 100% |=========================| 558 kB 00:17
yumgroups.xml 100% |=========================| 4.6 kB 00:00
Installed Groups:
Compatibility Arch Support
Mail Server
Available Groups:
Administration Tools
AptRPM
Authoring and Publishing
Compatibility Arch Development Support
DNS Name Server
Development Tools
Editors
Engineering and Scientific
FTP Server
GNOME Desktop Environment
GNOME Software Development
Games and Entertainment
Graphical Internet
Graphics
Horde-Apps
KDE (K Desktop Environment)
KDE Software Development
Legacy Network Server
Legacy Software Development
MySQL Database
Network Servers
News Server
Office/Productivity
PostgreSQL Database
Printing Support
Server Configuration Tools
Sound and Video
System Tools
Text-based Internet
Web Server
Windows File Server
X Software Development
X Window System
XFCE-4.2
drbd-heartbeat
Done
Transaction Summary
==========================================================
Install 228 Package(s)
Update 10 Package(s)
Remove 0 Package(s)
Total download size: 232 M
Is this ok [y/N]: y
==========================================================
Install 228 Package(s)
Update 10 Package(s)
Remove 0 Package(s)
Total download size: 232 M
Is this ok [y/N]: y
Downloading Packages:
(1/238): aaaaaa-3.8.3-11.fc 100% |=========================| 752 kB 01:04
(2/238): bbbbbb9.7-10.fc4.i 100% |=========================| 912 kB 02:14
(3/238): ccccccc-0.9.7-1.2. 100% |=========================| 95 kB 00:05
(1/238): aaaaaa-3.8.3-11.fc 100% |=========================| 752 kB 01:04
(2/238): bbbbbb9.7-10.fc4.i 100% |=========================| 912 kB 02:14
(3/238): ccccccc-0.9.7-1.2. 100% |=========================| 95 kB 00:05
……
……
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: aaa ######################### [1/238]
Installing: bbb ######################### [2/238]
Installing: ccc ######################### [3/238]
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: aaa ######################### [1/238]
Installing: bbb ######################### [2/238]
Installing: ccc ######################### [3/238]
……
……
Installed: ……
Installed: ……
Dependency Installed: ……
Complete!
Complete!