Linux虚拟机克隆

本文介绍如何使用Xshell远程连接工具连接Linux服务器,并在服务器上安装Java环境。具体步骤包括:连接服务器、上传并安装JDK包、配置环境变量等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. Xshell 5 (Build 0553)
    Copyright (c) 2002-2015 NetSarang Computer, Inc. All rights reserved.
    
    Type `help' to learn how to use Xshell prompt.
    [c:\~]$ 
    
    Connecting to 192.168.211.30:22...
    Could not connect to '192.168.211.30' (port 22): Connection failed.
    
    Type `help' to learn how to use Xshell prompt.
    [c:\~]$ 
    
    Connecting to 192.168.221.30:22...
    Could not connect to '192.168.221.30' (port 22): Connection failed.
    
    Type `help' to learn how to use Xshell prompt.
    [c:\~]$ 
    
    Connecting to 192.168.211.30:22...
    Connection established.
    To escape to local shell, press 'Ctrl+Alt+]'.
    
    Last login: Tue Jun 27 17:48:49 2017
    [root@node1 ~]# vi /etc/sysconfig/network
    [root@node1 ~]# vi /etc/hosts
    [root@node1 ~]# vi /etc/sysconfig/network
    [root@node1 ~]# vi /etc/hosts
    [root@node1 ~]# vi /opt/
    [root@node1 ~]# cd /opt/
    [root@node1 opt]# ls
    jdk-7u80-linux-x64.rpm
    [root@node1 opt]# rpm -ivh jdk-7u80-linux-x64.rpm 
    Preparing...                ########################################### [100%]
       1:jdk                    ########################################### [100%]
    Unpacking JAR files...
    	rt.jar...
    	jsse.jar...
    	charsets.jar...
    	tools.jar...
    	localedata.jar...
    	jfxrt.jar...
    [root@node1 opt]# cd /user/java
    -bash: cd: /user/java: No such file or directory
    [root@node1 opt]# cd jdk1.7.0_80/
    -bash: cd: jdk1.7.0_80/: No such file or directory
    [root@node1 opt]# cd /user/java/
    -bash: cd: /user/java/: No such file or directory
    [root@node1 opt]# cd /usr/java/
    [root@node1 java]# pwd
    /usr/java
    [root@node1 java]# cd jdk1.7.0_80/
    [root@node1 jdk1.7.0_80]# pwd
    /usr/java/jdk1.7.0_80
    [root@node1 jdk1.7.0_80]# cd /opt/
    [root@node1 opt]# vi ~/.bash_profile
    [root@node1 opt]# source ~/.bath_profile
    -bash: /root/.bath_profile: No such file or directory
    [root@node1 opt]# source ~/.bash_profile
    [root@node1 opt]# java
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)
    where options include:
        -d32	  use a 32-bit data model if available
        -d64	  use a 64-bit data model if available
        -server	  to select the "server" VM
                      The default VM is server.
    
        -cp <class search path of directories and zip/jar files>
        -classpath <class search path of directories and zip/jar files>
                      A : separated list of directories, JAR archives,
                      and ZIP archives to search for class files.
        -D<name>=<value>
                      set a system property
        -verbose:[class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -version:<value>
                      require the specified version to run
        -showversion  print product version and continue
        -jre-restrict-search | -no-jre-restrict-search
                      include/exclude user private JREs in the version search
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions with specified granularity
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions with specified granularity
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions
        -agentlib:<libname>[=<options>]
                      load native agent library <libname>, e.g. -agentlib:hprof
                      see also, -agentlib:jdwp=help and -agentlib:hprof=help
        -agentpath:<pathname>[=<options>]
                      load native agent library by full pathname
        -javaagent:<jarpath>[=<options>]
                      load Java programming language agent, see java.lang.instrument
        -splash:<imagepath>
                      show splash screen with specified image
    See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more detail
    s.[root@node1 opt]# ^C
    [root@node1 opt]# ^C
    [root@node1 opt]# 
    [root@node1 opt]# vi /etc/sysconfig/network-scripts/eth0
    [root@node1 opt]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
    [root@node1 opt]# rm -r /etc/udev/rules.d/70-persistent-net.rules 
    rm: remove regular file `/etc/udev/rules.d/70-persistent-net.rules'? yes
    [root@node1 opt]# 
    Connection closed by foreign host.
    
    Disconnected from remote host(node1) at 13:30:48.
    
    Type `help' to learn how to use Xshell prompt.
    [c:\~]$ 
    

    先连接
  2. 更改主机名    输入以下命令  [root@node1 ~]# vi /etc/sysconfig/network
  3. vi /etc/hosts 修改主机名
  4. 将Linux的jdk通过xftp软件上传到虚拟机/opt文件夹上
  5. 进入opt文件中  cd /opt/
  6. 查看opt中的文件 ls
  7. 解压文件   [root@node1 opt]# rpm -ivh jdk-7u80-linux-x64.rpm 
  8. 验证是否安装成功  进入Java文件夹中      cd /usr/java----->pwd(显示文件目录) --->cd  jdk1.7.0_80/----->pwd
  9. [root@node1 opt]# vi ~/.bash_profile   进入用户环境变量中进行配置
  10. [root@node1 opt]# source ~/.bash_profile令其启动生效
  11. [root@node1 opt]# java 验证JDK
  12. 删除HWADDR/UUID(双击“D”键)
  13.  删除文件/etc/udev/rules.d/70-persistent-net.rules 这个是一个克隆规则,为了保证物理地址唯一删除此文件

  14. 关闭虚拟机
  15. 选中虚拟机——>管理——>克隆——>虚拟机的当前状态——>创建链接克隆——>虚拟机名称、位置——>完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值