Centos Foundation and Installation
Centos installation
1. Linux version derivation
|- AT&T Unix: AT&T was originally developed, and later set up Bell Laboratory with Western Electric Company to continue to develop Unix from UNIX to UNICS (UNiplexed Information and Computing Service), while unics Brian Kernighan is a tease to Multiplexed Information and Computing Service. |- Unix: Closed Source, R&D developer Bell Laboratory, acquired by Nokia in April 2015, is now the R&D Department of Nokia. |- Berkeley Software Distribution (BSD) Open Source: unix Version released by the University of California, Berkeley |- Jolix | 386BSD: William Jolitz, Lynne Jolitz, University of California, Berkeley |-NetBSD: The NetBSD Foundation |- OpenBSD: The OpenBSD Project, developed from NetBSD Forked, contributes mainly to OpenSSH |- FreeBSD: The FreeBSD Project, based on the 1992 release version of BSD, was redeveloped due to disapproval of the future research and development plan for 386BSD. |- Darwin: Apple Inc's Open Source Operating System |- MacOS: Apple Inc's closed-source operating system, Macintosh, originated from an Apple called McIntosh, and I don't know if it was Jobs who intentionally or unintentionally misspelled it. |- Linux, Open Source Implementation of Unix (GPL), but not based on Unix code |- Debian (a combination of the names of Ian Murdock, the founder of Debian, and his wife Debra) |- Red Hat Linux(RHL) Open Source |- Red Hat Enterprise Linux(RHEL) Closed Source |-Fedora |- CentOS (Community Enterprise Operating System) Centos does not have its own kernel and uses the redhat kernel |- Oracle Linux (Oracle means oracle, because CIA wants this software system to guide them like oracle, quickly find the information they need, Oracle first developed information management software for CIA) |- Ubuntu: Canonical Ltd., Ubuntu community (named "ubuntu" from Zulu or Hausa in southern Africa, which means "human nature" and "my existence is due to the existence of all", is a traditional African value, similar to the "benevolence" thought of Chinese society. ) |- SUSE Linux (meaning "Software-und System-Entwicklung" is a German sentence, English is "Software and system development") |-openSUSE |-Linux Router Project |-LEAF (Linux Embedded Appliance Framework Project) |-Alpine Linux |- linksys GPL (estimated based on the linux kernel) |- OpenWrt (Open Wireless Router), originally named for Linksys WRT54G Wi-Fi routers, is currently merged with (LED E) Linux Embedded Development Environment |- DD-WRT (Open Wireless Router), |- The Android kernel uses GPL linux and BSD libc for authorization segmentation |- PhotonOS (Vmware Lightweight Operating System for Container Development)
Bell Labs AT&T Bell Laboratories | Bell Telephone Laboratories | Bell Labs | Nokia Bell Labs
1925 year Western Electric Research Laboratories and American Telephone & Telegraph company Some of the engineering departments have assembled Bell Laboratories, and the two companies share ownership equally.
https://upload.wikimedia.org/wikipedia/commons/1/1b/Linux_Distribution_Timeline.svg
https://en.wikipedia.org/wiki/Unix-like#/media/File:Unix_history-simple.svg
SSH Available Pre-Configuration
- Modify the network card name and disable ipv6
Modify the / etc/sysconfig/network-scripts/ifcfg-e***file
NAME=eth0 DEVICE=eth0
Rename the file / etc/sysconfig/network-scripts/ifcfg-e*** to ifcfg-eth0
Modify the GRUBCMDLINELINUX variable in the / etc/default/grub file
net.ifnames=0 biosdevname=0 ipv6.disable=1
Run command
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
Close the firewall (later to develop 22 ports and icmp protocol)
systemctl stop firewalld systemctl disable firewalld
- Setting static IP
Modify the / etc/sysconfig/network-scripts/ifcfg-eth0 file
BOOTPROTO="static" IPADDR="198.18.0.129" PREFIX="24" GATEWAY="198.18.0.1" ONBOOT="yes" #DNS1(DNS can be configured globally) #DNS1
Password login SSH configuration other options
- Setting DNS/etc/resolv.conf
nameserver 223.5.5.5 nameserver 223.6.6.6
- Install wget (Docker container recommended curl instead)
yum install wget
- yum source configuration
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
Non-Ali Cloud Intranet Host
Modify the / etc/yum.repos.d/CentOS-Base.repo file
Delete all links with aliyuncs.com
- Upgrade the latest system
yum update - Editor VIM Installation
yum -y install vim-enhanced telnet - Close and disable firewalls
(Temporary solution, firewall filtering rules should be set)
systemctl stop firewalld
systemctl disable firewalld - System Language Configuration
Function to prevent Chinese scrambling on various platforms
View the current system code
locale
View System Installed Codes
locale -a
Language Coding Switching
Compile / etc/profile file and add code at the end of the file
export LANG=en_US.UTF-8
- Time Server Configuration
Inspection of installation
rpm -q ntp
install
yum -y install ntp systemctl enable ntpd systemctl start ntpd
Manual Time Synchronization
ntpdate -u ntp1.aliyun.com clock -w(Write hardware CMOS Otherwise, restart will be restored)
- time zone
tzselect - Time zone view
date -R
TZ='Asia/Shanghai'; export TZ added to / etc/profile
Timedatectl set timezone Asia / Shanghai
Aliyun NTP Server
ntp1.aliyun.com,0x1
ntp2.aliyun.com,0x1
ntp3.aliyun.com,0x1
ntp4.aliyun.com,0x1
ntp5.aliyun.com,0x1
ntp6.aliyun.com,0x1
ntp1.cloud.aliyuncs.com,0x1
ntp2.cloud.aliyuncs.com,0x1
ntp3.cloud.aliyuncs.com,0x1
ntp4.cloud.aliyuncs.com,0x1
ntp5.cloud.aliyuncs.com,0x1
ntp6.cloud.aliyuncs.com,0x1
ntp7.cloud.aliyuncs.com,0x1
ntp8.cloud.aliyuncs.com,0x1
ntp9.cloud.aliyuncs.com,0x1
ntp10.cloud.aliyuncs.com,0x1
ntp11.cloud.aliyuncs.com,0x1
ntp12.cloud.aliyuncs.com,0x1
Another method, chrony(centos7)
chronyc sourcestats && systemctl is-enabled ntpd && systemctl is-enabled chronyd
- SSH login key generation and configuration
Key generation
ssh-keygen -t rsa
Copy the pubkey of the authorized logged-in user to the authorzied_keys file of the server
~/.ssh/authorized_keys
Ensure authorized_keys file permissions are 600 (otherwise connections will be rejected and logs are unrecorded)
User login welcome word configuration modification/etc/motd file
Fault troubleshooting method/usr/sbin/sshd-d debugging mode start-up log
Local virtual machine Welcome to SherryBlue.Org Virtual Host!
Cloud server Welcome to SherryBlue.Org @ Aliyun Elastic Compute Service!
- Setting Host Name
hostnamectl set-hostname docker1
Automatic Configuration Script
#!/bin/bash #1.DNS configuration echo "nameserver 223.5.5.5" >> /etc/resolv.conf echo "nameserver 223.6.6.6" >> /etc/resolv.conf #2.yum source configuration yum -y install wget wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo sed -i '/aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo yum clean metadata yum makecache yum -y update # Install epel Ali Cloud Source wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache #3. Environmental variable settings echo "export LANG=en_US.UTF-8" >> /etc/profile #Code echo "export TZ='Asia/Shanghai'" >> /etc/profile #time zone echo "MYDOCKER_HOME=/data;export MYDOCKER_HOME" >> /etc/profile #Docker echo "export PATH=\$PATH:\$MYDOCKER_HOME/docker-file/bin" >> /etc/profile echo "DOCKER_REGISTRY=registry-vpc.cn-hangzhou.aliyuncs.com/lineto; export DOCKER_REGISTRY" >> /etc/profile source /etc/profile #4. Time zone and clock timedatectl set-timezone Asia/Shanghai yum -y install ntpdate ntpdate ntp1.aliyun.com clock -w #5.SSH key login configuration sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config sed -i 's/#PubkeyAuthentication/PubkeyAuthentication/g' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config mkdir -p /root/.ssh/ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjDQ6Ss/R65zPsdzGndM2qroAWHFuJ2LvxD3oLj9VIpGLqj1SfKTvLmUvDnG2kqD4P8lWjn9UiyYgYj3tLzxCRT1/QYW/R1a5NrpM2aAiZ6lVueeQ4anj2FRWqczEnxp+pidGh6vXF4dnE68am9A+/SDbsnu8UIZb2rxEfNp2W0t8WJQ5bTZtFHBmsa8/HCwX+DS8VABMgYJjWFExrO+qVejjUj8pz6QtOriQE7YT3s3pHXC4lt4usVcwB1SYTNrpgf1wrhDr7vSvOB7YPJAPQ1pCFXu+V3GfRkFoRJwZGqg4hSBheV9y66megsTriFMWYEjZR2tBT+dcmTtyFRwBd blue@blue.sherryblue.org" >> /root/.ssh/authorized_keys /etc/motd service sshd restart #6. Turn off SELinux (in some cases, SELinux can cause permission problems such as file reading failure) setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config #7. Installation of firewall services (many times we need address mapping, this command is very convenient) yum -y install iptables-services #8. Close the postfix service (port 25) systemctl stop postfix #Need to open again by mail systemctl disable postfix #09. Memory and SWAP optimization sysctl vm.swappiness=0 #Priority for using physical RAM as detailed in the Performance Test Memory section echo "vm.swappiness = 0" >> /etc/sysctl.conf #10. Host name configuration hostnamectl set-hostname mesos-master reboot
crontab -e
- */1 * * * /usr/sbin/ntpdate ntp.d.com
Other common debugging tools
yum install lsof # Total download size: 331 k Installed size: 927 k
yum install iotop (process-level hard disk and network io read-write monitoring)
yum install sysstat (system monitoring tools, iostat, etc.)
yum install traceroute
yum install hdparm
iperf rpm Packet Installed size: 181 k (Bandwidth Check)
Kernel parameters (to be tested)
vm.dirty_background_ratio=10
vm.dirty_ratio=20
hung_task_timeout_secs error in some cases
Sep 24 08:44:54 docker75 kernel: INFO: task nfsd:413 blocked for more than 120 seconds. Sep 24 08:44:54 docker75 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Centos Kernel Upgrade
Tsinghua Mirror https://mirrors.tuna.tsinghua.edu.cn/elrepo/
#Installing Kernel Sources rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/elrepo/kernel/el7/x86_64/RPMS/elrepo-release-7.0-2.el7.elrepo.noarch.rpm #View the supported mainline version yum --enablerepo=elrepo-kernel list kernel-ml-devel kernel-ml --showduplicates #Install the latest mainline version of the kernel yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y #Install the latest longtern version of the kernel yum --enablerepo=elrepo-kernel list kernel-lt-devel kernel-lt --showduplicates
Initialization Process of Virtual Machine on H3C CAS Platform
Setting CD-ROM Priority Start Install centos operating system Install CATools Close and disable firewalls systemctl stop firewalld.service systemctl disable firewalld.service Install Blue Whale Client Server Initialization Configuration Using Blue Whale Install System Monitoring Client