Linux安装VNC服务及配置

linux部署环境如果没有远程桌面,那就只有静默安装了,当然这有难度,不过有VNC很不错,远程桌面环境部署方便多了,环境还算清晰,速度不卡,部署平台完全没有问题,部署方式可以参考如下笔记:

[root@solgle Desktop]# rpm -ivh VNC-Server-5.2.1-Linux-x64.rpm 
Preparing...                ########################################### [100%]
   1:realvnc-vnc-server     ########################################### [100%]
Checking for xauth... [OK]
Updating /etc/pam.d/vncserver
NOTICE: common configuration in /etc/pam.d contains the following modules:
   pam_fprintd.so
The default vncserver PAM configuration only enables pam_unix. See 
`man vncinitconfig  for details on any manual configuration required.
 
Looking for font path... not found.
Generating private key...done
Installed init script for VNC X11 Service-mode daemon
Start and stop the service with:
  /etc/init.d/vncserver-x11-serviced (start|stop)
Use chkconfig to start or stop the service at boot time.
 
Installed init script for VNC Virtual-mode daemon
Start and stop the service with:
  /etc/init.d/vncserver-virtuald (start|stop)
Use chkconfig to start or stop the service at boot time.
 
[root@solgle Desktop]# 
-------安装成功
 
[root@solgle init.d]# vncserver :1
VNC(R) Server 5.2.1 (r5668) 64-bit (Aug 18 2014 12:26:41)
Copyright (C) 2002-2014 RealVNC Ltd.
VNC is a registered trademark of RealVNC Ltd in the U.S. and in other
countries.
Protected by UK patent 2481870; US patent 8760366.
See http://www.realvnc.com for information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.2/acknowledgements.txt
 
Error: No license keys found.
Run vnclicense to apply a license key. [NoLicense]
----提示没有license
 
----add license
[root@solgle init.d]# vnclicense -add WHJRK=UXYY7V=Q34M9-C2U8L-8KGFA
Error: This is not a valid license key.
 
A license key consists of 25 alphanumeric characters, divided by hyphens into 5
groups of 5 characters each.
[root@solgle init.d]# 
 
----使用另一个license
[root@solgle init.d]# vnclicense -add 3TH6P-DV5AE-BLHY6-PNENS-B3AQA
License key <Enterprise> has been successfully applied.
[root@solgle init.d]# 
 
--ok
 
------???
root@solgle ~]# vncserver :1
VNC(R) Server 5.2.1 (r5668) 64-bit (Aug 18 2014 12:26:41)
Copyright (C) 2002-2014 RealVNC Ltd.
VNC is a registered trademark of RealVNC Ltd in the U.S. and in other
countries.
Protected by UK patent 2481870; US patent 8760366.
See http://www.realvnc.com for information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.2/acknowledgements.txt
 
If a desktop environment fails to load for this virtual desktop, please see:
http://www.realvnc.com/kb-345
Running applications in /etc/vnc/xstartup
 
VNC Server catchphrase: "Sofia unit nickel. Campus tic-tac north."
             signature: 25-b2-6d-b7-ae-f4-b3-e6
 
Log file is /root/.vnc/solgle:1.log
New desktop is solgle:1 (192.16.3.8:1)
 
----查看vncserver进程信息
[root@solgle ~]# ps -ef | grep vnc
root      2680  2651  0 13:49 pts/0    00:00:00 grep vnc
[root@solgle ~]# 
 
---设置远程密码
[root@solgle sysconfig]# vncpasswd
Setting "Password" VNC parameter in /root/.vnc/config.d/vncserver-x11
Password:
Verify:
Passwords don't match - try again
Password:
Verify:
Successfully set  Password" VNC parameter in /root/.vnc/config.d/vncserver-x11
 
---配置防火墙:vnc server端口从5900开始,比如 5901,5902
 
---设置成功,使用vnc viewer 连接成功
 
Linux安装VNC服务及配置
 
---关闭及启动一个vnc远程桌面(每次连接可能需要重启一次,否则会报(10061)连接超时)
[root@solgle sysconfig]# vncserver -kill :1
Can't find file /root/.vnc/solgle:1.pid
You'll have to kill the Xvnc process manually.
[root@solgle sysconfig]# ^C
[root@solgle sysconfig]# vncserver :1

 

 

 

 

 

 

 

 

 

login as: root
root@.105's password:
Last login: Thu Nov 22 21:19:18 2012 from104
[root@localhost ~]# vncserver
VNC(R) Server 5.0.3 (r97046)
Built on Oct  2 2012 17:26:00
Copyright (C) 2002-2012 RealVNC Ltd.
VNC is a registered trademark of RealVNC Ltd. in the U.S. and in other
countries.
Protected by UK patent 2481870.
See http://www.realvnc.comfor information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.0/acknowledgements.txt

Error: No license keys installed.
Run vnclicense to install a license key.

[root@localhost ~]# vnclicense -list
No license key found.
[root@localhost ~]# vnclicense -add WHJRK-UXY7V-Q34M9-CZU8L-8KGFA
Enterprise license key has been successfully applied.
[root@localhost ~]# vncserver
VNC(R) Server 5.0.3 (r97046)
Built on Oct  2 2012 17:26:00
Copyright (C) 2002-2012 RealVNC Ltd.
VNC is a registered trademark of RealVNC Ltd. in the U.S. and in other
countries.
Protected by UK patent 2481870.
See http://www.realvnc.comfor information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.0/acknowledgements.txt


Running applications in /etc/vnc/xstartup

VNC Server signature: xx-xx-xx-xx-63-xx-83-0f
Log file is /root/.vnc/localhost.g:1.log
New desktop is localhost.g:1 (105:1)
[root@localhost ~]#

 

 

另外为了安全起见,中断VNC服务器之后,最好在服务器上能够及时关闭VNC应用服务器。关闭的命令如上,只需要运行如下命令即可:

#vncserver –kill :1

 

==============网上的key=================

WHJRK-UXY7V-Q34M9-CZU8L-8KGFA 
S4J7A-XWXY5-KXAJW-54KRA-TP3QA 
48R4P-NFZ46-NBCWY-Q2ZJT-3H9RA 
NGNW9-7Q8BK-UQGY7-J3KAA-6G39 
Z456C-LMKTC-NLGWQ-H5CUR-ZVWEA 
A5HDP-LXKYN-UK4W6-XACZJ-ENWLA 
NRDX9-ZF9C5-JLGY7-CUC5J-77J2A 
579R9-9B92W-4QHM9-6TK6D-H6F9A 
VETPD-HHC3S-63AH9-YAA26-8WVDA 
SSEWK-HBDM6-YYCWC-M3BQV-9XMDA 
LFKRU-DCTWH-6GJH2-7SWYR-D4CPA 
CQUTS-S5RDR-VT2WJ-9B6TU-DLHPA 
RR36V-7V29A-EVGJA-AYNEC-3DZYA 
UNLZ3-EHBVR-VACLK-S8QDH-JZMHA 
TPSNG-YEUGX-J4HZX-DPYSY-HZKXA 
UCUXY-TAFLN-YFBVV-D7VZE-9SHJA 
ANN2U-FM59S-DAGV4-4TK96-BDTKA 
F4X7H-CYLEV-XZ4ZW-USQ7D-KHMGA 
63P3S-TGU8R-3C4ZE-WCKF4-S2W3A 
Q35YW-ZVH7L-Z94J4-9UJP9-77VFA 
3TH6P-DV5AE-BLHY6-PNENS-B3AQA

==============================Linux安装JDK配置环境变量==================================

1 去 http://java.sun.com/j2se/1.4.2/download.html 下载一个Linux Platform的JDK,建议下载 RPM自解压格式的(RPM in self-extracting file,j2sdk-1_4_2_06-linux-i586- rpm.bin);
2.     上载到Linux服务器上,在shell下执行命令:
[root@LinuxServer rpm]# chmod 755 j2sdk-1_4_2_06-linux-i586-rpm.bin
[root@LinuxServer rpm]# ./j2sdk-1_4_2_06-linux-i586-rpm.bin

这时会有一段Sun的协议,敲几次空格键,当询问是否同意的时候,敲yes就可以了。
               Sun Microsystems, Inc.
           Binary Code License Agreement
                    for the
JAVATM 2 SOFTWARE DEVELOPMENT KIT (J2SDK), STANDARD
EDITION, VERSION 1.4.2_X

Do you agree to the above license terms? [yes or no]yes
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.40 of 28 November 1998, by Info-ZIP (Zip-Bugs@lists.wku.edu).
   inflating: j2sdk-1_4_2_06-linux-i586.rpm  
Done.

3.     程序会自动生成一个j2sdk-1_4_2_06-linux-i586.rpm文件,这是主程序包,下面来安装;
[root@LinuxServer rpm]#rpm –ivh j2sdk-1_4_2_06-linux-i586.rpm
Preparing...                ########################################### [100%]
    1:j2sdk                ########################################### [100%]

4.     设置环境变量
通常都喜欢用export命令直接在shell下设置
[root@LinuxServer rpm]# export JAVA_HOME=/usr/java/j2sdk1.4.2_06
[root@LinuxServer rpm]# export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@LinuxServer rpm]# export PATH=$PATH:$JAVA_HOME/bin 
当然这样设置环境变量是可以生效的,但是只对当前shell生效。如果从另外一个shell登陆,将不能使用刚才设置的变量。所以最好的方法还是修改.bashrc文件。
[root@LinuxServer rpm]#vi .bashrc
set JAVA_HOME=/usr/java/j2sdk1.4.2_06
export JAVA_HOME
set PATH=$PATH:$JAVA_HOME/bin
export PATH
set CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH 
当然也可以通过更改/etc/profile来实现,不过不推荐这么做,因为这样的设置将对所以用户的shell都生效,对系统安全会产生影响。下面来验证一下变量设置是否生效(在验证前先logout一下,再重新登陆);
[root@LinuxServer rpm]# echo $JAVA_HOME
/usr/java/j2sdk1.4.2_06/
[root@LinuxServer rpm]# echo $CLASSPATH
/usr/java/j2sdk1.4.2_06/lib/dt.jar:/usr/java/j2sdk1.4.2_06/lib/tools.jar
[root@LinuxServer rpm]# echo $PATH
/usr/java/j2sdk1.4.2_06/bin/:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
[root@LinuxServer rpm]# -version
JAVA version "1.4.2_06"
JAVA(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
JAVA HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)JAVA

5.     环境设置OK,看看JDK是否能正常工作,我们来写一个测试文件test.java
[root@LinuxServer rpm]#vi test.java
class test 
{
        public static void main(String[] args) 
        {
               System.out.println("Hello World!");
        }
}

保存退出,下面来编译、执行;
[root@LinuxServer text]# javac test.java
[root@LinuxServer text]# test
Hello World!JAVA

OK,工作正常。
6.     如果要使某个用户具有运行java命令的权限,只要修改其bash初始化文件即可。
比如要给用户longware以运行java命令的权限,
[root@LinuxServer root]# vi /home/longware/.bashrc
set JAVA_HOME=/usr/java/j2sdk1.4.2_06
export JAVA_HOME
set PATH=$PATH:$JAVA_HOME/bin
export PATH
set CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH

7.     至此,Linux上JDK的安装完毕。

===================Linux下Tomcat的安装详解===================

一,安装前的准备:
1,Linux版本:[root@tpwb /]# uname -r
2.6.9-34.EL(版本内核)
2,tomcat版本:jakarta-tomcat-5.0.28.tar(大小:10.2M)
你可以去http://jakarta.apache.org/tomcat 下载

二,tomcat的安装
安装前看看Tomcat安装的信息,上面也有关于Tomcat安装的信息,可以作为参考。

3,下面开始安装。
[root@tpwb ~]# cd /usr/local
[root@tpwb local]# ls
bin     games      lib         lost+found     sbin      src
etc     include     jakarta-tomcat-5.0.28.tar.gz     libexec     man            share
我把j2sdk-1_4_2_04-linux-i586-rpm.bin放在local目录下,你也可以放在其他地方。

第一步:
首先解压缩。
[root@tpwb local]# tar -zxvf jakarta-tomcat-5.0.28.tar.gz
[root@tpwb local]# ls
bin     games       jakarta-tomcat-5.0.28            lib         lost+found     sbin      src
etc     include     jakarta-tomcat-5.0.28.tar.gz     libexec     man            share

第二步:
设置环境变量
我想到这的话,可能有人会问,为什么要设置环境变量。
提供一个网址,http://www.linuxidc.com/Linux/2009-12/23735.htm上面说的比较详细:
总体来说就在运行tomact命令是能找到tomcat 的目录,知道它安装到哪了。

下面设置一个两个环境变量CATALINA_HOME和CATALINA_BASE,
编辑~/.bashrc文件。加入

export CATALINA_BASE=/usr/local/jakarta-tomcat-5.0.28
export CATALINA_HOME=/usr/local/jakarta-tomcat-5.0.28
[root@tpwb local]# cd ~
[root@tpwb ~]# ls -a
.                   .bash_history     .bashrc     .gconfd         install.log.syslog
..                  .bash_logout      .cshrc      .gtkrc          .tcshrc
anaconda-ks.cfg     .bash_profile     .gconf      install.log     .viminfo
[root@tpwb ~]# vi .bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export JAVA_HOME=/usr/java/j2sdk1.4.2_04
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
export CATALINA_BASE=/usr/local/jakarta-tomcat-5.0.28
export CATALINA_HOME=/usr/local/jakarta-tomcat-5.0.28

vi命令用于编辑文本。wq保存退出. 想了解更详细的命令,可以查看上面推荐网址

如果想设置其他用户的环境变量,方法是一样的。在这里不在说了,我在“linux下安装JDK”文章里已经说的很详细了。

下面来验证一下变量设置是否生效

设置完环境变量最好重起一下,不然看不到效果。

[root@tpwb tp]# reboot
Broadcast message from root (pts/0) (Fri Jan 19 16:51:26 2007):
The system is going down for reboot NOW!
我们来查看一下
[root@tpwb ~]# echo $CATALINA_HOME
/usr/local/jakarta-tomcat-5.0.28
[root@tpwb ~]# echo $CATALINA_BASE
/usr/local/jakarta-tomcat-5.0.28
已经没问题了。

====================================================================

startup.sh: command not found . 命令前加上bash 或 sh 或 ./.代表当前目录,如果执行程序或脚本没有加入环境变量PATH,在当前目录时前面要加"./"

 

[root@localhost ~]# cd /usr/apache-tomcat-6.0.36/apache-tomcat-6.0.36/bin
[root@localhost bin]# startup.sh
-bash: startup.sh: command not found
[root@localhost bin]# ./ startup.sh
-bash: ./: is a directory
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE:   /usr/apache-tomcat-6.0.36/apache-tomcat-6.0.36
Using CATALINA_HOME:   /usr/apache-tomcat-6.0.36/apache-tomcat-6.0.36
Using CATALINA_TMPDIR: /usr/apache-tomcat-6.0.36/apache-tomcat-6.0.36/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/apache-tomcat-6.0.36/apache-tomcat-6.0.36/bin/bootstrap.jar
[root@localhost bin]#

posted @ 2015-12-25 14:30  离线中  阅读(4711)  评论(0编辑  收藏  举报