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

CentOS7 installation configuration

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

CentOS7 installation and configuration instructions for this article

1. Download CentOS7 ISO image

two。 Use VMware Workstation to create computer hardware resources, including cpu, memory, hard disk, network card and other information. This configuration is omitted in this article.

3. Use to install the CentOS7 operating system in a good ISO image and configure it before installation

4. Some common configurations after installation, including YUM configuration, network card configuration, etc.

5. Create an image to quickly restore to a relatively pure operating system later, and clone the operating system for use.

1. Download the CentOS7 operating system image

Here we recommend several domestic mirror sources to download faster than the official website. This article recommends a minimum installation version of Minimal. The reason is that the space is about 600m, and the clean DVD version of the system is about 4G.

Aliyun Mirror Source Huawei Cloud Mirror Source Tsinghua University Image Source

There are many other domestic mirror sources, such as NetEase mirror sources.

two。 Using VMware Workstation to create a virtual machine is omitted, this article shows my configuration

After that, you can start the virtual machine and install the operating system.

3 start the installation and configuration of the virtual machine and select Install CentOS7

Select operating system language

Configure operating system time zone, hard disk partition, etc.

This article does not customize the configuration of the disk, but uses the system default LVM logical volume as the default setting.

Start installing the CentOS7 operating system and configure the root user password

So far, the operating system has been installed successfully. After installation, configure the system network card, YUM source, SELinux, firewall

Network card configuration

Modify the network card configuration file

[root@localhost ~] # vi / etc/sysconfig/network-scripts/ifcfg-ens33TYPE= "Ethernet" PROXY_METHOD= "none" BROWSER_ONLY= "no" BOOTPROTO= "none" # modify "dhcp" to "none" or "static" can 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= "eth0" # No changes can be made here I habitually modify the name of the network card UUID= "219ac969-2c0b-4571-b8c8-f2bf7fe1e162" DEVICE= "eth0" # without modification here, I habitually modify the name of the device ONBOOT= "yes" # this configuration is whether to start the network card automatically. Yes automatically starts IPADDR= "11.1.1.31" # configure static IPPREFIX= "24" # subnet mask with 24-bit GATEWAY= "11.1.1.2" # default gateway DNS1= "114.114.114.114" # DNS domain name resolution DNS1 Arabic numerals 1 indispensable IPV6_PRIVACY= "no" #: wp save exit

If the name of NAME and DEVICE is not changed to eth0, after wq is saved and exited, the network card can be restarted to surf the Internet.

# restart the Nic command [root@localhost ~] # systemctl restart network

If you modify the name of NAME and DEVICE to eth0, you also need to configure as follows

# 1. Modify the name of the network card configuration file [root@localhost ~] # cd / etc/sysconfig/network-scripts/ [root@localhost ~] # mv ifcfg-ens33 ifcfg-eth0# 2. Modify the grub file parameter [root@localhost ~] # vi / etc/sysconfig/grub # net.ifnames=0 biosdevname=0 # I don't need ipv6 here So also disable ipv6.disable=1GRUB_TIMEOUT=5GRUB_DISTRIBUTOR= "$(sed's, release. * $, g' / etc/system-release)" GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT= "console" GRUB_CMDLINE_LINUX= "crashkernel=auto net.ifnames=0 biosdevname=0 ipv6.disable=1 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet" GRUB_DISABLE_RECOVERY= "true" #: wq save exit # 3. It takes effect after the changed grub file is restarted [root@localhost ~] # grub2-mkconfig-o / boot/grub2/grub.cfg# 4. Restart the operating system [root@localhost ~] # reboot

After reboot, we can use windows operating system such as xshell or MobaXterm to connect to shell tools to operate CentOS operating system.

SELinux configuration

[root@localhost] # vi / etc/sysconfig/selinux# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing-SELinux security policy is enforced.# permissive-SELinux prints warnings instead of enforcing.# disabled-No SELinux policy is loaded.SELINUX=disabled # modify enforcing to disabled# SELINUXTYPE= can take one of three values:# targeted-Targeted processes are protected,# minimum-Modification of targeted policy. Only selected processes are protected.# mls-Multi Level Security protection.SELINUXTYPE=targeted:wq # Save exit

Turn off the firewall and do not boot automatically.

[root@localhost ~] # systemctl disable firewalld [root@localhost ~] # systemctl stop firewalld

Modify hostname

[root@localhost ~] # hostnamectl set-hostname node3.sumailcode.cn [root@localhost ~] # reboot

YUM source configuration

Ali Cloud YUM source is used in this paper.

[root@node3 ~] # mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backup [root@node3 ~] # curl-o / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo[root@node3 ~] # yum clean all & & yum makecache fast [root@node3 ~] # yum update-y # update operation Installation of common software for system [root@node3] # yum-y install ntpdate git vim net-tools lrzsz #

Install the epel source, the package repository provided officially by CentOS, and epel contains some excellent open source software, including Nginx, etc.

[root@node3 ~] # wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Install docker source so that we can use docker to install software in the future.

# step 1: install some necessary system tools [root@node3 ~] # yum install-y yum-utils device-mapper-persistent-data lvm2# Step 2: add software source information [root@node3 ~] # yum-config-manager-- add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo# Step 3: update and install Docker-CE [root@node3 ~] # yum makecache fast [root@node3 ~] # Yum-y install docker-ce# Step 4: enable Docker service [root@node3 ~] # systemclt start docker# Step 5: boot Docker service [root@node3 ~] # systemctl enable docker# Step 6: configure Docker Aliyun Image Accelerator [root@node3 ~] # mkdir-p / etc/docker [root@node3 ~] # tee / etc/docker/daemon.json

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