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 [email protected]:/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://baike.qcidc.com/11668.html

(0)
晴川运维晴川运维
上一篇 2025年7月5日
下一篇 2025年7月5日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注