Question 6 of 109


SIMULATION -

Find the rows that contain abcde from file /etc/testfile, and write it to the file/tmp/testfile, and the sequence is requested as the same as /etc/testfile.

    Correct Answer:

    To find rows that contain 'abcde' in the file '/etc/testfile' and write them to '/tmp/testfile' while preserving the order, the correct command is: grep abcde /etc/testfile > /tmp/testfile. This command simply uses 'grep' to search for the string 'abcde' within each line of '/etc/testfile' and directs the output to '/tmp/testfile', ensuring the sequence is maintained.

Question 7 of 109


SIMULATION -

Create a 2G swap partition which take effect automatically at boot-start, and it should not affect the original swap partition.

    Correct Answer:

    To create a 2G swap partition that takes effect automatically at boot and does not affect the original swap partition, follow these steps: 1. Use 'fdisk /dev/sdX' to create the new partition, where /dev/sdX is your disk identifier. 2. Create a new partition by typing 'n', select 'p' for primary, and specify '+2G' for the size. 3. Change the partition type to Linux swap by typing 't' and then '82'. 4. Write the changes using 'w' and refresh the partition table with 'partprobe' or 'partx -a /dev/sdX'. 5. Create the swap space using 'mkswap /dev/sdXn', where 'n' is the partition number. 6. Copy the UUID of the new swap partition using 'blkid /dev/sdXn'. 7. Edit the /etc/fstab file and add the new swap partition with its UUID in the format: 'UUID=xxxxxxxxxxxx swap swap defaults 0 0'. 8. Activate the swap space using 'swapon -a'. To check if the swap space has increased, use 'free -h' command.

Question 8 of 109


SIMULATION -

Create a user named alex, and the user id should be 1234, and the password should be alex111.

    Correct Answer:

    To create a user named alex with a user ID of 1234 and set the password to alex111, follow these steps: Firstly, use the 'useradd' command with the '-u' option to specify the user ID. The command will be: 'useradd -u 1234 alex'. Secondly, use the 'passwd' command to set the password for the user alex. The command sequence will be: 'passwd alex', then enter 'alex111' twice when prompted to set and confirm the password.

Question 9 of 109


SIMULATION -

Install a FTP server, and request to anonymous download from /var/ftp/pub catalog. (it needs you to configure yum direct to the already existing file server.)

    Correct Answer:

    To install an FTP server and configure anonymous download for the /var/ftp/pub directory, follow these steps for a typical RHEL-based system: First, configure the YUM repository if it is directed to an already existing local file server. Edit or create a YUM repository configuration file, for example, use the command 'cd /etc/yum.repos.d' and then 'vim local.repo'. In the 'local.repo' file, add the following lines: [local] name=local.repo baseurl=file:///mnt enabled=1 gpgcheck=0. Next, update the YUM cache with 'yum makecache' and then install the vsftpd package using 'yum install -y vsftpd'. Start the vsftpd service with 'service vsftpd start' and ensure it starts on boot with 'chkconfig vsftpd on'. Verify the service configuration with 'chkconfig --list vsftpd'. Modify the vsftpd configuration file with 'vim /etc/vsftpd/vsftpd.conf', setting 'anonymous_enable=YES'. Restart the vsftpd service to apply the changes with 'service vsftpd restart'. This will allow anonymous users to download files from the /var/ftp/pub directory.

Question 10 of 109


SIMULATION -

Configure a HTTP server, which can be accessed through

http://station.domain40.example.com.

Please download the released page from http://ip/dir/example.html.

    Correct Answer:

    To configure an HTTP server that can be accessed through http://station.domain40.example.com and download the released page from http://ip/dir/example.html, follow these steps: 1. Install the HTTP server using the command `# yum install -y httpd` (or `# dnf install -y httpd` if you are using a more recent version of the package manager). 2. Enable the HTTP server to start at boot using the command `# chkconfig httpd on` (or `# systemctl enable httpd`). 3. Navigate to the web server's root directory using `# cd /var/www/html`. 4. Download the example page using `# wget http://ip/dir/example.html`. 5. Rename the downloaded file to become the default index page: `# mv example.html index.html`. 6. Start the HTTP server using `# systemctl start httpd`. To configure the HTTP server to correctly serve content for the specified domain, it is also necessary to update the server configuration file at `/etc/httpd/conf/httpd.conf`. You should add the following configuration block: `<VirtualHost *:80> DocumentRoot /var/www/html/ ServerName station.domain40.example.com </VirtualHost>`. There is no need to use `NameVirtualHost` as it is deprecated in recent versions of Apache HTTP server.