CentOS7系统迁移演示

实际工作中经常会遇到想把系统迁移到另外的机房或者迁移到云平台,今天给大家介绍一种简单的迁移方法。

CentOS7系统迁移演示CentOS7系统迁移演示
实验环境:
系统:centos7
ip:172.16.1.101
server1部署nginx,再装一台新的server2 和server1一样的环境但是不部署软件,实验要求迁移之前访问server1的nginx可以访问,访问server2的nginx可以访问。

server1部署nginx

[root@localhost ~]# tar xf nginx-1.11.2.tar.gz
[root@localhost ~]# ./configure
[root@localhost ~]# make
[root@localhost ~]# make install

编辑index.html

[root@localhost html]# cat index.html
aaaaaaaaa
this is a test!

测试nginx

[root@localhost html]# curl  172.16.1.101
aaaaaaaaa
this is a test!

将重要目录打包

--exclude 指定的目录不打包 --warning 略过报错

[root@localhost ~]# cd /
[root@localhost /]# tar cvpzf backup.tgz / --warning=no-file-changed --exclude=/proc --exclude=/mnt --exclude=/sys --exclude=/dev --exclude=/tmp --exclude=/backup.tgz

登录server2进行迁移

可以用拷贝的方式,我这里先在server配置成172.16.1.102 通过scp传过来
cd /

[root@localhost html]# scp root@172.16.1.101:/backup.tgz .
[root@localhost /]# cd /
[root@localhost /]# 
[root@localhost /]# tar xvpfz backup.tgz -C /
[root@localhost /]# restorecon -Rv /

测试

关闭server1 重启server2访问172.16.1.101 的nginx

[root@localhost /]# curl  172.16.1.101
aaaaaaaaa
this is a test!

实验环境不同,可能会有差异可以考虑uuid或者挂载方面的问题。

总结

这就是一种简单的迁移方式,还有其他的方法后面再跟大家介绍

本文原创地址:https://www.linuxprobe.com/centos-qianyi.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值