CentOS 7 system installation and configuration, 100 commonly used operating commands

CentOS 7 is a widely used open source Linux operating system that is a free rebuilt version of Red Hat Enterprise Linux (RHEL) and is known for its stability and security. Virtual machines are usually installed on CentOS 7 using virtualization technology, such as VirtualBox or VMware. The following is a brief introduction to CentOS 7 and the steps on how to install a CentOS 7 virtual machine.
Insert image description here

CentOS 7 introduction:

Features:
Stability: CentOS 7 offers long-term support (LTS), making it the first choice for enterprise-class applications and servers.
Security: The CentOS team regularly releases security updates to ensure the security of the system.
Free and open source: CentOS 7 is free and you are free to use, modify and distribute it.
Community support: There is a large community with access to rich documentation and support resources.
YUM package management: Use YUM (Yellowdog Updater, Modified) for software package management to easily install, update and uninstall software packages.

Installation method:

CentOS 7 can be installed on a physical machine or run as a virtual machine. Here are the steps to install CentOS 7 in a virtual machine:

Install CentOS 7 virtual machine:

Step 1: Download the CentOS 7 image file:

Go to the download page of the CentOS official website: https://www.centos.org/download/,
select the CentOS 7 version you need (usually CentOS 7 x86_64), and then download the ISO image file.

Step 2: Install virtualization software:

You can choose different virtualization software to run CentOS 7 virtual machines, the following are two common choices:

Using VirtualBox:
Download and install Oracle VirtualBox: https://www.virtualbox.org/
Open the VirtualBox software.
Using VMware:
Download and install VMware Workstation or VMware Player: https://www.vmware.com/
and open the VMware software.

Step 3: Create a new virtual machine:

Whether you choose to use VirtualBox or VMware, the process of creating a new virtual machine is basically similar.

Using VirtualBox:
Open VirtualBox and click "New".
Enter the virtual machine's name, type (Linux), and version (64-bit CentOS) into the wizard.
Allocate sufficient memory and disk space, at least 2GB of memory and 20GB of storage space are recommended.
Select "Create virtual hard disk now" in the virtual hard disk settings and select dynamic allocation.
Select the size of the virtual hard disk and click Create.
Select the newly created virtual machine in the virtual machine list, click "Settings", and then add the CentOS 7 ISO image file as a CD-ROM drive in "Storage".
Start the virtual machine and follow the CentOS 7 installation wizard to install it.
Using VMware:
Open the VMware software and click "File" > "New Virtual Machine".
Select Custom (Advanced) in the wizard to create a virtual machine.
Select the hardware compatibility of the virtual machine (it is recommended to select the latest version).
Select the operating system type as "Linux" and the version as "CentOS 7 64-bit".
Allocate sufficient memory and disk space, at least 2GB of memory and 20GB of storage space are recommended.
Configure network adapters and other hardware settings.
Add the CentOS 7 ISO image file as a CD-ROM drive in the virtual machine settings.
Start the virtual machine and follow the CentOS 7 installation wizard to install it.

Step 4: Install CentOS 7:

After starting the virtual machine, you will follow the instructions of the CentOS 7 installation wizard to install it. You need to select configuration options such as language, time zone, keyboard layout, etc., and set a root password.
In the disk partitioning step, you can choose automatic partitioning or manual partitioning, depending on your needs.
Once the installation is complete, you will be asked to restart the virtual machine.

Step 5: Configure and use CentOS 7:

Log in to the CentOS 7 virtual machine and use the root password set previously.
Now you can configure and use CentOS 7, install packages, set up networking, configure firewalls, etc.

100 commonly used operating commands

These following commands can be used to manage and operate the system in the terminal. Note that some commands may require superuser privileges (using sudo) to execute.

ls - List files and subdirectories in the current directory.
pwd - displays the path to the current working directory.
cd - Switch directories, for example: cd /path/to/directory.
touch - creates an empty file, for example: touch filename.txt.
mkdir - Create a new directory, for example: mkdir new_directory.
rmdir - deletes an empty directory, for example: rmdir directory_name.
rm - Delete a file or directory, for example: rm file.txt or rm -r directory.
cp - Copy a file or directory, for example: cp source_file destination or cp -r source_directory destination.
mv - moves files or directories, can also be used to rename files, for example: mv source destination.
cat - View file contents, for example: cat filename.txt.
less - View file contents page by page, for example: less filename.txt.
more - View the file content page by page, but you cannot page forward, you can only scroll down, for example: more filename.txt.
head - displays the first few lines of the file, the default is the first 10 lines, for example: head filename.txt.
tail - displays the last few lines of the file, the default is the last 10 lines, for example: tail filename.txt.
grep - Search for text in a file, for example: grep "pattern" filename.txt.
find - Find a file in the file system, for example: find /path/to/search -name "filename".
ps - displays information about the current process, for example: ps aux.
top - Dynamically displays system resource usage and process information.
kill - Kill a process, for example: kill process_id.
shutdown - Shut down or restart the system, for example: shutdown -h now (shutdown immediately) or shutdown -r now (restart immediately).
ifconfig - Displays configuration information for a network interface.
ping - Tests the network connection to a remote host, for example: ping google.com.
netstat - displays network statistics, for example: netstat -tuln.
yum - CentOS 7 package manager for installing, updating and removing packages.
rpm - Install and manage RPM packages, for example: rpm -i package.rpm.
systemctl - Manage system services, for example: systemctl start service_name or systemctl stop service_name.
firewall-cmd - Manage firewall rules, for example: firewall-cmd --zone=public --add-port=80/tcp --permanent.
useradd - creates a new user, for example: useradd username.
passwd - Change a user's password, for example: passwd username.
userdel - Delete a user, for example: userdel username.
groupadd - Create a new user group, for example: groupadd groupname.
usermod - Modify user attributes, for example: usermod -aG groupname username.
chown - Change the owner of a file or directory, for example: chown user:group file_or_directory.
chmod - Change the permissions of a file or directory, for example: chmod 755 filename.
df - Displays disk space usage.
du - Displays the disk usage of a directory, for example: du -sh directory_name.
date - Displays the system date and time.
cal - displays the calendar, for example: cal 2023.
tar - Create and decompress a tar archive, for example: tar -zxvf archive.tar.gz.
zip/unzip - Compress and decompress ZIP files.
ssh - Connect to a remote host using SSH, for example: ssh username@hostname.
scp - Copy a file over SSH, for example: scp file.txt remote_username@remote_host:/remote/directory.
wget - Download a file or content, for example: wget URL.
curl - Send an HTTP request, for example: curl -I URL.
hostname - displays or sets the hostname.
history - Display command history.
who - displays the currently logged in user.
shutdown - Shut down or restart the system, for example: shutdown -h now (shutdown immediately) or shutdown -r now (restart immediately).
reboot - Restart the system, for example: reboot.
exit - Exit the current terminal session.
grep - Search for text in a file, for example: grep "pattern" filename.txt.
find - Find a file in the file system, for example: find /path/to/search -name "filename".
ps - displays information about the current process, for example: ps aux.
top - Dynamically displays system resource usage and process information.
kill - Kill a process, for example: kill process_id.
shutdown - Shut down or restart the system, for example: shutdown -h now (shutdown immediately) or shutdown -r now (restart immediately).
ifconfig - Displays configuration information for a network interface.
ping - Tests the network connection to a remote host, for example: ping google.com.
netstat - displays network statistics, for example: netstat -tuln.
yum - CentOS 7 package manager for installing, updating and removing packages.
rpm - Install and manage RPM packages, for example: rpm -i package.rpm.
systemctl - Manage system services, for example: systemctl start service_name or systemctl stop service_name.
firewall-cmd - Manage firewall rules, for example: firewall-cmd --zone=public --add-port=80/tcp --permanent.
useradd - creates a new user, for example: useradd username.
passwd - Change a user's password, for example: passwd username.
userdel - Delete a user, for example: userdel username.
groupadd - Create a new user group, for example: groupadd groupname.
usermod - Modify user attributes, for example: usermod -aG groupname username.
chown - Change the owner of a file or directory, for example: chown user:group file_or_directory.
chmod - Change the permissions of a file or directory, for example: chmod 755 filename.
df - Displays disk space usage.
du - Displays the disk usage of a directory, for example: du -sh directory_name.
date - Displays the system date and time.
cal - displays the calendar, for example: cal 2023.
tar - Create and decompress a tar archive, for example: tar -zxvf archive.tar.gz.
zip/unzip - Compress and decompress ZIP files.
ssh - Connect to a remote host using SSH, for example: ssh username@hostname.
scp - Copy a file over SSH, for example: scp file.txt remote_username@remote_host:/remote/directory.
wget - Download a file or content, for example: wget URL.
curl - Send an HTTP request, for example: curl -I URL.
hostname - displays or sets the hostname.
history - Display command history.
who - displays the currently logged in user.
shutdown - Shut down or restart the system, for example: shutdown -h now (shutdown immediately) or shutdown -r now (restart immediately).
reboot - Restart the system, for example: reboot.
exit - Exit the current terminal session.
sed - Stream editor for processing text streams, for example: sed 's/old_text/new_text/' filename.txt.
awk - Text processing tool for extracting and processing data from text files.
diff - Compares differences between files and directories, for example: diff file1.txt file2.txt.
ln - Create a link (symbolic or hard link), for example: ln -s source_file link_name.
ssh-keygen - Generate SSH key pairs.
df - Displays disk usage, for example: df -h (displayed in human-readable format).
free - Displays system memory usage.
uptime - displays the system's uptime and load average.
whoami - displays the username of the currently logged in user.
whatis - displays a short description of the command, for example: whatis command.
man - View the man page for a command, for example: man command.
df - Displays the disk usage of a file system.
ln - Create a file link, for example: ln -s source_file link_name.
ncdu - displays disk usage using ncurses interface, requires additional installation.

Guess you like

Origin blog.csdn.net/weixin_41194129/article/details/133123842