The whole process of Centos7.9 network configuration and graphical interface installation

background

Currently, the latest version of Centos is version 8.3, but sinceCentos7Start, by default when installing the systemOnly install the command interface. This change has little impact on users who are accustomed to using the command line, but for users who like or are accustomed to graphical interfaces, it is difficult to accept at first. For this type of users, if you don't want to upgrade the new version, you can use Centos6, but you need to face a problem when upgrading the system-how to install a graphical interface in Centos. Next, the process of installing the graphical interface will be introduced in detail.

Centos network configuration (NAT mode)

After the current system is installed, the newly installed system is disconnected from the network by default, which
can be used ping www.baidu.comto view the network status. As follows:
insert image description here
In order to ensure that the yum command downloads the dependent package normally, the network needs to be configured in advance

1. Check the subnet mask, IP network segment, gateway, and network card MAC address

  1. Confirm that the IP network segment and subnet mask can be modified - remember the IP network segment and subnet mask here

1) Enter VMware workstation - edit in the upper left corner - enter the virtual network editor
insert image description here

2) Select VMnet8-click DHCP settings-view network segment
My network segment is: 10-254
Note: The first three segments of the IP address remain unchanged throughout the configuration
insert image description here
Subnet mask: 255.255.255.0
Click Change Settings to modify the range of the network segment (administrator privileges)

  1. Check the gateway—remember the address of the gateway
    . Under normal circumstances, the first three segments of the IP are the same as the subnet IP, and the fourth segment is in the
    format of 2: ×××.×××.×××.2
    insert image description here
  2. Check the network card MAC address - remember

1) Right click on the virtual machine - enter the settings page
insert image description here
2) Select the network adapter - click Advanced - enter the advanced settings page
insert image description here
3) View the MAC address
insert image description here

2. Modify the network configuration file

1. Use suthe command to switch to the root user (ordinary users have no permission to modify)
and enter the administrator password to enter the root mode
insert image description here
2. Enter the folder where the network configuration file is stored: find the corresponding network configuration file.
cd /etc/sysconfig/network-scripts
The network configuration file uses the network card name command, different network card names It will be different, generally take the first file
My configuration file name: ifcfg-ens33
insert image description here
3. Modify the configuration file
Use vithe command to enter the vim editor and modify the content of the ifcfg-ens33 file
Enter the following command: vi ifcfg-ens33
insert image description here
Enter the vim editor (initially in command mode)
insert image description here
and type characters iEnter edit mode
Note: You cannot type in text content in command mode. insert image description here
Modify it to the following content:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static  //设置为静态IP地址
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=30dd84d7-5323-4273-9965-24e3a8e3603d
DEVICE=ens33
ONBOOT=yes   //关键参数,改为yes,配置才会生效
IPADDR=192.168.×××.21      //自己根据IP网段选择喜欢的地址
NETMASK=255.255.255.0      //以下参数请参考:1、核查子网掩码、IP网段、网关、网卡MAC地址
GATEWAY=192.168.×××.2
DNS1=102.202.0.20      //DNS可设置多个,自行查找选择合适的地址或保持和我设置的相同也能正常使用
DNS2=8.8.8.8     
HWADDR=00:0C:29:59:7F:76

Contrast before and after:
insert image description here
After the modification is completed, press to Escexit the editing mode and enter the command mode .
Type the input command: wqsave the modified content (the vim editor is case-sensitive, pay attention to distinguishing) and
return the following results normally
. Available: cat ifcfg-ens33check whether the modified content is correct insert image description here
4. Restart the network Configuration
can use command 1:# /etc/init.d/network restart
insert image description here

Command 2 can be used:# service network restart
insert image description here

Both have the same effect

5. Check whether the modified network configuration takes effect
Command: ip addr show
insert image description here
Check whether there are IP addresses in the above two places. It can be seen from the figure that the configuration has taken effect, and the previous IP is the static IP address set

6. Test the network
After initializing the network, you can use curlcommands or pingcommands to test the network (recommended curl)
as follows:
curl www.baidu.com
insert image description here
It can be seen that the network connection is normal

ping www.baidu.com
Note: The ping command will continue to ping the domain name, the number of times is not limited, and it needs to be disconnected manually: ctrl+c
insert image description here

At this point, the network configuration has been completed, and the system can use commands to install various dependent packages normally yum. Next, various tools, including the graphical interface, will be installed.

3. Install the net-tools tool (including the Ifconfig command)

For a newly installed system, the net tools toolkit will not be installed by default, including commands such as ifconfig, netstat, and so on . Ever since, this package has become one of the necessary toolkitswhois

1. Before installation, as follows: Prompt command not found
insert image description here
2. Install net-tools tool
Through yum search, it is found that the ifconfig command is located in the net-tools.x86_64 package, and then use yum to download the tool package.
yum search ifconfiginsert image description here
Install the toolkit,
yum install net-tools.x86_64
insert image description here
enter the next step yto agree, and insert image description here
the installation is complete insert image description here
3. Test whether the ifconfig command is installed
correctly .ifconfig
insert image description here

4. Installation of vim command

Similarly, vimthe command will not be installed in the initial state of the system, and it needs to be installed by itself

1. Vim checks whether the command exists.
insert image description here
2. Search command toolkit
yum search vim
insert image description here
. 3. Install the toolkit one by one according to the above method
yum install [package name]
or use: yum -y install vim*install all at once
Note: Use the -y parameter here (choose y for all queries), and use the wildcard * to match all kits
insert image description here

The installation is complete
4. Test the installation effect
Command: vim ifcfg-ens33
insert image description here
Enter the vim editor normally and you're
insert image description here
done

Centos graphical interface installation

keep atroot authorityproceed next

1. Install the X Window System

1. Install the X Window System
command:yum -y groupinstall "X Window System"
Pay attention to capitalization and quotation marks
Note: There will be no query under this command, you need to manually agree to remove the parameter -y
insert image description here
2, wait for the component download and installation to complete
insert image description here
3, the installation is complete
insert image description here
4, check whether the installation is effective
Command: yum grouplist
Successful installation
installation is successful

2. Install the graphical interface software GNOME

1. Command: yum -y groupinstall "GNOME Desktop" "Graphical Administration Tools"
Note: Make sure that the package name is the same here, otherwise it will prompt: "No packages in any requested group available to install or update", pay attention to the space between the quotation marks and the capitalization of letters 2. Installation process
insert image description here
3.
insert image description here
Installation Finish
insert image description here

4. Start the graphical interface
Command:startx
insert image description here

Note:

  • The initial startup will be slow, so be patient.
  • Some functions will be set at the first startup, just follow the prompts and go all the way to the end.
  • After the installation is complete, if the virtual machine cannot be opened, the memory size allocated by the system needs to be adjusted. If the memory is too small, it will fail to start. Generally, 1024M is basically enough.
  • If the virtual machine reports error 0x0000005c after the installation is complete, please turn off the 3D acceleration function of the virtual machine (uncheck it)

3. Update the system default run level

After the above settings, the default startup mode is still the command mode, and it needs to be changed to a graphical interface startup
command as follows:
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
insert image description here
next time you restart the computer, it will be a graphical interface, like this:
insert image description here
now you can click on it, hahaha~

I am Xiaoxin, I hope the above content can be helpful to everyone, friends who like it can like/collect it~

If you find any problems during the reading process, please comment or private message, thank you for reading~

Guess you like

Origin blog.csdn.net/qq_44281591/article/details/115581082