Linux CentOS 7 Clone virtual machines + Login to each other

Source: Internet
Author: User
Tags custom name

Sometimes we need two virtual machines to do the experiment, of course we can install a new virtual machine again, but in order to save time I do not recommend this, because the VMware software has provided us with this function why not? First open the clone as follows:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/97/98/wKiom1kwEvChUx8YAAHspchwOxI917.png "style=" float : none; "title=" 1d.png "alt=" Wkiom1kwevchux8yaahspchwoxi917.png "/>

Next. Next to this interface we select the first item, the second item is not recommended, because the time spent on this item is not much different from the one you reinstalled!

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/97/99/wKioL1kwEvHA4MFqAAFBseOiNCs010.png "style=" float : none; "title=" 2d.png "alt=" Wkiol1kwevha4mfqaafbseoincs010.png "/>

Enter a new virtual machine name and the next step! Close, Finish!

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/97/98/wKiom1kwEvHS2a6SAACIFnP5gxg756.png "style=" float : none; "title=" 3d.png "alt=" Wkiom1kwevhs2a6saacifnp5gxg756.png "/>

Switch to the new virtual machine interface and boot to the system!

First enter the system after we need to modify the IP address , otherwise the cloned host as long as the open, the two machines will conflict!

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/97/98/wKiom1kwEvKRUbmgAABDMNP6TO8800.png "style=" float : none; "title=" 4d.png "alt=" Wkiom1kwevkrubmgaabdmnp6to8800.png "/>

Such as: Modify a new IP address, and delete the UUID line

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/97/99/wKioL1kwEvPhyBhBAACiHRbBhzg892.png "style=" float : none; "title=" 5d.png "alt=" Wkiol1kwevphybhbaacihrbbhzg892.png "/>

#systemctl Restart Network.service and restart the network.
#ifconfig look at the IP address again
#ping www.baidu.com Test it.

When we're done, we need to change the host name:

#hostnamectl set-hostname linux02 (custom name)

Of course you can see the name.

#cat/etc/hostname

Finally when we configure the completion IP address and hostname, remember to create a snapshot, later we need two machines to do the experiment!

LUnix machines log in to each other

The #w command is to view the system load

The complete connection method is:

#ssh [email protected] (IP address)

Of course, the general server will not use the default remote port, will be modified

Use-p to specify port connections! As follows:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/97/99/wKioL1kwFGaTYdUyAADqvSo7bcU889.png "style=" float : none; "title=" 6d.png "alt=" Wkiol1kwfgatyduyaadqvso7bcu889.png "/>

Zhdy-01 using a key pair to log on to the zhdy-02 machine

the IP of the zhdy-01 is 192.168.159. 129

the IP of the zhdy-02 is 192.168.158. the

First Enter:

#ssh-keygen to generate a key pair

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/97/99/wKioL1kwFGbitUOUAAASU5Rm13k724.png "style=" float : none; "title=" 7d.png "alt=" Wkiol1kwfgbituouaaasu5rm13k724.png "/>

Enter:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/97/98/wKiom1kwFGei3-LFAAAdORR4cYE847.png "style=" float : none; "title=" 8d.png "alt=" Wkiom1kwfgei3-lfaaadorr4cye847.png "/>

Where the public and private keys are stored

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/97/98/wKiom1kwFGfBDOd9AABBO9ISy1U817.png "style=" float : none; "title=" 9d.png "alt=" Wkiom1kwfgfbdod9aabbo9isy1u817.png "/>

Then we look at the public key:

#cat/root/.ssh/id_rsa.pub

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/97/99/wKioL1kwFGjQ6SotAAA4s4WlFy8371.png "style=" float : none; "title=" 10d.png "alt=" Wkiol1kwfgjq6sotaaa4s4wlfy8371.png "/>

Copy the public key to zhdy-02 Machine

#vi/root/.ssh/authorized_keys

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/97/99/wKioL1kwFGmg4Xy0AACi4S8Pk1U443.png "style=" float : none; "title=" 11d.png "alt=" Wkiol1kwfgmg4xy0aaci4s8pk1u443.png "/>

Then we need to shut down the firewall SELinux

#setenforce 0 Temporarily closed
#vi/etc/selinux/config #修改selinux的配置文件

change "selinux=enforcing" to selinux= Disabled Save exit.

Let's try using zhdy-01 again to log in zhdy-02 and we'll find something like:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/97/98/wKiom1kwFGnTPPIsAAAOKPw-6Pw205.png "style=" float : none; "title=" 12d.png "alt=" Wkiom1kwfgntppisaaaokpw-6pw205.png "/>

No need to enter the password again to connect to the ZHDY-02 machine!!!



This article is from the "Old seven Linux Operations Management" blog, please be sure to keep this source http://asd9577.blog.51cto.com/4291946/1931472

Linux CentOS 7 Clone virtual machines + Login to each other

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.