I. Installing a virtual machine two. Install CentOS three. Configure IP1. Enter Ifconfig to view the network card Ip,lo is the loopback network card, IFCONFIG-A view the real network card ip2.dhclient #在有dhcp服务器的情况下, automatically get a Iproute # View netmask (subnet mask) and gateway (network segment) Vi/etc/sysconfig/network-scripts/ifcfg-eth0 #更改ONBOOT为yes (Power on auto-start), Bootproto to static # Static IPIPADDR #IP地址NETMASK #子网掩码GATEWAY #网关service Network Restart # Restart the NIC-----------------------------------------------------------------------------------------------Setup Setup command Yum install-y setuptoolyum install-y NTSYSV installation system Services Yum install-y iptables firewall configuration yum install-y System-config-network-tui Network SERVICE-------------------------------------------------------------------------------------------------Date View system time date -S month/day/year date-s hours/min/ Seconds four. System Boot sequence first stage: BIOS power-on self-test, look for boot media, and then start MBR (MBR is boot media boot) Second stage: Grub boot loader, find kernel and kernel image location Phase III: Kernel boot, load basic drive Phase IV: System initialization,/ The Sbin/init process is the parent process of other system processes, and first reads the/etc/inittab to execute the appropriate script for system initialization 1. Perform a system initialization script (/ETC/RC.D/RC.SYSINIT), basic configuration of the system, Mount the root filesystem and other file systems in a read-write manner, Sysinit (1) Get the network environment and host type. Network environment settings file:/etc/sysconfig/network (2) test and load memory device/proc and USB device (3) determine whether to start SELinux (4) interface device detection and Plug and Play parameters test(5) User-defined module loading, the user can add a custom module in "/etc/sysconfig/modules/*.modules", will be loaded into the system (6) load the relevant settings of the core. Press "/etc/sysclt.conf" The setting value configuration function of this file (7) Sets the system time (8) Setting the console glyph of the terminal (9) Setting the RAID and LVM HDD functions (10) Viewing the inspection disk File system (11) for disk quota quota conversion (12) Re-loading the system disk in read mode (13) to start the quota feature (14) Start the system random number device (15) clears the temporary file during startup (16) Loads the boot information into the "/VAR/LOG/DMESG" file when/etc/rc.d/ Rc.sysinit after execution, the system will be able to work, but also need to start a variety of services in the system to start the network and host functions 2. Execute/ETC/RC.D/RC script, first k after S, run level service is placed on/ETC/RC.D/RC*.D (*= 0-6) All files in the directory are pointed to the corresponding symbolic link under/ETC/INIT.D. Rc.sysinit analyzes the/etc/inittab to determine the boot level of the system and then executes the file under/ETC/RC.D/RC*.D 3. Executes the user-defined bootstrapper/etc/rc.d/rc.local. 4. After completing all startup Tasks, Linux will start the terminal or X-window to wait for the user to log in five. Key login (a). The Common remote Connection tool has putty,securectr, Xshell (b). Key login 1. Generate key pair 2. Save the key 3. Copy the public key to Linux there is a long character set below key, pasting to/root/.ssh/authorized_keys creating the/root/.ssh directory #mkdir/root /.ssh Change permissions for this directory #chomd 700/root/.ssh paste to/root/.ssh/authorized_keys#vi/root/.ssh/authorized_key4. Turn off the SELinux shutdown method to temporarily close the # Setenforce 0 Permanently turn off the #vi/etc/selinux/config to change "selinux=enforcing" to "selinux=disabled" 5. Set Putty Login with key 6. Log in to the Linux--------------------------------------------------------------------------with a key------------------------key pairs are cryptographic algorithms for public-key cryptography (or asymmetric encryption), such as RSA and DSA, which use a pair of keys, the public key and the private key. Among them, the public key can be randomly distributed, only for encryption, the private key is only owned by one person, only for decryption. Any information that is encrypted with the public key can be decrypted with the private key to obtain the original information. The RSA key pair works as follows: Assuming that two users, A and B, have a pair of public and private keys for encryption and decryption, the public and private keys for A and Publica and privatea,b respectively are PUBLICB and PRIVATEB respectively. (1) A and B to send information to each other, so to exchange the public key, A's public key tells B,b's public key to tell a. But the private key is confidential, just own it. (2) A sends a message to B, and the plaintext is X. A use the public key of B to encrypt the plaintext X to form ciphertext PUBLICB (x), and then transfer ciphertext to b;b received ciphertext, with B's private key to decrypt the ciphertext privateb (c (x)), to communicate the plaintext X. (3) B sends a message to a, and the plaintext is Y. b Use A's public key to encrypt plaintext Y to form ciphertext publica (y), and then transfer ciphertext to a;a received ciphertext, with a's private key to decrypt ciphertext Privatea (c (x)), to communicate the plaintext Y. --------------------------------------------------------------------------------------------------1) Whitelist form Requirements: only allow 192.168.0.1 and 192.168.0.10 Login All other prohibitions implementations: 1. Vim/etc/hosts.allow//Add the following content sshd:192.168.0.1, 192.168.0.10 2. Vim/etc/hosts.deny//Add the following content Sshd:all 2) blacklist form Requirements: limited to 192.168.0.1 Landing, all other release implementation: Vim/etc/hosts.deny// Add the following content sshd:192.168.0.1---------------------------------------------------------------------------------------- --- root account can only be used with a key cannot be password vim/etc/ssh/sshd_config added: Permitrootlogin without-password root account does not allow login only for ordinary users to log in Vim/etc/ssh/sshd_config add: Permitrootlogin no Six. System Shortcut CTRL + C: Terminate current command ctrl+d: Exit current terminal tab: Fill command Ctrl + Z: Pause current process ctrl+l: Clear screen ctrl+u: quickly delete all characters preceding the cursor CTRL + A: Quickly set the cursor to the beginning of the Ctrl+e: quickly set the cursor to the end of the line
Linux virtual machine configuration