Location>code7788 >text

VMware install CentOS7 and remote login detailed tutorials

Popularity:603 ℃/2024-09-11 21:16:43

write sth. upfront

Primary use of software:

  • VMware Workstation Pro17
  • Navicat Premium17
  • Xshell7
  • Xftp7

1. Install CentOS7 in a virtual machine

interviewsAliCloud Mirror Station Select the markup image file to download

Open the virtual machine VMware and create a new virtual machine

Click "New CD/DVD", "Use ISO image file", set the path to CentOS 7, click "Close", " Finish".

Turn on the virtual machine

Mouse click on the screen, then press "Up" to select theinstall CentOS7, byEnterStart Installation

The main process is similar to the following diagram

Then follow the diagram

Set your own password and wait for installation

After CentOS7 boots and logs in, the default account isrootIf you enter a password, it will not be displayed.

2. Automatic IP acquisition

Right-click on the virtual machine to open the settings and make sure it's selectedNATparadigm

Open the network editor and notesubnet IPGateway IP

Go to the network configuration file

cd /etc/sysconfig/network-scripts/

Check to see if there are any ifcfg-XXX files (except ifcfg-lo), if not, you need to reinstall CentOS or change the version.

ls

Go to the ifcfg-ens33 file

vi ifcfg-ens33

check or refer toiGo to edit mode and modify theBOOTPROTO=ducp,ONBOOT=yesWhen finished, pressESCInput:wqSave and Exit

Reboot the NIC

service network restart

ip addrTo view the dynamically assigned IP, the machine is192.168.128.129

ping If you want to access the external network, you have to verify that you have access to the external network.

3.Xshell7 connecting to CentOS7

interviewsofficial websiteTo do this, install xshell and xftp.

Again, Control Panel->Network and Internet->Network and Sharing Center->Change Adapters->Find MVnet8->Right-click Properties ->Double-click Internet Protocol version 4, IP and NIC should be the same as the VM in theSame network segment but not identical

Open Xshell 7 to create a new session

Enter the IP to which the VM has been assigned, and ignore the rest and just click Connect.

Fill in the pop-up window with your username and password.

Connection successful

CentOS7 Configuration Successful

4. Installation and Deployment of MySQL on Virtual Machines

Check if MySQL is already installed on the machine, no output means no, otherwise you have to uninstall it.

rpm -qa|grep mysql

If notwgetTo install, visitAliCloud Mirror LibraryClick to download the labeled version

Open Xftp, the operation is the same as the previous Xshell, new connection, enter the IP, and other unchanged, then the account and password window will pop up, fill in the virtual machine on the connection!

In the left half of the window, find the wget you just downloaded, and in the right half of the VM window, change the path of the input line above to/home If you drag the wget to the right with your mouse, you can transfer it there.

In the virtual machine, typecd /homeThis will show you the wget to install.

Install wget

 rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm

backing up

mv /etc// /etc//

Download the new

curl -o /etc// /repo/

//clear yum cache, regenerate

yum clean all

yum makecache

//Download MySQL source installer

wget /get/

//Install the MySQL source

yum localinstall -y

//Check if the source was installed successfully

yum repolist enabled|grep mysql


//formal installationMySQL

yum install -y mysql-community-server

The questions in the red box areGPG key validation issuescaused by the solution:

//Disable GPG verification check

yum -y install mysql-community-server --nogpgcheck

//check if installation is complete

rpm -qa|grep mysql

//Start the MySQL service

systemctl start mysqld

//Check the status of MySQL

systemctl start mysqld

//Find the MySQL initialization password, circled in the picture

grep 'temporary password' /var/log/

//Entering MySQL

mysql -u root -p

//Invisible when entering initialization password

Change your password before performing other operations, here change it to passwordrootA1234;

Note: MySQL's default password policy requires that passwords must be a combination of upper and lower case alphanumeric special letters with at least 8 digits.

// Modify the file to configure the default encoding as utf8

vi /etc/

//Add 2 lines to the end of the file and save it.

//character_set_server=utf8

//init_connect='SET NAMES utf8'

// Restart the MySQL service

systemctl restart mysqld

//Enter the database and check the code

mysql -u root -p

show variables like '%character%';

At this point, the MySQL configuration is complete

To exit MySQL, enterexitcan immediately (do sth)

5. Connect to MySQL in the virtual machine via Navicat

By default, MySQL only allows local users to log in, and does not allow remote logins, so if you want to connect to MySQL on other machines, you have to modify ROOT to allow remote connections, or add an account that allows remote connections, and for security reasons, add a new account here:

The password set hereRoot1234;is the password used for remote login

//Firewall open3306ports

firewall-cmd --zone=public --add-port=3306/tcp --permanent

//Reboot Firewall

firewall-cmd --reload

//查看开放ports

firewall-cmd --zone=public --list-ports

Open Navicat, create a new connection, and fill in the host asThe IP to which the virtual machine is assignedand the password is the previously created remote login password, click thetest connectionThe connection was successful!

Main references

  1. Installing MySQL8 with yum on CentOS7

  2. Installing CentOS 7 in VMware

  3. Installing and Configuring MySQL in CentOS7