Linux kernel compilation and CentOS system installation

1、 Compile and install the package##

Command: ./configure, make, make install
(1) ./configure: Check the dependencies of the compilation environment and set the compilation parameters;
(2) make: During the compilation process, make is not a compilation tool, but a project build tool, which invokes the required compilation tools to perform compilation operations;
(3) make install: copy the compiled files (files include: binary files, library files, help files, configuration files) to the specified directory during compilation.
Prerequisite: Prepare the development environment (development tools, development libraries), and place the installed header files in /usr/include.
Open source software provides the source code of the software. We need to compile it into an executable binary format. The release version of each open source software is made with the goal of "universal". We need to manually compile the source code to suit our needs. version of.

2、 Linux kernel compilation preparation##

(1) Prerequisite
1 ) Prepare the development environment;
2 1) Obtain the relevant information of the hardware device on the target host;
3 ) Get the relevant information about the target host system function, such as the file system to be enabled;
4 ) Get the kernel source code package: www.kernel.org.
(2) Prepare the development environment
1 ) The package groups used by CentOS 6.7 are as follows:
Development Tools
Server Platform Development
Desktop Platform Development
2 ) The package groups used by CentOS 7 are as follows:
Development Tools
Server Platform Development
Desktop Platform Development
Additional package required: ncurses-devel
(3) Obtain the relevant information of the hardware device on the target host:
1 )CPU:
~]# cat /proc/info``~]# lscpu``~]# x86info -a
2 ) PCI device:
~]# lspci: Display PCI information, options: -v, -vv;
~]# lsusb: Show USB information, options: -v, -vv;
~]# lsblk: Display block device or CD-ROM information''
3 ) To understand all hardware device information: hal (hardware abstract layer, hardware abstract layer)
~]# hal-device

3、 Kernel compilation process##

~]# tar  xf  linux-3.10.67.tar.xz  -C  /usr/src
~]# cd  /usr/src
~]# ln  -s  linux-3.10.67  linux
~]# cd  linux				
~]# make menuconfig configure kernel options
~]# make  [-j #]Compile the kernel, you can use-j specifies the number of compilation threads
~]# make modules_install install kernel module
~]# make install installs the kernel and automatically generates grub configuration options
Restart the system and choose to use the new kernel;

(1) The screen command:
Open screen: ~]# screen
Remove screen: Ctrl+a, d
List screen: ~]# screen -ls
Connect to screen: ~]# screen -r SCREEN_ID
Close screen: ~]# exit
(2) Detailed description of the process:
1 ) Configure kernel options
Support "update" mode for configuration: "modify" configuration based on the existing .config file;
( a) make config: Configure each option that can be configured in the kernel in a traversal manner based on the command line;
( b) make menuconfig: text configuration window based on cureses;
© make gconfig: Based on the window interface of the GTK development environment, the package group "Desktop Platform Development" does not depend on the GNome desktop, as long as there is a GTK library;
( d) make xonfig: Window interface based on QT development environment, KDE desktop development library;
Support "new configuration" mode for configuration:
( a) make defconfig: configure as a template based on the "default" configuration provided by the kernel for the target platform; .config will not be read;
( b) make allnoconfig: All options are "no";
2 ) Compile
( a) Multi-threaded compilation: make [-j #]
( b) Compile part of the code in the kernel:
( i) Only compile relevant code in a certain subdirectory:
# cd /usr/src/linux``# make path/to/dir/
( ii) Only compile a specific module
# cd /usr/src/linux``# make path/to/dir/file.ko
© Cross-compilation: the target platform is different from the platform where the current compiling operation is located;
# make ARCH=arch_name
To get help for a specific target platform:
# make ARCH=arch_name help
3 ) Recompile on the kernel source tree that has been compiled:
Clean up in advance:
# make clean: Clean up most of the files generated by the compilation, but will keep the config and the files needed to compile external modules;
# make mrproper: clean up all files generated by compilation, including config files generated by configuration and some backup files;
# make distclean: equivalent to mrproper, which additionally cleans up various patches and editor backup files.

4、 CentOS system installation##

(1) System installation procedure
The installation program is anaconda. After the bootloader starts, it loads the kernel, loads the root file system, and then starts the anaconda installation program. Anaconda has two installation interfaces: tui, cureses-based text configuration window, gui, graphical installation interface.
(2) The startup process of the CentOS installation process
The boot.cat file is used in the MBR stage, the isolinux/isolinux.bin file is used in the Stage2 stage, and the configuration file: isolinux/isolinux.cfg.
Each corresponding menu option:
Load the kernel: isolinux/vmlinuz;
Pass parameters to the kernel: append initrd=initrd.img;
Mount the root file system and start anaconda;
The default interface of anaconda is a graphical interface: 512MB + memory space;
If you need to explicitly specify to start the TUI interface, press the ESC key on the menu interface and pass a parameter "text" to the boot kernel: boot: linux text.
Note: The above content is generally located in the boot device, such as CD, U disk or network, etc. The subsequent anaconda and the program packages used for installation can come from the package warehouse. The location of this warehouse can be: local CD, local Hard disk, ftp server, http server, nfs server; if you want to manually specify the installation warehouse, press the ESC key and enter: boot: linux method.
(3) The working process of anaconda
1 ) Pre-installation configuration phase
( a) The language used during installation;
( b) Keyboard type;
© Install target storage devices: Basic Storage (local disk), Special Storage (iSCSI);
( d) Set the host name;
( e) Configure the network interface;
( f) Configure the time zone;
( g) Configure the administrator password;
( h) Set the partition method and the installation location of MBR;
( i) Create an ordinary user;
( j) Select the package to be installed;
2 ) Installation phase
( a) Create a partition on the target disk and perform formatting;
( b) Install the selected program package to the target location;
© Install bootloader;
3 ) First start
( a) Disable iptables;
( b) Disable selinux;
© core dump;
(4) How to configure anaconda
1 ) Interactive configuration mode;
2 ) Support automatic configuration by reading the pre-defined configuration items in the configuration file, following a specific syntax format, this file is the kickstart file;
(5) Install boot options
boot: text: text installation method
boot method: manually specify the installation method used
Network-related boot options:
ip=IPADDR``netmask=MASK``gateway=GW``dns=DNS_SERVER_IP
Boot options related to the remote access function:
vnc``vncpassword='PASSWORD'
Start emergency rescue mode: rescue
Load additional drivers: dd
For related installation process, please refer to the official website: www.redhat.com/docs in the "installation guide".
ks: Specify the location of the kickstart file;

ks=
DVD drive: ks=cdrom:/PATH/TO/KICKSTART_FILE
Hard Drive: ks=hd:/DEVICE/PATH/TO/KICKSTART_FILE
HTTP Server: ks=http://HOST[:PORT]/PATH/TO/KICKSTART_FILE
FTP Server:  ks=ftp://HOST[:PORT]/PATH/TO/KICKSTART_FILE
HTTPS Server:   ks=https://HOST[:PORT]/PATH/TO/KICKSTART_FILE

(6) The format of the kickstart file
1 ) Command section: Specify various pre-installation configuration options, such as keyboard type, etc., divided into mandatory commands and optional commands.
2 ) Program package section: Specify the program package to be installed and the package group, and also include the program packages that are not to be installed.

%packages
@ group_name
package-package%end

3 ) Script section:
%pre: pre-installation script, the running environment is the mini Linux system environment on the running installation medium;
%post: post-installation script, the running environment is the installed system;
4 ) Mandatory commands in the command section:
authconfig: Authentication mode configuration
authconfig --enableshadow --passalgo=sha512
bootloader: define the installation location and related configuration of the bootloader
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
keyboard: Set keyboard type
keyboard us
lang: language type
lang zh_CN.UTF-8
part: partition layout;
part /boot --fstype=ext4 --size=500``part pv.008002 --size=51200
rootpw: Administrator password
rootpw --iscrypted $6$4Yh15kMGDWOPtbbW$SGax4DsZwDAz4201.O97WvaqVJfHcISsSQEokZH054juNnoBmO/rmmA7H8ZsD08.fM.Z3Br/67Uffod1ZbE0s.
timezone: time zone
timezone Asia/Shanghai
5 ) Other commands related to partition
clearpart: clear partition
clearpart --none --drives=sda: clear the disk partition;
volgroup: Create a volume group
volgroup myvg --pesize=4096 pv.008002
logvol: create a logical volume
logvol /home --fstype=ext4 --name=lv_home --vgname=myvg --size=5120
Ways to generate encrypted passwords:
~]# openssl passwd -1 -salt openssl rand -hex 4
6 ) Optional command
install OR upgrade: install or upgrade;
text: installation interface type, text is tui, default is GUI;
network: configure the network interface;
network --onboot yes --device eth0 --bootproto dhcp --noipv6
firewall: firewall: firewall --disabled;
SELinux:selinux --disabled
halt, poweroff or reboot: the behavior after installation is complete;
repo: Specify the repository used during installation;
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
url: indicates the repository used during installation, but in url format;
url --url=http://172.16.0.1/cobbler/ks_mirror/CentOS-6.7-x86_64/
7 ) Disable the firewall after the system is installed
CentOS 6:
# service iptables stop``# chkconfig iptables off
CentOS 7:
# systemctl stop firewalld.service``# systemctl disable firewalld.service
8 ) Disable SELinux after the system is installed
Edit the /etc/sysconfig/selinux or /etc/selinux/config file and modify the value of the SELINUX parameter to one of the following: permissive or disabled;
selinux takes effect immediately:
# getenforce``# setenforce 0
9 ) Custom kickstart file
# yum install system-config-kickstart``# system-config-kickstart
Check for syntax errors:
# ksvalidator
10 ) Create CD image
~]# mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "CentOS 6 x86_64 boot" -c isolinux/boot.cat -b isolinux/isolinux.bin -o /root/boot.iso myboot/

Recommended Posts

Linux kernel compilation and CentOS system installation
CentOS 7.X system installation and optimization
Centos7.6 operating system installation and optimization record
CentOS7.5-1804 system kernel upgrade
Centos kernel compilation configuration
Linux notes (1): CentOS-7 installation
Linux CentOS 7 installation tutorial
Installation and configuration of JDK in CentOS 7 system
Correspondence between CentOS (RHEL) kernel version and system version
CentOS 6.5 system installation and configuration graphic tutorial (detailed graphic)
Centos mysql installation and configuration
Know Linux and install CentOS
Centos7 installation and configuration prometheus
Ubuntu and RHEL dual Linux operating system installation tutorial
CentOS 7 installation and configuration PPTP
CentOS installation and configuration cmake
The difference between CentOS and Ubuntu in Linux system
Centos7.5 installation and configuration MongoDB4.0.4
CentOS 7 installation and configuration PPTP
centos7 kvm installation and use
CentOS7 postgresql installation and use
Detailed tutorial on installing JDK8 on Linux system (CentOS7 installation)
CentOS8 Linux 8.0.1905 installation process (illustration)
Linux centos system boot process
Centos7 elk7.1.1 installation and use
Centos7 notes | operating system startup process, Linux users and permissions
Centos7 installation and configuration of Jenkins
Centos6.5 installation and deployment of KVM
Centos7 hadoop cluster installation and configuration
CentOS7 installation and maintenance of Gitlab
Linux: Centos7 upgrade the original kernel
Java-JDK installation and configuration under CentOS
CentOS 7 Tomcat service installation and configuration
001. Installation of enterprise-level CentOS7.6 operating system
CentOS NTP server installation and configuration
CentOs7 installation and deployment Zabbix3.4 original
Linux CentOS6 compile and install Pyt
Erlang 20.2 installation and deployment under CentOS 7
Centos7 mysql database installation and configuration
2019-07-09 CentOS7 installation
centos7_1708 installation
Installation and use of Mysql under CentOS
Tomcat installation and configuration under CentOS 7 (Tomcat startup)
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Ubuntu18.04 system installation and prerequisite software installation guide
Centos-6.5 installation and deployment of LNMP environment
Installation and configuration of redis under centos7
Centos7 installation and deployment of gitlab server
Install mysql8.0.13 version under Linux CentOS7 system
Centos python3 compile installation and compile gcc upgrade
Zabbix installation and deployment and localization under CentOS
Centos7 hive stand-alone mode installation and configuration
CentOS7 installation zabbix 4.0 tutorial (graphics and text)
Jenkins installation and deployment tutorial under CentOS 7
Ubuntu 14.04 16.04 Linux nvidia driver download and installation
KVM installation and preliminary use under CentOS 7.2
Linux install Docker and run Ubuntu system
Novice learning Linux (eight) ---- MySql installation (Centos7)
Centos7 installation and deployment of Airflow detailed
Python - centos6 installation
centos system management