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]#


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM