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文件的端口或者数据库实例,启动容器,打完收工。

  • 相关阅读:
    使用Koa搭建一个mock服务器
    d3 使用记录: 树形图
    转载: 矩阵的运算及运算规则
    d3 使用记录: 插值
    d3 使用记录: Selection
    转载: javascript 模块化历程
    Git 常用操作
    贝塞尔曲线_初探
    css 基础-
    Freemarker模板语法
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/6431837.html
Copyright © 2011-2022 走看看