centos7_1708 installation

Chapter 1 Use of centos7

1.1 Evolution of centos##

1.1.1 Start process sysvinit

Serial boot: one at a time, one by one

Parallel start: start all together

Advantages of init

It runs very well. Mainly rely on shell script

Init disadvantages

1、 Slow start

2、 Easy to conquer, fstab and nfs mounting problems

1.1.2 upstart technology###

Version used:

centos6

ubuntu14

1.1.3 systemd技术###

Overcome the inherent shortcomings of init and improve the startup speed of the system

Reduce migration costs

1.1.4 Comparison of three startup technologies###

1.1.5 Three principles of parallel startup:

1、 Solve socket dependency/port dependency

socket network socket file

2、 Solve D-Bus

Dependency: D-Bus is used as a communication tool between programs, similar to Message Queue, which can cache information

3、 Solve file system dependencies, similar to autofs mechanism

1.2 Install centos7 system##

1.2.1 Virtual machine selection###

As much disk space as possible

1.2.2 System installation###

1 ) Boot into installation

2 ) Press TAB

Add kernel parameters to make the network card name become eth

Enter net.ifnames=0 biosdevname=0 in the space and press Enter

  1. Choose a language

  1. Set up network connection and hostname

**5) Pay attention to check the power-on auto start **

  1. Set ip address

Configure another network card in the same way

  1. Modify hostname

  1. Choose the installation environment, choose the minimal installation.

Pay attention to check dependent packages

9 ) The disk partition is a custom partition.

Choose the size of the /boot mount point. Set here to 1g

Add swap mount point

Note that the selections are all standard partition types and write directly to disk

After adding the root partition, the selection is complete

Turn off password protection

Select close

Turn off KDUMP function

Start the installation, pay attention to 469 packages

Set the root password during installation.

1.3 Optimization after installation##

View system version

[ root@CentOS7 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611(Core)

Modify yum source, base source

[ root@CentOS7 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100257310025730029400--:--:----:--:----:--:--2940

epel source

[ root@CentOS7 ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100108410010840091500:00:010:00:01--:--:--916

install software

yum install vim wget bash-completion lrzsz nmap nc tree htop iftop net-tools -y

bash-completion****Complete the package of command parameters

1.4 The difference between centos7 and centos 6##

1.4.1 Solve the problem of name change after replacing the network card###

How to change the name

Modify the name of the CentOS7 network card to the traditional name eth0 format

http://oldboy.blog.51cto.com/2561410/1722101

1.4.2 nmtui

Graphical tool for network management on centos7

1.4.3 The difference between hostname configuration files###

Temporary hostname

Permanent /etc/hostname

[ root@CentOS7 ~]# cat /etc/hostname

CentOS7

complete in one step

[ root@CentOS7 ~]# hostnamectl

Static hostname: CentOS7

Icon name: computer-vm

Chassis: vm

Machine ID: 4ab1c20b25f64a38a7197b8453b04b2c

Boot ID: abd0a393540b4788bc1e571b413b33c4

Virtualization: vmware

Operating System: CentOS Linux 7 (Core)

CPE OS Name: cpe:/o:centos:centos:7

Kernel: Linux 3.10.0-514.el7.x86_64

Architecture: x86-64

Modify hostname

[ root@CentOS7 ~]# hostnamectl set-hostname clsn

1.4.4 character set###

[ root@clsn ~]# echo $LANG

zh_CN.UTF-8

[ root@clsn ~]# cat /etc/locale.conf

LANG="zh_CN.UTF-8"

complete in one step

[ root@clsn ~]# localectl

System Locale: LANG=zh_CN.UTF-8

VC Keymap: cn

X11 Layout: cn

1.4.5 View the system version number###

[ root@clsn bin]# cat /etc/os-release

NAME="CentOS Linux"

VERSION="7 (Core)"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="7"

PRETTY_NAME="CentOS Linux 7 (Core)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:centos:centos:7"

HOME_URL="https://www.centos.org/"

BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"

CENTOS_MANTISBT_PROJECT_VERSION="7"

REDHAT_SUPPORT_PRODUCT="centos"

REDHAT_SUPPORT_PRODUCT_VERSION="7"

1.4.6 Compatible rc.local

cat /etc/rc.local

Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure

that this script will be executed during boot.

Want to use rc.local to give him executable permission

[ root@clsn bin]# chmod +x /etc/rc.d/rc.local

[ root@clsn bin]# ll /etc/rc.d/rc.local

1.4.7 Runlevel

The previous method of viewing the run level is still used

[ root@clsn init.d]# runlevel

N 3

Original runlevel file

[ root@clsn init.d]# cat /etc/inittab

inittab is no longer used when using systemd.

ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.

Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target

systemd uses 'targets' instead of runlevels. By default, there are two main targets:

multi-user.target: analogous to runlevel 3

graphical.target: analogous to runlevel 5

To view current default target, run:

systemctl get-default

To set a default target, run:

systemctl set-default TARGET.target

7 Set run level

root@clsn init.d]# systemctl get-default multi-user.target

systemctl get-default #View the run level

[ root@clsn ~]# systemctl get-default

multi-user.target

[ root@clsn ~]# systemctl set-default multi-user.target

Removed symlink /etc/systemd/system/default.target.

Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

Run level changes

[ root@clsn ~]# ls -lh /usr/lib/systemd/system/runlevel*.target

lrwxrwxrwx. 1 root root 15 November 13 11:16 /usr/lib/systemd/system/runlevel0.target -> poweroff.target

lrwxrwxrwx. 1 root root 13 November 13 11:16 /usr/lib/systemd/system/runlevel1.target -> rescue.target

lrwxrwxrwx. 1 root root 17 November 13 11:16 /usr/lib/systemd/system/runlevel2.target -> multi-user.target

lrwxrwxrwx. 1 root root 17 November 13 11:16 /usr/lib/systemd/system/runlevel3.target -> multi-user.target

lrwxrwxrwx. 1 root root 17 November 13 11:16 /usr/lib/systemd/system/runlevel4.target -> multi-user.target

lrwxrwxrwx. 1 root root 16 November 13 11:16 /usr/lib/systemd/system/runlevel5.target -> graphical.target

lrwxrwxrwx. 1 root root 13 November 13 11:16 /usr/lib/systemd/system/runlevel6.target -> reboot.target

1.4.8 systemd一统天下###

Directory of system startup files

[ root@clsn init.d]# ls /usr/lib/systemd/system

[ root@clsn init.d]# cat /usr/lib/systemd/system/crond.service

[ Unit]

Description=Command Scheduler

After=auditd.service systemd-user-sessions.service time-sync.target

[ Service]

EnvironmentFile=/etc/sysconfig/crond

ExecStart=/usr/sbin/crond -n $CRONDARGS

ExecReload=/bin/kill -HUP $MAINPID

KillMode=process

[ Install]

WantedBy=multi-user.target

Grammar format

http://www.jinbuguo.com/systemd/systemd.service.html

1.4.9 Management Service###

Turn off the firewall service and start automatically

systemctl stop postfix.service

systemctl disable postfix.service

Turn off the firewall detailed process

[ root@clsn ~]# systemctl disable firewalld.service

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[ root@clsn ~]# systemctl stop firewalld.service

[ root@clsn ~]# systemctl status firewalld.service

systemctl: integrates the functions of service and chkconfig, is compatible with SysV and LSB startup scripts, and is capable of bootloading services more effectively during process startup. .

1.4.10 Command comparison###

systemctl start crond.service has the same effect as systemctl start crond.

1.4.11 Boot time optimization###

systemd-analyze time

systemd-analyze blame

systemd-analyze plot >bootime.avg

Boot time

[ root@clsn system]# systemd-analyze time

Startup finished in 387ms (kernel) + 1.406s (initrd) + 31.831s (userspace) = 33.626s

Check the specific usage time

[ root@clsn system]# systemd-analyze blame

10.812 s sshd-keygen.service

10.758 s abrt-ccpp.service

6.395 s chronyd.service

……

Production chart

[ root@clsn tmp]# systemd-analyze plot >bootime.svg

[ root@clsn tmp]# sz bootime.svg

1.4.12 Startup item optimization

[ root@kickstart ~]# systemctl list-unit-files|egrep "^ab|^aud|^kdump|vm|^md|^mic|^post|lvm" |awk '{print $1}'|sed -r 's#(.*)#systemctl disable &#g'|bash

Removed symlink /etc/systemd/system/multi-user.target.wants/abrt-ccpp.service.

Removed symlink /etc/systemd/system/multi-user.target.wants/abrt-oops.service.

Removed symlink /etc/systemd/system/multi-user.target.wants/abrt-vmcore.service.

Removed symlink /etc/systemd/system/multi-user.target.wants/abrt-xorg.service.

Removed symlink /etc/systemd/system/multi-user.target.wants/abrtd.service.

Removed symlink /etc/systemd/system/multi-user.target.wants/auditd.service.

Removed symlink /etc/systemd/system/basic.target.wants/microcode.service.

Removed symlink /etc/systemd/system/multi-user.target.wants/vmtoolsd.service.

Removed symlink /etc/systemd/system/vmtoolsd.service.requires/vgauthd.service.

1.4.13 Chinese Reference Document###

https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/index.html

Nginx starts automatically at Windows boot

C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

C:\Users\default.DESKTOP-U9D5JP4\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Recommended Posts

2019-07-09 CentOS7 installation
centos7_1708 installation
Python - centos6 installation
Docker installation (CentOS7 installation)
CentOS online installation RabbitMQ3.7
CentOS 8 (2)
Zabbix 2.2.20 installation details (Centos6.9)
Centos source installation Python3
lamp (centos7) installation lamp environment
Centos7 mqtt cluster installation
Graphical installation of CentOS8
Linux notes (1): CentOS-7 installation
Redis3 installation under Centos7
CentOS 8 (1)
CentOS online installation RabbitMQ3.7
Docker CentOS installation method
Linux CentOS 7 installation tutorial
Centos7 docker installation details
Discourse CentOS 8 new installation manual
Centos 7 mini installation process record
Centos mysql installation and configuration
Glusterfs cluster installation on Centos7
Redis cluster installation under CentOS
Centos7 installation and configuration prometheus
CentOS 7 Galera Cluster installation guide
CentOS 6.x installation mysql5.7 record
CentOS installation and configuration cmake
Graphical centos installation detailed process
Redis cluster installation under CentOS
Hyper-V + CentOS7 installation video tutorial
centos7 kvm installation and use
Centos7 silent installation of Oracle11g
CentOS 6.8 virtual machine installation details
CentOS7 postgresql installation and use
CentOS environment installation of Docker
Centos7 installation tomcat process introduction
Centos7.4 environment installation lamp-php7.0 tutorial
Docker EE installation on centos7
Discourse CentOS 8 new installation manual
CentOS8 Linux 8.0.1905 installation process (illustration)
Centos7 elk7.1.1 installation and use
Centos7 installation and configuration of Jenkins
Analysis of Hyper-V installation CentOS 8 problem
Centos iso image file installation tutorial
Centos7 installation is actually very simple
Centos6.5 installation and deployment of KVM
CentOS 8 installation of MariaDB detailed tutorial
centos7 python3.7+vi
Installation under centos6.9 of jenkins learning
CentOS6 minimal installation KVM detailed tutorial
Centos7 hadoop cluster installation and configuration
CentOS7 installation and maintenance of Gitlab
CentOS + Python3.6+
CentOS + Jenkins
MXNet-Ubuntu installation
Centos8 installation diagram (super detailed tutorial)
CentOS 7.X system installation and optimization
Java-JDK installation and configuration under CentOS
Initialize after CentOS 7 installation is complete
CentOS 7 Tomcat service installation and configuration
001. Installation of enterprise-level CentOS7.6 operating system