1) Create the "LVM" with the name "marvel" by using 21PE's from the volume group "stone". Consider the P...

RHCE-1

1) Create the "LVM" with the name "marvel" by using 21PE's from the volume group "stone". Consider the PE size as "8MB". Mount it on /mnt/secret with filesystem vfat.

solution:

# fdisk -cu /dev/vda

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM

Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 3
First sector (9914368-12582911, default 9914368):
Using default value 9914368
Last sector, +sectors or +size{K,M,G} (9914368-12582911, default 12582911):
Using default value 12582911

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (9916416-12582911, default 9916416):
Using default value 9916416
Last sector, +sectors or +size{K,M,G} (9916416-12582911, default 12582911): +169M

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 83 Linux

Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 8e
Changed system type of partition 5 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

# reboot

# pvcreate /dev/vda5
# vgcreate -s 8M stone /dev/vda5
# pvs
# vgs
# vgdisplay stone
# lvcreate -L +168M -n marvel stone
# lvs
# lvdisplay /dev/stone/marvel
# mkfs.vfat /dev/stone/marvel
# mkdir /mnt/secret
# vim /etc/fstab
--> append the following entry
/dev/stone/marvel /mnt/secret vfat defaults 0 0
--> save and exit
# mount -a
# df -Th

2) Create a group named "sysadmin"

A user curly and larry should belongs to "stooges" group as a secondary group . A user moe should not have access to interactive shell and he should not be a member of "stooges" group. passwd for all user created should be "jenny".

solution:

# groupadd sysadmin
# groupadd stooges
# useradd curly
# useradd larry
# useradd moe
# gpasswd -M curly,larry stooges
# usermod -s /sbin/nologin moe
# echo "jenny" | passwd --stdin curly
# echo "jenny" | passwd --stdin larry
# echo "jenny" | passwd --stdin moe

3) Create the Directory "/home/manager" with the following characteristics. Group ownership of "/home/manager" should go to "manager" group. The directory should be have full permission for all members off "manager" group but not to any other users accept "root". Files created under "/home/manager" should get the same group ownership is set to the "manager" group.

solution:

# mkdir /home/manager
# groupadd manager
# chgrp -R manager /home/manager
# chmod g+rwx /home/manager
# chmod g+s /home/manager
# touch /home/manager/file1
# ll /home/manager

4) Install the appropriate Kernel from ftp://instructor.example.com/updates. Your machine should boot with updated kernel.

solution:

# cd /etc/yum.repos.d/
# vim kernel123.repo
--> give the following entries
[kernel123]
name=kernel media
baseurl=ftp://instructor.example.com/updates
gpgcheck=0
--> save and exit
# cd
# yum clean all
# yum install kernel -y
# vim /etc/grub.conf
--> the "default" option should be set to "0" in order for the latest kernel to be the default kernel
-> save and exit
# reboot

5) The user sarah must configure a cron job that runs daily at 14:23. and executes "/bin/echo "hyer" and deny the user max for creating cronjob.

solution:

# useradd sarah
# useradd max
# crontab -e
--> In the VIM editor prompt give the following entry
23 14 * * * /bin/echo "hyer"
--> save and exit
# vim /etc/cron.deny
--> Give the entry as under:
max
--> save and exit

6) Resize the lvm "/dev/vgsrv/home" so that after reboot size should be in between 90MB to 160MB.

solution:

Note: Depending upon the existing size you need to determine whether to extend or reduce the volume. Here we have assumed that the existing size of the given volume is greater than the range given in the question due to which we are reducing it.

# df -Th --> to check the mount point
# lvs --> to check the existing size of the lvm
# vgdisplay vgsrv --> to determine the PE size. Here volume group is vol1
# umount /home --> assuming "/home" to be the mount point of the logical volume
# e2fsck -f /dev/vgsrv/lv1
# resize2fs /dev/vgsrv/home 160M
# lvreduce -L 160M /dev/vgsrv/home
# mount /home
# lvs
# df -Th

7) BIND THE "LDAP" FOR USER AUTHENTICATION:

Note the following:

BASE DN: dc=example,dc=com ldap path ldap://instructor.example.com/. Download the certificate from "ftp://instructor.example.com/pub/EXAMPLE-CA-CERT". ldapuserX should login into your system, where "X" is your system no.

solution:

# system-config-authentication
--> In the "User Account Database:" select "LDAP"
--> In the "LDAP Search Base DN:" type "dc=example,dc=com"(suffix in our classroom)
--> In the "LDAP Server:" type "ldap://instructor.example.com"
--> Select "Use TLS to encrypt connections"
--> Click on "Download CA Certificate" and in the appeared box type the URL "ftp://instructor.example.com/pub/EXAMPLE-CA-CERT"
--> Click on "OK"
--> In the "Authentication Method:" select "LDAP password"
--> Click on "Apply"
--> Then with the below command you should be able to view user's information

# getent passwd ldapuserX

8) Configure your system as "NTP" client for "instructor.example.com".

solution:

# system-config-date
--> In the appeared window, select "Synchronize the date and time over the network"
--> Remove all the NTP Servers from the list
--> Click on Add
--> In the appeared box, type "instructor.example.com"(NTP Server in our class)
--> Hit the "<tab>" key on the keyboard
--> Click on "Advanced Options"
--> Select "Speed up initial synchronization"
--> Click on "OK"

9) Automount the home directory for the ldapuser of your system

Note the following:

instructor.example.com(192.168.0.254) "Nfs exports" /home/guests to your system where "x" is your station ip. Ldapuser's home directory is instructor.example.com:/home/guests/ldapuserX. Ldapuser's home directory should be automounted locally beneath at /home/guests/ldapuserX. While login with any of the ldapuser then only home directory should accesible from your system that ldapuserX.

solution:

# vim /etc/auto.master
--> Append the following entry
/home/guests /etc/auto.guests
--> save and exit

--> Create the file for the slave map as specified in /etc/auto.master
# vim /etc/auto.guests
--> type the following line
ldapuserX instructor.example.com:/home/guests/ldapuserX
--> save and exit

# service autofs reload

# su - ldapuserX
Note: You should not get any home directory error

10) Copy the file /etc/fstab to /var/tmp and configure the "ACL" as mentioned. The file /var/tmp/fstab is owned by the "root". The file /var/tmp/fstab belongs to the group "root" The file /var/tmp/fstab should not be executable by other's. The user "sarah" should able to read and write to the file. The user "natasha" can neither read nor write to the file. other users (future and current) shuold be able to read /var/tmp/fstab.

solution:
Note: Before adding users check their existence

# cp /etc/fstab /var/tmp
# ls -l /var/tmp/fstab
# chmod o-x /var/tmp/fstab
# useradd sarah
# setfacl -m u:sarah:rw /var/tmp/fstab
# useradd natasha
# setfacl -m u:natasha:--- /var/tmp/fstab
# chmod o+r /var/tmp/fstab

11) Configure FTP access from your system. Clients within the local network should have anonomyous FTP access to your system.

solution:

# rpm -qa vsftpd
--> If the package is not installed then install it
# yum install vsftpd -y
# service vsftpd restart
# chkconfig vsftpd on
# cd /var/ftp
# ls
# echo "testing" >> /var/ftp/file1

12) Configure your system as "web server" for the site http://serverX.example.com. Download the web page from ftp://instructor.example.com/updates/station.html. Rename the the downloaded page as "index.html". Copy the "index.html" page to the "document root". Do not make any modifications to the content of index.html.

solution:

# rpm -qa httpd
--> If the package is not installed then install it
# yum install httpd -y
# service httpd restart
# chkconfig httpd on
# wget ftp://instructor.example.com/updates/station.html
# mv station.html index.html
# cp index.html /var/www/html

13) Create the user "dax" with uid 4223.

solution:

# useradd -u 4223 dax

14) Extend the SWAP space with "250" MB dont remove the existing swap.

solution:

# free -m--> to check the existing swap space

# fdisk -cu /dev/vda

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM
/dev/vda6 10264576 11493375 614400 83 Linux

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (11495424-12582911, default 11495424):
Using default value 11495424
Last sector, +sectors or +size{K,M,G} (11495424-12582911, default 12582911): +250M

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM
/dev/vda6 10264576 11493375 614400 83 Linux
/dev/vda7 11495424 12007423 256000 83 Linux

Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): 82
Changed system type of partition 7 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/vda: 6442 MB, 6442450944 bytes
16 heads, 63 sectors/track, 12483 cylinders, total 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007d1ac

Device Boot Start End Blocks Id System
/dev/vda1 * 2048 526335 262144 83 Linux
/dev/vda2 526336 9914367 4694016 8e Linux LVM
/dev/vda3 9914368 12582911 1334272 5 Extended
/dev/vda5 9916416 10262527 173056 8e Linux LVM
/dev/vda6 10264576 11493375 614400 83 Linux
/dev/vda7 11495424 12007423 256000 82 Linux swap / Solaris

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

# reboot

# mkswap /dev/vda7
# vim /etc/fstab
--> Append the following entry
/dev/vda7 swap swap defaults 0 0
--> save and exit

# swapon -a
# free -m
# swapon -s--> to check that the new device is enabled as swap space or not

15) locate the files of owner "julie" and copy to the directory /root/found directory

solution:

# mkdir /root/found
# find / -user julie -exec cp -pf {} /root/found/ \;

16) Download file from "http://192.168.0.254/exam/sample.txt". Search lines which contains alpha-numeric words( combination of alphabets and number) and copy those lines in sorted order to /root/samplelines (output should not contain any blank lines).

solution:

# wget http://192.168.0.254/exam/sample.txt
# cat sample.txt | sort >> /root/samplelines

17) List all lines which have string "enter" from "/tmp/file1" file and copy the lines in /root/word

# grep enter /tmp/file1 >> /root/word


0 coment�rios:

Note: only a member of this blog may post a comment.