centos7 installation process and host configuration

This article records the whole process of CentOS 7 64 bit installation on the virtual machine, which I downloaded for my future installation and use

Download address: http://mirrors.aliyun.com/centos/7/isos/x86_64/ Download centos-7-x86_-dvd-1908.iso

Configure the network environment

For the next step of the previous graphic, please refer to this article https://blog.csdn.net/babyxue/article/details/80970526 When selecting software, do not use graphic interface, that is, select infrastructure server in this step

After the installation is completed, ping www.baidu.com can't ping. ip addr shows that the network card is ens33. It prompts you to install VMware Tools. Double click each big bell sound of TAB, and the vi compiler will also have a bell sound. These are all to be handled

First, check whether the 64 bit version is installed, or the later operations will be wasted

getconf LONG_BIT

Step by step, first remove the ugly bell sound

# Remove the bell sound from the command line
vi /etc/inputrc
set bell-style none

# Remove the bell sound of vi
vi /etc/bashrc 
setterm -blength 0

# vi you can make the configuration effective through source /etc/bashrc

You need to restart it to take effect. It will not take effect here. Try to reload the resource

Configure the network environment

  1. View virtual machine gateway

  1. Configure NIC

    Because the name of the centos7 network card is not the same as that of the previous centos6, you need to modify the name of the network card first

    # First change the file to ifcfg-eth0 
    cd /etc/sysconfig/network-scripts
    mv ifcfg-ens33 ifcfg-eth0
    # Change the device name to eth0
    vi ifcfg-eth0
    #Disable the predictable naming rule edit / etc/default/grub and add "net.ifnames=0 biosdevname=0" to grub ﹣ CmdLine ﹣ Linux 
    //In grub? CmdLine? Linux=" quiet net.ifnames=0 biosdevname=0"
    #Rebuild GRUB configuration and update kernel parameters 
    grub2-mkconfig -o /boot/grub2/grub.cfg
    # We need to restart it to take effect. We will not restart it temporarily. Then we will configure the network
    vi ifcfg-eth0
    # Except for DEVICE and NAME, all other key values are deleted and reconfigured. Finally, this configuration should look like this
    # ip address, mask and gateway, gateway is the gateway seen in the first step; ip must be in the same network segment with gateway
    # dns address for domain name resolution 
  2. Restart to verify that the network is working

    ping www.baidu.com

Press ctrl+alt to install vmtools every time you switch between virtual machine and physical machine

Note: this step is not necessary, but a convenient step

# Mount cdrom. The device file is in / dev/cdrom. In fact, it points to / dev/sr0 
mkdir /mnt/cdrom && mount /dev/cdrom /mnt/cdrom 
# Copy the vmtools file to the tmp directory and install 
cp VMwareTools-9.6.0-1294478.tar.gz /tmp 
tar -zx -f VMwareTools-9.6.0-1294478.tar.gz
cd vmware-tools-distrib
# After entering the directory, you can see that there is a vmware-install.pl
# Check whether there is GCC environment. If not, install gcc gcc-c + + package first 
which gcc 
# Without gcc environment, install gcc environment first. Here, use that DVD image for local installation 
# 1. Reinstall the dvd image and mount the CDROM. 2. Configure the yum source as the local source
cd /etc/yum.repos.d
# Mask the underlying source and only use the mirror source
mv CentOS-Base.repo CentOS-Base.repo1
# Configure local mirror source
vi local.repo
name = localrepo
baseurl = file:///mnt/cdrom
enable = 1
gpgcheck = 0
# Install gcc gcc-c++
yum clean all
yum install -y gcc gcc-c++

# At this time, I failed to install vmtools. I said that I couldn't find the kernel header file. Check that the / usr / SRC / kernel directory is empty
#1. Install kernel devel
yum install -y kernel-devel
#2. Establish symbolic link
ln /usr/src/kernels/3.10.0-229.4.2.el7.x86_64/include/generated/uapi/linux/version.h /usr/src/kernels/3.10.0-229.4.2.el7.x86_64/include/linux/version.h

# Install vmtools, and then it succeeds

Some basic configurations

At this time, we can use terminal tools such as xshell and secureCRT to connect to linux. If not, check whether iptables is turned off and sshd service is turned on

# Turn off firewall
systemctl stop firewalld
# View sshd service status
systemctl status sshd.service

Command prompt configuration

When writing a command, if the prompt and output a color, the eyes will be blind to find the place where the command was first issued, so I usually configure the color for the command prompt

vi /etc/bashrc
PS1='[\[\e[1;34m\]\u@\h\[\e[m\] \W]\$ '
PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[36;40m\]\w\[\e[0m\]]\\$ "

vim settings

About indentation

# tabstop refers to the width of how many spaces are indented by pressing the tab. softtabstop refers to the backspace key that can delete four spaces at a time
# tabstop is equivalent to ts 
set tabstop=4
set softtabstop=4
# Shift width refers to the indent width when pressing shift plus > twice in normal mode, i.e., < < > > said on the Internet, with 8 spaces by default 
set shiftwidth=4
# set expandtab converts the input tab to a space
set expandtab

# vimrc Note in is not used # The complete setting is like this, so input tab is equivalent to input 4 spaces, and backspace can delete 4 spaces at a time
set softtabstop=4
set shiftwidth=4
set expandtab

You can use set list to view the tab symbol, but at this time, the tab will become two spaces. I don't know why

My vim settings

Ignore case when set ignorecase is used for search

set nu

set softtabstop=4
set shiftwidth=4
set expandtab

set autoindent

set ignorecase

Host name modification

When you use hostname to view the host name, it is displayed as localhost.localdomain. When you use hostname -i to view the ip address, it is not the ip address of the current host, which needs to be modified

vi /etc/hosts  localhost master localhost master

Add alias configuration

vim /etc/bashrc 
alias grep='grep --color=auto'
alias vi='vim'
alias ll='ls -lth --color=auto'

Common software installation

jdk1.8 installation

This is a must. This host is ready to be a clone parent, so there are enough preparations. Unzip the installation package and configure the environment variables

export PATH=$PATH:$JAVA_HOME/bin

Reference article:

Different versions of CentOS (DVD/Everything/Minimal, etc.)


Graphic display installation of centos7


Modify network card name


Install the package using local yum



Can't find the header solution Enter the path to the kernel header files for the 3.10.0-327-generic kernel?



/Solution of empty usr/src/kernels directory


hostname settings


91 original articles published, 75 praised, 10000 visitors+
Private letter follow

Tags: network CentOS yum Linux

Posted on Sat, 18 Jan 2020 04:05:19 -0500 by hanji