farnodes / sysadmin

0 stars 0 forks source link

mock-test [Oct week 1] #20

Open swetank01 opened 2 weeks ago

swetank01 commented 2 weeks ago

Here are five tasks for each topic with descriptions:

Package Management

  1. Task: Install a specific version of a package.

    • Description: Use the package manager (e.g., apt, yum, or dnf) to install a specific version of the nginx package on your system. Verify the installation and check the version.
  2. Task: Remove a package and its configuration files.

    • Description: Use the package manager to completely remove the apache2 package along with its configuration files. Verify that the package is removed and no longer listed in the package manager.
  3. Task: List installed packages and search for a specific package.

    • Description: List all installed packages on the system and search for a specific package, such as curl. Provide the output of the search.
  4. Task: Upgrade all installed packages.

    • Description: Use the package manager to upgrade all installed packages on the system to their latest versions. Document any changes or output from the upgrade process.
  5. Task: Add a repository and install a package from it.

    • Description: Add a new repository (e.g., a PPA for Ubuntu) and install a package (e.g., git) from that repository. Confirm that the package is installed and list its version.

Linux Core Concepts

  1. Task: Demonstrate user and group management.

    • Description: Create a new user named testuser, add this user to a group called devs, and set a password for the user. Verify that the user has been created and is part of the correct group.
  2. Task: Monitor system resource usage.

    • Description: Use appropriate commands to monitor CPU, memory, and disk usage on the system. Create a report summarizing the current resource usage.
  3. Task: Schedule a cron job.

    • Description: Create a cron job that runs a script located at /home/user/script.sh every day at 2 AM. Ensure the cron job is created successfully and describe how you would check if it runs as expected.
  4. Task: Change the hostname of the system.

    • Description: Change the system hostname to new-hostname, and verify the change using appropriate commands. Document any necessary steps to ensure the change persists after a reboot.
  5. Task: Configure system logging.

    • Description: Set up the logging system to log messages from a specific application to a custom log file. Ensure the logs are being written correctly and provide examples of the log entries.

Linux Kernel

  1. Task: Check the kernel version and configuration.

    • Description: Determine the current kernel version running on the system and check the kernel configuration options that are enabled. Provide the output of your commands.
  2. Task: Update the kernel.

    • Description: Update the system kernel to the latest version available in your distribution’s repository. After the update, verify the new kernel version and reboot the system.
  3. Task: Load and unload kernel modules.

    • Description: Load a kernel module (e.g., dummy) and then unload it. Verify that the module is loaded or unloaded correctly.
  4. Task: Check system boot parameters.

    • Description: Review the current boot parameters for the Linux kernel. Document how you would change any boot parameters for the next reboot.
  5. Task: Investigate kernel logs.

    • Description: Use dmesg or check /var/log/kern.log to investigate kernel messages. Identify any warning or error messages and provide a brief analysis of what they might indicate.

File Manipulation

  1. Task: Create and manage file permissions.

    • Description: Create a file named testfile.txt and set the permissions so that the owner can read and write, the group can only read, and others have no access. Verify the permissions after setting them.
  2. Task: Archive and compress files.

    • Description: Create a directory named archive, move some sample files into it, and then create a compressed tarball of the directory. Verify that the tarball is created successfully.
  3. Task: Search for specific content within files.

    • Description: Use a command to search for the word “error” in all .log files located in the /var/log/ directory. Provide the command used and a sample of the output.
  4. Task: Copy and move files with different options.

    • Description: Copy a file named example.txt from the home directory to /tmp, preserving its attributes. Then move the file to /var/tmp and verify both operations.
  5. Task: Create a symbolic link.

    • Description: Create a symbolic link named link_to_example.txt that points to example.txt in the home directory. Verify that the link works by accessing the original file through the link.

Let me know if you need more tasks or any adjustments!

rsingh0706 commented 2 weeks ago

Package Management

  1. Task: Install a specific version of a package.
sudo apt update
sudo apt install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
nginx -v
  1. Task: Remove a package and its configuration files.
sudo systemctl stop nginx
sudo apt remove nginx
sudo rm -rf /etc/ssh/sshd_config
  1. Task: List installed packages and search for a specific package.

dpkg -l

  1. Task: Upgrade all installed packages.
apt list --installed
apt list --upgradable
  1. Task: Add a repository and install a package from it. (ASK ???)

Linux Core Concepts 1

sudo useradd testuser
sudo groupadd devs
sudo usermod -aG devs testuser
id testuser

2

top (cpu memory)
htop
df (disk usage)
  1. corntab -e
    crontab -l
    systemctl restart crond.service
  2. hostnamectl set-hostname new-hostname 5 sudo vim /etc/nginx/nginx.conf (log messages name change) Linux Kernel

  3. hostnamectl, uname -srm

File Manipulation

  1. touch testfile.txt chmod 640 testfile.txt
  2. grep -i "error" /var/log/*.log
  3. touch example.txt cp example.txt /tmp 5 .