Chapter 1 Use of centos7
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
Version used:
centos6
ubuntu14
Overcome the inherent shortcomings of init and improve the startup speed of the system
Reduce migration costs
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
As much disk space as possible
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
**5) Pay attention to check the power-on auto start **
Configure another network card in the same way
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.
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
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
Graphical tool for network management on centos7
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
[ 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
[ 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"
cat /etc/rc.local
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
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
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
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
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. .
systemctl start crond.service has the same effect as systemctl start crond.
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
[ 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.
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