CentOS 7 mini operating environment construction and testing - CentOS Mini installation ifconfig tool [Cloud native development and deployment practice notes]

Cloud native development and deployment practice notes

1. Development and testing environment construction and testing

1.1 Construction and testing of Linux operating environment

Although CentOS has been updated to Stream 9 version, most enterprises and organizations use CentOS 7 version as the running base, and version 7 has been updated and maintained. This practice is based on CentOS 7 Mini version. (There are few differences in CentOS system commands between versions 8 and 9, but the main ones used are actually the same. The biggest difference is that the system kernel and its own software components and libraries are relatively new. If enterprise development and deployment have requirements for compatibility, you should Select its requirement or matching version.)

1.1.1 CentOS 7 operating environment construction and testing

Download and install CentOS 7 mini. There are many installation tutorials online, so I won’t go into details.

Installation image download address:

http://isoredirect.centos.org/centos/7/isos/x86_64/

After installing the system according to the prompts, enter the system step-by-step configuration.

Some Mini versions do not have the ifconfig command by default. After the installation is complete, you can use the "dhclient" and "ip add" commands to query the IP address information. First, let CentOS connect to the Internet.

[root@localhost ~]# dhclient
[root@localhost ~]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:40:cf:dc brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.150/24 brd 192.168.2.255 scope global noprefixroute dynamic ens33
       valid_lft 602786sec preferred_lft 602786sec
    inet 192.168.2.231/24 brd 192.168.2.255 scope global secondary dynamic ens33
       valid_lft 604788sec preferred_lft 604788sec
    inet6 fe80::5720:3274:4656:f9a8/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
[root@localhost ~]# 

It is found that the local IP addresses are 192.168.2.150 and 192.168.2.231, and the local client pings the test. If the IP is connected, you can use the remote management tool to log in using the SSH command, which is convenient for copying, pasting and organizing commands.

ssh [email protected]

When "Are you sure you want to continue connecting (yes/no/[fingerprint])?" appears, enter "yes" to connect to the CentOS host.

The output information is as follows:

(base) tony@Mac ~ % ssh [email protected]
The authenticity of host '192.168.2.231 (192.168.2.231)' can't be established.
ED25519 key fingerprint is SHA256:gEwRjBgU36s9mLvP9R9oJOLEUPvy/KnSlFYIrtbIJ6Y.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:5: 192.168.2.150
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.2.231' (ED25519) to the list of known hosts.
[email protected]'s password: 
Last login: Thu Dec  7 10:18:29 2023 from 192.168.2.221
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[root@localhost ~]# 

Install ifconfig command
  1. First, let's find out which package provides the ifconfig command. To accomplish this task, enter the following command:
yum provides ifconfig

Output:

[root@localhost ~]# yum provides ifconfig
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
net-tools-2.0-0.25.20131004git.el7.x86_64 : Basic networking tools
Repo        : @base
Matched from:
Filename    : /usr/sbin/ifconfig

[root@localhost ~]# 

2. As you can see in the above output, the net-tools package provides the ifconfig command. So, let us install the net-tools package to use the ifconfig command.

yum install net-tools

3. Now, you can use the ifconfig command as usual.

[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.150  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::5720:3274:4656:f9a8  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:40:cf:dc  txqueuelen 1000  (Ethernet)
        RX packets 111766  bytes 160337382 (152.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15956  bytes 1308349 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 68  bytes 5912 (5.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 68  bytes 5912 (5.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# 

Guess you like

Origin blog.csdn.net/lqzixi/article/details/134868064