【ORACLE】安装时遇到“display at least 256 colors”


我们在Linux安装ORACLE时经常会遇到如下报错:

[oracle@db1 database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 16450 MB Passed
Checking swap space: must be greater than 150 MB. Actual 3071 MB Passed
Checking monitor: must be configured to display at least 256 colors
>>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
Some requirement checks failed. You must fulfill these requirements before
continuing with the installation,
Continue? (y/n) [n] n
User Selected: No
Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2017-06-30_12-28-12AM/installActions2017-06-30_12-28-12AM.log

这个问题是由于图形化设置不当造成的,需要正确执行xhost + 以及设置DISPLAY参数,解决步骤如下:

1、安装VNCSERVER(root用户)(已安装可以跳过)

[root@db1 ~]# yum install tigervnc-server
Complete!
[root@db1 ~]# vncserver
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /root/.Xauthority
New 'db1.us.oracle.com:1 (root)' desktop is db1.us.oracle.com:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/db1.us.oracle.com:1.log

2、设置DISPLAY参数以及xhost +(root用户)

[root@db1 ~]# export DISPLAY=db1.us.oracle.com:1
[root@db1 ~]# xhost +
access control disabled, clients can connect from any host

3、设置DISPLAY参数(oracle用户)

[root@db1 ~]# su - oracle
[oracle@db1 ~]$ export DISPLAY=:0.0

[oracle@db1 database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 11334 MB Passed
Checking swap space: must be greater than 150 MB. Actual 3071 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-06-30_08-42-28AM. Please wait ...

之所以使用startx启动图形不需要设置,是因为 DISPLAY环境变量在这种模式下将自动设置为:0:0

环境变量DISPLAY用来设置将图形显示到何处,格式为:host:NumA.NumB

直接登陆图形界面或者登陆命令行界面后使用startx启动图形, DISPLAY环境变量将自动设置为:0:0。此时Host为空, 则表示Xserver运行于本机, 并且图形程序(Xclient)使用unix socket方式连接到Xserver, 而不是TCP方式。

NumA的值:
使用TCP方式连接时, NumA为连接的端口减去6000的值, 如果NumA为0, 则表示连接到6000端口
使用unix socket方式连接时则表示连接的unix socket的路径, 如果为0, 则表示连接到/tmp/.X11-unix/X0

NumB则几乎总是0

可以通过下面的命令查看环境变量DISPLAY
root@root-desktop:~$ env | grep DISPLAY
DISPLAY=:0.0


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号