zoukankan      html  css  js  c++  java
  • 环境迁移

      有时我们需要把一个环境从一个单板迁移到另一个单板,这时就需要进行环境的复制:

      1、备份原环境。用tar命令将整个环境的家目录打包备份,即使不进行环境迁移,定期备份环境也是一个好习惯,当有一天环境意外崩溃或者升级包被替换错了,直接用备份环境还原就可以挽救。

      2、创建新环境。首先需要在root用户下,先创用户组和用户,然后改用户密码,最后切换到新用户下:

    [root@test11 ~]# groupadd wlfgroup
    [root@test11 ~]# useradd wlf -m -d /home/wlf -g wlfgroup -s /bin/bash
    [root@test11 ~]# passwd wlf
    Changing password for user wlf.
    New password: 
    BAD PASSWORD: The password is shorter than 8 characters
    Retype new password: 
    passwd: all authentication tokens updated successfully.
    [root@test11 ~]# su - wlf
    [wlf@test11 ~]$ 

      3、迁移原环境。将备份包通过ftp传到新环境,直接在家目录下解压,然后让jdk加入环境变量以便tomcat容器可以启动:

    [wlf@test11 ~]$ cd ~
    [wlf@test11 ~]$ vi .bashc

      在打开的文件中:

    # .bashrc
    
    # Source global definitions
    if [ -f /etc/bashrc ]; then
            . /etc/bashrc
    fi
    
    # Uncomment the following line if you don't like systemctl's auto-paging feature:
    # export SYSTEMD_PAGER=
    
    # User specific aliases and functions
    ~
    ~

      追加如下这一句:

    export PATH=$PATH:~wlf/jdk/bin

      让新环境变量生效:

    source .bashrc

      4、修改tomcat下server. xml文件的端口或者数据库实例,启动容器,打完收工。

  • 相关阅读:
    丁丁又病了
    领导之所以是领导
    丁丁的进步
    最近比较烦
    批量更新数据表
    转帖:《EnterLib PIAB深入剖析》系列博文汇总
    XML DOM介绍
    转大白话系列之C#委托与事件讲解大结局
    using
    jQuery工作原理解析以及源代码示例
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/6431837.html
Copyright © 2011-2022 走看看