CentOS-7 detailed basic teaching

Table of contents

Install CentOS 7:

basic configuration:

Package management:

User and permission management:

System Management:

File management:


Install CentOS 7:

  • Download the CentOS 7 installation image file (ISO).
  • / Create bootable installation media, such as burning to disc or making a bootable USB drive.
  • Insert the installation media into your computer and boot.
  • During startup, select the appropriate language and keyboard layout.
  • After accepting the license agreement, choose an installation type (such as server, desktop, or custom) and partition settings.
  • Set the hostname, time zone, admin password, etc.
  • Complete the installation and restart your computer.

basic configuration:

  • Log in to CentOS 7.
  • Confirm the network connection and configure the network settings, you can use nmtui or edit the network configuration file /etc/sysconfig/network-scripts/ifcfg-<interface> .
  • Update system packages: run sudo yum update command.
  • Configure firewall: Use the firewall-cmd command to manage firewall rules.
  • Setting up SELinux: SELinux can be configured using the semanage command or by editing the /etc/selinux/config file.

Package management:

  • Install packages: Install packages using the yum install command, for example sudo yum install package_name .
  • Upgrade packages: Run the sudo yum update command to upgrade installed packages.
  • Uninstall a package: Use the yum remove command to uninstall a package, for example sudo yum remove package_name .
  • Search for packages: Use the yum search command to search for packages, for example sudo yum search keyword .

User and permission management:

  • Create a user: Use the useradd command to create a user, such as sudo useradd username .
  • Set user password: Run the sudo passwd username command to set a password for the user.
  • Grant administrator privileges: Add the user to the sudoers file, which can be edited with the visudo command.
  • File and directory permissions: Use the chmod command to change the permissions of files and directories, such as chmod 755 filename .
  • Owner and Group: Use the chown and chgrp commands to change the owner and group of files and directories.

System Management:

  • System services: Use systemctl commands to manage system services, such as sudo systemctl start service_name .
  • Log files: View system log files such as /var/log/messages , /var/log/syslog , and /var/log/secure .
  • Process management: Use the ps command to view running processes, and use the kill command to terminate the process, such as kill PID (PID is the identifier of the process).
  • System monitoring: Use tools such as top , htop , nmon or sar to monitor system resource usage.
  • Time and Date: Use the date command to view and set the system time and date.
  • Timing tasks: Use the crontab command to create and manage timing tasks, such as crontab -e to edit user timing tasks.

File management:

  • Directory navigation: use the cd command to enter the directory, and use the ls command to list files and directories.
  • Create and delete files and directories: use the touch command to create files, use the mkdir command to create directories, and use the rm command to delete files and directories.
  • Copy and move files: Use the cp command to copy files and the mv command to move files.
  • File Finding: Use the find command to find files by criteria, such as find /path -name filename .
  • File permissions and attributes: Use the ls -l command to view file permissions and attributes, and use the chmod command to change file permissions.

 

Guess you like

Origin blog.csdn.net/m0_67906358/article/details/130688153