Linux(CentOS)中常用软件安装,使用及异常——XManager, 中文支持,JDK

时间:2022-12-10 09:42:08

XManager图形化界面远程连接

采用Xshell的方式可以不用在CentOS系统中配置即可以相连,主要原理就是SSH连接的方式,但是XManager图形化界面远程连接是需要修改CentOS系统的。

安装桌面

有些CentOS系统没有安装图形化界面,那么在此之前需要安装图形化界面。

测试有没有安装:

rpm -qa | grep gnome
或者
yum list installed | grep gnome

查看JDK桌面环境:

[root@hidden ~]# env|greo DESKTOP_SESSION=
[root@hidden ~]# echo GDMSESSION

如果没有安装桌面,则先安装:

yum groupinstall "Desktop"
yum groupinstall "X Window System"

遇到[y/N]全部选y即可。

修改/etc/gdm/custom.conf

# vim /etc/gdm/custom.conf
# GDM configuration storage

[daemon]
RemoteGreeter=/usr/libexec/gdm-simple-greeter
[security]
AllowRemoteRoot=true
[xdmcp]
Port=177
Enable=true
DisplaysPerHost=5
[greeter]

[chooser]

[debug]

修改/etc/inttab

# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# 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 have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:

如果原来是:

id:3:initdefault:

则把3改成5.

(# runlevel)

修改/etc/init/prefdm.conf

vim /etc/init/prefdm.conf

# prefdm - preferred display manager
#
# Starts gdm/xdm/etc by preference
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file prefdm.override and put your changes there.

start on stopped rc RUNLEVEL=5

stop on starting rc RUNLEVEL=[!5]

console output
respawn
respawn limit 10 120
#exec /etc/X11/prefdm -nodaemon
exec /usr/sbin/gdm

将exec /etc/X11/prefdm -nodaemon注释掉,然后添加exec /usr/sbin/gdm

命令行运行lsof -i 177

[root@zhuzhonghua1-c6uu8 ~]# lsof -i:177
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
gdm-binar 1664 root   11u  IPv4  11186      0t0  UDP *:xdmcp 

这样则说明可以采用Xmanager进行连接。

采用Xstart打开

配置会话(随便填个),主机(需要访问的主机ip地址),协议(选择SSH),用户名,密码。

执行命令中填写:/usr/bin/gnome-session –display $DISPLAY

这样就配置完成了,应该可以通过图形化界面远程对侧主机了。

添加中文支持

运行

yum groupinstall "Chinese Support"

或者

yum groupinstall Chinese-Support

之后修改/etc/sysconfig/i18n

LANG="zh_CN.UTF-8"
SYSONT="lat0-sun16"

重启操作系统即可。

安装jdk

查看是否有已安装的JDK

#rpm -qa|grep jdk

如果有东西,先删除:rpm -e –nodeps *

如果没有,继续

tar -zxvf jdk****.tar.gz

然后修改/etc/profile

vim /etc/profile

在末尾添加

export JAVA_HOME=/root/util/jdk1.7.0_75
export JRE_HOME=/root/util/jdk1.7.0_75/jre
export PATH=$PATH:/root/util/jdk1.7.0_75/bin
export CLASSPATH=./:/root/util/jdk1.7.0_75/lib:/root/util/jdk1.7.0_75/jre/lib

保存退出之后

source /etc/profile

立刻生效文件。