Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install CentOS7 in VMware (set static IP address) and install mySql database through docker container (hyperdetailed tutorial)

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

A sophomore asked me how to install and configure these. I simply completed a tutorial. Record it here and share it with friends who need it.

Installation process to learn to use enough, some tedious configuration in the actual work has been skipped!

Open the VM virtual machine, the menu bar "File"-- > Select "New Virtual Machine", and select "o Custom (Advanced)"-> "next step"

By default, click [next] to select the location of the installation disk, and select the official DVD image file that you have downloaded (do not integrate other images and avoid unnecessary steps).

The pit)

[next] set the virtual machine name (take an appropriate name and set the appropriate path)

The processor is set by default. After installing the virtual centos, it can be set and adjusted according to the situation. It is not necessary to set it at this time.

The memory setting is default, which will be adjusted later according to usage.

[next] choose the network type and use "NAT" network mode. If centos needs to configure a static ip address, it is required. If you do not need to configure a static ip address, choose "bridging" and "NAT" is recommended.

Always default [next] to "Select disk", and select "create New Virtual disk" by default

[next] "specify disk capacity". Modify the default value of 20 to 10, which is not enough for further increase.

By default, [next] finally click "finish"

After clicking "finish", the installation guide appears, and learn to use the recommended "Chinese" language to avoid walking into the pit. However, it is generally recommended that English is a programmer after all.

Click [continue]

Click "Software selection" and select "O Server with GUI". Do not check the attachment option on the right for the time being. Personal PC learn to use the advice GUI to avoid walking into the pit and burying yourself. Those who like self-abuse can choose the minimum installation, and those who like to make trouble can choose at will.

Click "finish" to jump out. Click "installation location", the default settings are available, and then click "finish" to jump out.

Click "Network and Hostname", turn on the Ethernet switch, and you can set the hostname yourself. Do not move the configuration options.

After configuring [complete], click "start installation", click "root password" to set the password to 123456 (don't set it too complicated), and click the "finish" button twice to jump out. Click "create user", set the user and password (not too complicated), and check "make this user as administrator". Wait for the installation to complete.

Click "restart" when the installation is complete, and wait for it to start by itself.

After reboot, pop up "initial Settings" and click in to check the "I agree to the Agreement" check box, and click the "finish" button to jump out. Finally, click "finish configuration" in the lower right corner.

The login users listed in the interface are the users we created earlier. We log in with root users and click "not listed".

Enter the user name "root", enter the previously set password 123456, and confirm to log in to the system interface "forward"-"forward"-"skip"

Click "applications" in the upper left corner and select "Terminal"

Open the Terminal window and enter ifconfig

Ens33 is the default network connection name, and there is no ip address. At this time, whether it is the ip of the ping host or the URL of ping Baidu, ping is impassable.

= split line = =

= split line = =

= split line = =

Configure the network connection for the virtual centos7

Select "Edit"-"Virtual Network Editor"

Click [change Settings]

In the following figure, select the "NAT mode" column in the list above the pop-up window. Subnet ip sets 192.168.xxx.0. Do not set xxx the same as the host. For example, if the host ip is 192.168.1.123, then the xxx should not be equal to 1. If the ip of the host is similar to 170.20.12.14, then xxx can be set at will. (it is recommended not to set xxx to 0 or 1, but to set similar numbers such as 110111. When the host connects to different WiFi (routers), the ip change may cause the xxx value of "subnet ip" to be the same as that of the host. If the same, modify the xxx value of "subnet ip" to avoid being the same. )

Click the [NAT Settings (S)...] button to set the gateway ip. The values of the first three segments of the gateway ip are the same as those of the subnet ip, and the settings of the last segment are not the same as the subnet ip. Finally, click "confirm"-"apply"-"confirm".

Next, edit the configuration file and open the Terminal window

Enter: vim / etc/sysconfig/network-scripts/ifcfg-eno33 modify configuration file

After entering the file, press a to enter edit mode

Modify and add configurations, such as red

After the modification is completed, press "ESC"-enter ": wq" in the terminal window, click enter key to save and exit editing restart service: service network restart input: ifconfig to view network information, you can see that our static ip setting is successful.

Ping Baidu can ping. (Ctrl+z exits ping)

Host ping virtual centos7 can also communicate with ping.

If the virtual centos7 does not work in ping Baidu, set:

Select the correct network adapter vmnet8 is the network adapter set by NAT, right-click "Properties"

Check to see if the ip address of the ipv4 of the VMnet8 network adapter is custom. The custom ip address cannot be the same as the gateway configured by VMware (192.168.11.1) or the static ip address configured in the virtual centos7 (192.168.11.101).

Then in the virtual centos, ping Baidu can communicate with ping.

Finally, no matter which new WiFi (router) the host connects to, the ip address of the virtual centos7 is fixed.

= split line = =

= split line = =

= split line = =

Install docker

Log in with 1.root permission and update yum (make sure that the network speed meets the update requirements before updating). Generally, you can only update yum on your personal system, and do not update your production environment at will.

Terminal input:

Yum update

3. If an error is reported:

Package does not match intended download indicates that the version conflicts when updating. Execute: yum clean all at this time

4. Uninstall the old version:

Yum remove docker docker-common docker-selinux docker-engine

5. Install the required software packages:

Yum install-y yum-utils device-mapper-persistent-data lvm2

6. Set yum feeds (Ali feeds, relatively fast)

Yum-config-manager-- add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

7. Installation: (since only stable warehouse is opened by default in repo, the latest stable version 17.12.0 is installed here.) start yum install docker-ce and join boot

8. Launch: systemctl start dockersystemctl enable docker

Verify that the installation is successful (both client and service indicate that the docker installation starts successfully)

Docker version

= split line = =

= split line = =

= split line = =

Docker install mysql

1. Terminal nominator: docker search mysql

2.pull takes mysql image

Docker pull mysql:5.6

3. Configure mysql

Naming character:

Docker run-p 3306 name mysql-demo 3306-- restart=always-- name mysql-demo-v / usr/local/gourd/docker/mysql/conf:/etc/mysql/conf.d-v / usr/local/gourd/docker/mysql/logs:/logs-e MYSQL_ROOT_PASSWORD=123456-d mysql:5.6

Command description:

-p 3306virtual 3306: map port 3306 of the container to port 3306 of the host.

-- restart=always when Docker is restarted, the container will also restart

-- name mymysql names the container

-v $PWD/conf:/etc/mysql/conf.d: Mount the conf/my.cnf under the current directory of the host to the / etc/mysql/my.cnf of the container.

-v $PWD/logs:/logs: Mount the logs directory under the current directory of the host to the / logs of the container.

-v $PWD/data:/var/lib/mysql: Mount the data directory under the current directory of the host to the / var/lib/mysql of the container.

-e MYSQL_ROOT_PASSWORD=123456: initializes the password of the root user.

4. Naming character: docker start (image-name) starts the image

Naming character: docker ps-s to view the running image

Connect to mysql with Navicat:

Summary

The above is introduced by the editor to install CentOS7 (setting static IP address) in VMware and install mySql database through docker container. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report