Linux first week study notes (10)

Source: Internet
Author: User

Linux first week study notes (TEN)


1.15 Cloning a virtual machine

(1) because in the future to do the experiment requires two machine interconnection, because in the virtual machine inside the system is slower so the use of cloning is relatively simple, that is, the original good system to make a copy intact.

(2) Cloning a virtual machine

First step: Close the virtual machine before cloning

Step two: Start cloning a virtual machine

    • Click on the Daizhihong-linux tab and select Manage then click Clone

    • Go to the Clone Wizard and click Next

    • Clone the source, select the current status in the virtual machine, then click Next

    • Clone type Select Create Link clone (this way to conserve disk space)

    • Enter a new virtual machine name and its storage path

    • Cloning a virtual machine succeeds

    • Create a successful daizhihong-linux02 number virtual machine

Step three: Set up the 2nd virtual Machine Network (because it is a clone, you need to modify the IP address or the two simulator IP will conflict)

Log in to number 2nd virtual machine

    • Input VI /etc/sysconfig/network-scripts/ifcfg-ens33 command to make changes to an IP address

    • Go to the network configuration file and change the P address. Number 2nd IP address changed to 192.168.226.11 (1th machine ip:192.168.226.10)

    • Remove the UUID (if you do not delete this line will conflict with the number 1th), after the change, press "ESC" key to exit the edit, enter ": Wq" Save and exit

    • After you change the network configuration file, you must restart the Network service, type the command: Systemctl restart Network.service

    • To see if the 2nd virtual machine IP address is configured successfully, type the ifconfig command to view the changes successfully

    • Test network is tested with ping command, test networking is OK, network status is OK

Fourth step: View and modify the host name of Virtual Machine No. 1th and number 2nd virtual machine

    • Use the sHostName command to view the 2nd virtual Machine host name

    • Modify the host name of the 2nd virtual machine, type the command: Hostnamectl set-hostname daizhihong-02, change the hostname to: daizhihong-02

    • After restarting the 2nd virtual machine, the system hostname has been modified successfully.

    • Change the 1th virtual machine hostname, type the command: Hostnamectl set-hostname daizhihong-01, the modification is successful (the revision process as above, not repeat here)


Fifth step: Set up the Xshell connection 2nd number virtual machine

    • Open the Xshell Software connection session box and copy the 1th number of virtual machine information to make changes

    • Change the connection profile settings for replication to the name Daihzihong-linux02,ip address: 192.168.226.11

    • Test whether the connection number 2nd virtual machine is successful

    • Connection number 2nd virtual machine succeeded

    • Test connection 1th Virtual machine and number 2nd virtual machine is connected properly

    • 1th virtual machines and 2nd virtual machines are connected properly

    • Second machine set up, click Snapshot Backup

1.16 Linux machines log in to each other

(1). Password Login

The first step: 1th virtual Machine Login 2nd virtual machine, using SSH 192.168.226.11, login success

Step Two: Number 2nd virtual machine login 1th virtual machine, type command: SSH 192.168.226.10, login successful

    • You can use the "w" command to view the system load and to reflect the number of connections

    • An explanation of SSH commands

    • Standard format: SSH [email protected]

    • Example: SSH [email protected]

    • Specify port connection: ssh-p [email protected] (p specify port parameter, 22 port number)

(2). Using key authentication

Number 2nd virtual Machine Connection 1th virtual machine (public key is placed on number 1th, private key is placed on number 2nd virtual machine)

First step: Generate a key pair on the 2nd virtual machine, type the command: Ssh-keygen, press ENTER to prompt: Enter file in which to save the key (/ROOT/.SSH/ID_RSA): Define the storage path of the key pair, keep the default press ENTER to continue


Step two: prompt: Enter passphrase (empty for no passphrase): Set the key to open password, set open press Password to empty press ENTER to continue

The third step: continue to press ENTER, generate key pairs, generated after the following prompt:

Enter same Passphrase again:

Your identification has been saved In/root/.ssh/id_rsa.

Your public key has been saved in/root/.ssh/id_rsa.pub.

The key fingerprint is:

Sha256:qpigmw+cldx6a3jje+0ls3ateplyzcvylqvjke4mdeu [email protected]

The key ' s Randomart image is:

+---[RSA 2048]----+

| ...          |

|         ... . |

|   =e. .    . |

|   = B + =. |

|. O * = S * o |

|*o = * =. |

|.      *. o *o*. |

| +  + =+*       |

| .. . o=.o |

+----[SHA256]-----+

Fourth step: View the Public key file name, type: ls. root/.ssh0/command

Authorized_keys Id_rsa id_rsa.pub known_hosts

Id_rsa: Private key

Id_rsa.pub: Public Key

Fifth step: Type: cat/root/.ssh/id_rsa.pub command to view the public key and copy


Sixth step: Open the 1th virtual machine run the Edit key file, type: Vi/root/.ssh/authorized_keys command to edit the key file

    • Edit Key File

Seventh Step: Number 2nd virtual machine login with key, type: ssh-p [email protected], login successful

- ---------------------------------------------------------------- command and use summary -------------------------------------- --------------------------

    1. You can use the "w" command to view the system load and to reflect the number of connections

    2. An explanation of SSH commands:

      Standard format: SSH [email protected]

      Example: SSH [email protected]

      Specify port connection: ssh-p [email protected] (p specify port parameter, 22 port number)

    3. Generate key Pair command: Ssh-keygen

    4. Cat/root/.ssh/id_rsa.pub command to view the public key and copy

    5. View current logged on user command: Whoam

    6. Change host name, type command: Hostnamectl set-hostname daizhihong-01

    7. Query host Name: type command: hostname




Linux first week study notes (10)

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.