良许Linux教程网 干货合集 CentOS7系统迁移具体方案

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或者挂载方面的问题。

总结

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

以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !

img
本文由 良许Linux教程网 发布,可自由转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。
良许

作者: 良许

良许,世界500强企业Linux开发工程师,公众号【良许Linux】的作者,全网拥有超30W粉丝。个人标签:创业者,CSDN学院讲师,副业达人,流量玩家,摄影爱好者。
上一篇
下一篇

发表评论

联系我们

联系我们

公众号:良许Linux

在线咨询: QQ交谈

邮箱: yychuyu@163.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部