Linux: Linux Initial Configuration Guide

In-depth understanding of the Linux operating system: Linux initialization configuration guide

1. Operation after virtual machine system installation

After installing the Linux operating system, we need to perform some operations to ensure that the system is running properly and meeting our needs. The following are some common post-installation actions for virtual machine systems:

  • Set root password: First, we should set the password for the root user. The root password can be set with the following command:
    sudo passwd root
    
  • Create a common user: For security reasons, a common user should be created to perform daily operations. A new user can be created with the following command:
    sudo adduser username
    
  • Updating the system: Before proceeding with other configurations, the system should be updated to get the latest software packages and security patches. Update the system with the following command:
    sudo apt update
    sudo apt upgrade
    

2. Modify network card information

In Linux, modifying network card information can help us configure network connections and ensure that the system communicates properly with other devices. The following are some examples of modifying network card information:

  • View network card information: You can use the following command to view network card information in the system:
    ip addr show
    
  • Edit the network card configuration file: use a text editor (such as vi or nano) to open the network card configuration file and edit it:
    sudo vi /etc/network/interfaces
    
  • Configure a static IP address: If you need to configure the system to use a static IP address, you can add the following content to the network card configuration file:
    auto eth0
    iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    

3. Operating Specifications

In order to ensure the stability and security of the system, we should follow some operating norms. Here are some common best practice recommendations:

  • Use sudo instead of root: Avoid using the root user to execute commands directly, but use the sudo command to elevate the privileges of ordinary users.
  • Regularly back up data: Establish a mechanism for regularly backing up data to prevent accidental data loss.
  • Restrict Remote Access: For remote access services such as SSH, restrict access to only trusted IP addresses.
  • Regular System Updates: Regularly update system software packages and security patches to get the latest features and fixes.
  • Use a firewall: Enable a firewall and configure appropriate rules to protect the system from unauthorized access.

4. Update yum source

When using a Linux distribution based on RPM package management, updating the yum source can ensure that we can get the latest software packages. Here are the steps to update the yum source:

  • Backup the original yum source file: Before making any changes, we should backup the original yum source file to prevent problems.
  • Select the appropriate yum source: select the appropriate yum source according to the Linux distribution and region you are using.
  • Edit the yum source configuration file: Open the yum source configuration file with a text editor, and add the new yum source information to the file.
  • Clear the cache and update: Run the command to clear the yum cache, and use the update command to get the latest package information.

5. Directory structure

The Linux operating system has a specific directory structure, and understanding these directories is important to properly manage files and configurations. Following are the main parts of the Linux directory structure:

  • /bin: stores basic system commands.
  • /etc: stores system configuration files.
  • /home: The user's home directory.
  • /var: Stores files that change frequently, such as log files and mail.
  • /tmp: Used to store temporary files.
  • /usr: stores user-installed applications and files.
  • /proc: Virtual file system that provides information about the system kernel and processes.

Guess you like

Origin blog.csdn.net/run65536/article/details/131329567