Ex200 2
Ex200 2
Explanation: # cd /etc/syscofig/network-scripts/
# ls
# vim ifcfg-eth0 (Configure IP Address, Gateway and DNS) IPADDR=172.24.40.40
GATEWAY=172.24.40.1
DNS1=172.24.40.1
# vim /etc/sysconfig/network
(Configure Host Name)
HOSTNAME= station.domain40.example.com
OR
Graphical Interfaces:
System->Preference->Network Connections (Configure IP Address, Gateway and
DNS) Vim /etc/sysconfig/network
Question 1
OR
# system-config-users
Create a catalog under /home named admins. Its respective group is requested to be
the admin group.
The group users could read and write, while other users are not allowed to access
it. The files created by users from the same group should also be the admin group.
Explanation: # cd /home/
# mkdir admins /
# chown .admin admins/
# chmod 770 admins/
# chmod g+s admins/
Configure a task: plan to run echo hello command at 14:23 every day.
Explanation: # which echo
# crontab -e
23 14 * * * /bin/echo hello
# crontab -l (Verify)
Explanation: # cd /opt/
# mkdir dir
# find / -user harry -exec cp -rfp {} /opt/dir/ \;
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.
OR
Copy UUID
swapon -a
vim /etc/fstab
UUID=XXXXX swap swap defaults 0 0
(swapon -s)
Create a user named alex, and the user id should be 1234, and the password should
be alex111.
OR
Explanation: # cd /etc/yum.repos.d
# vim local.repo
[local]
name=local.repo
baseurl=file:///mnt
enabled=1
gpgcheck=0
# yum makecache
# yum install -y vsftpd
# service vsftpd restart
# chkconfig vsftpd on
# chkconfig --list vsftpd
# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
Configure the verification mode of your host account and the password as LDAP. And
it can login successfully through ldapuser40. The password is set as "password".
And the certificate can be downloaded from http://ip/dir/ldap.crt. After the user
logs on the user has no host directory unless you configure the autofs in the
following questions.
Explanation: system-config-authentication
LDAP Server: ldap//instructor.example.com (In domain form, not write IP)
OR
OR
# system-config-date
Change the logical volume capacity named vo from 190M to 300M. and the size of the
floating range should set between 280 and 320. (This logical volume has been
mounted in advance.)
Explanation: # vgdisplay
(Check the capacity of vg, if the capacity is not enough, need to create pv ,
vgextend , lvextend)
# lvdisplay (Check lv)
# lvextend -L +110M /dev/vg2/lv2
# resize2fs /dev/vg2/lv2
mount -a
(Verify)
-----------------------------------------------------------------------------
--
(Decrease lvm)
# umount /media
# fsck -f /dev/vg2/lv2
# resize2fs -f /dev/vg2/lv2 100M
# lvreduce -L 100M /dev/vg2/lv2
# mount -a
# lvdisplay (Verify)
OR
# e2fsck -f /dev/vg1/lvm02
# resize2fs -f /dev/vg1/lvm02
# mount /dev/vg1/lvm01 /mnt
# lvreduce -L 1G -n /dev/vg1/lvm02
# lvdisplay (Verify)
Create a volume group, and set 16M as a extends. And divided a volume group
containing 50 extends on volume group lv, make it as ext4 file system, and mounted
automatically under /mnt/data.
# mount -a
# mount (Verify)
Upgrading the kernel as 2.6.36.7.1, and configure the system to Start the default
kernel, keep the old kernel available.
Create a volume group, and set 8M as a extends. Divided a volume group containing
50 extends on volume group lv (lvshare), make it as ext4 file system, and mounted
automatically under /mnt/data.
And the size of the floating range should set between 380M and 400M.
Explanation: # fdisk
# partprobe
# pvcreate /dev/vda6
# vgcreate -s 8M vg1 /dev/vda6 -s
# lvcreate -n lvshare -l 50 vg1 -l
# mkfs.ext4 /dev/vg1/lvshare
# mkdir -p /mnt/data
# vim /etc/fstab
/dev/vg1/lvshare /mnt/data ext4 defaults 0 0
# mount -a
# df -h
Copy /etc/fstab to /var/tmp name admin, the user1 could read, write and modify it,
while user2 without any permission.
Configure a task: plan to run echo "file" command at 14:23 every day.
Explanation: Yum-config-manager
--add-repo=http://content.example.com/rhel7.0/x86-64/dvd” is to generate a file vim
content.example.com_rhel7.0_x86_64_dvd.repo, Add a line gpgcheck=0
Yumcleanall
Yumrepolist
Almost 4305 packages are right, Wrong Yum Configuration will lead to some
following questions cannot be worked out.
Adjust the size of the vo Logical Volume, its file system size should be 290M. Make
sure that the content of this system is complete.
Note: the partition size is rarely accurate to the same size as required, so in the
range 270M to 320M is acceptable.
Explanation: Addition
df -hT
lvextend -L +100M /dev/vg0/vo
Lvscan
xfs_growfs /home/ //home is the mounted directory of the LVM, this step just
need to do in the practice environment, and test EXT4 does not need this step.
resize2fs /dev/vg0/vo// use this command to update in examination.
df -hT
OR
Subtraction
e2fsck -f/dev/vg0/vo
umount /home
resize2fs /dev/vg0/vo // the final required partition capacity is 100M
lvreduce -l 100M /dev/vg0/vo
mount /dev/vg0/vo/home
df -hT
Passwd user name // to modify password or echo redhat | passwd --stdin user
name id natasha // to view user group.
User natasha must configure a cron job, local time 14:23 runs and executes:
*/bin/echo hiya every day.
Explanation: Using the browser open the URL in the question, download kernel
file to root or home directory.
uname –r// check the current kernel version
rpm –ivh kernel-*.rpm
vi /boot/grub.conf// check
Some questions are: Install and upgrade the kernel as required. To ensure
that grub2 is the default item for startup.
Yum repo : http://content.example.com/rhel7.0/x86-64/errata
OR
Yum-config-manager
--add-repo=“http://content.example.com/rhel7.0/x86-64/errata”
Modify user account database to ldap, fill up DN and LDAP SERVER as questions
required, use TLS to encrypt connections making tick, write
http://server.domain11.example.com/pub/EXAMPLE-CA-CERT to download ca,
authentication method choose ldap password.
You can test if the ldapuser is added by the following command:
Id ldapuser1
Configure NTP.
Configure autofs.
cp /etc/auto.misc /etc/auto.ldap
/etc/auto.ldap
ldapuserX -fstype=nfs,rw server.domain11.example.com:/home/guests/
If the above solutions cannot create files or the command prompt is -bash-
4.2$, it maybe exist multi-level directory, this needs to change the
server.domain11.example.com:/home/guests/ to
server.domain11.example.com:/home/guests/ldapuserX. What is multi-level directory?
It means there is a directory of ldapuserX under the /home/guests/ldapuserX
in the questions. This directory is the real directory.
Adding an extra 500M swap partition to your system, this swap partition should
mount automatically when the system starts up. Don't remove and modify the existing
swap partitions on your system.
Explanation:
fdisk -cu /dev/vda// in the way of expanding the partition, don’t make main
partition
partx –a /dev/vda
mkswap /dev/vdax
swapon /dev/vdax
swapon –s
vi /etc/fstab
/dev/vdax swap swap defaults 0 0
mount -a
Search files.
Find out files owned by jack, and copy them to directory /root/findresults
Explanation: mkdir/root/findfiles
find / -user jack -exec cp -a {} /root/findfiles/ \;
ls /root/findresults
Search a String
Find out all the columns that contains the string seismic within
/usr/share/dict/words, then copy all these columns to /root/lines.tx in original
order, there is no blank line, all columns must be the accurate copy of the
original columns.
Create a backup
Explanation:
cd /usr/local
tar –jcvf /root/backup.tar.bz2
mkdir /test
tar –jxvf /root/backup.tar.bz2 –C /test// Decompression to check the content
is the same as the /usr/local after
Use ext3 to format this new logical volume, this logical volume should
automatically mount to /mnt/database
Copy UUID
swapon -a
vim /etc/fstab
UUID=XXXXX swap swap defaults 0 0
(swapon -s)
Explanation:
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl –w (takes effect immediately)
Explanation:
# vim /boot/grub/grub.conf
kernel/vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/GLSvg-
GLSrootrd_LVM_LV=GLSvg/GLSroot
rd_LVM_LV=GLSvg/GLSswaprd_NO_LUKSrd_NO_MDrd_NO_DM
LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us
crashkernel=auto rhgb quiet kmcrl=5
# cat /proc/cmdline
ro root=/dev/mapper/GLSvg-GLSroot rd_LVM_LV=GLSvg/GLSroot
rd_LVM_LV=GLSvg/GLSswap rd_NO_LUKS rd_NO_MD rd_NO_DM
LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb
quiet kmcrl=5
Upgrade the kernel, start the new kernel by default. kernel download from this
address:
ftp://server1.domain10.example.com/pub/update/new.kernel
Explanation: Download the new kernel file and then install it.
[root@desktop8 Desktop]# ls
kernel-2.6.32-71.7.1.el6.x86_64.rpm
kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm
[root@desktop8 Desktop]# rpm -ivh kernel-*
Preparing... ###########################################
[100%]
1:kernel-firmware
########################################### [ 50%]
2:kernel
########################################### [100%]
Verify the grub.conf file, whether use the new kernel as the default boot.
[root@desktop8 Desktop]# cat /boot/grub/grub.conf default=0
title Red Hat Enterprise Linux Server (2.6.32-71.7.1.el6.x86_64)
root (hd0,0)
Configure iptables, there are two domains in the network, the address of local
domain is 172.24.0.0/16 other domain is 172.25.0.0/16, now refuse domain
172.25.0.0/16 to access the server.
Explanation:
iptables -F
service iptables save
iptables -A INPUT -s 172.25.0.0/16 -j REJECT
service iptables save
service iptables restart
Explanation:
/etc/yum.repos.d/base.repo
[base]
name=base
baseurl=http://instructor.example.com/pub/rhel6/dvd
gpgcheck=0
yum list
There are two different networks, 192.168.0.0/24 and 192.168.1.0/24. Your System is
in 192.168.0.0/24 Network. One RHEL6 Installed System is going to use as a Router.
All required configuration is already done on Linux Server.
Where 192.168.0.254 and 192.168.1.254 IP Address are assigned on that Server. How
will make successfully ping to 192.168.1.0/24 Network's Host?
Explanation:
vi /etc/sysconfig/network GATEWAY=192.168.0.254
OR
vi /etc/sysconf/network-scripts/ifcfg-eth0 DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.?
NETMASK=255.255.255.0
GATEWAY=192.168.0.254
service network restart
Gateway defines the way to exit the packets. According to question System
working as a router for two networks have IP Address 192.168.0.254 and
192.168.1.254.
Make a swap partition having 100MB. Make Automatically Usable at System Boot Time.
Explanation:
Explanation:
One Logical Volume is created named as myvol under vo volume group and is mounted.
The Initial Size of that Logical Volume is 400MB.
Make successfully that the size of Logical Volume 200MB without losing any data.
The size of logical volume 200MB to 210MB will be acceptable.
Explanation:
Explanation:
Explanation:
Explanation:
/etc/auto.master file we specified the mount point the configuration file for
mount point.
Make on /data that only the user owner and group owner member can fully access.
Explanation:
Who ever creates the files/directories on a data group owner should automatically
be in the same group owner as data.
Explanation:
1. chmod g+s /data
2. Verify using: ls -ld /data
Permission should be like this: drwxrws--- 2 root sysadmin 4096 Mar 16
18:08 /data
If SGID bit is set on directory then who every users creates the files on
directory group owner automatically the owner of parent directory. To set the SGID
bit: chmod g+s directory To Remove the SGID bit: chmod g-s directory
Your System is going to use as a Router for two networks. One Network is
192.168.0.0/24 and Another Network is 192.168.1.0/24. Both network's IP address has
assigned. How will you forward the packets from one network to another network?
Explanation:
If you want to use the Linux System as a Router to make communication between
different networks, you need enable the IP forwarding. To enable on running session
just set value 1 to
/proc/sys/net/ipv4/ip_forward. As well as automatically turn on the IP
forwarding features on next boot set on /etc/sysctl.conf file.
Explanation:
useradd eric
passwd eric
vi /etc/passwd
eric:x:505:505::/home/eric:/sbin/nologin
Which shell or program should start at login time is specified in /etc/passwd
file?
By default, Redhat Enterprise Linux assigns the /bin/bash shell to the users.
To deny the interactive login, you should write /sbin/nologin or /bin/ false
instead of login shell.
/data Directory is shared from the server1.example.com server. Mount the shared
directory that:
Explanation:
1. vi /etc/auto.master
/mnt /etc /auto.misc --timeout=50
vi /etc/auto.misc
data -rw,soft,intr server1.example.com:/data
service autofs restart
chkconfig autofs on
When you mount the other filesystem, you should unmount the mounted
filesystem, Automount feature of linux helps to mount at access time and after
certain seconds, when user unaccess the mounted directory, automatically unmount
the filesystem.
One Logical Volume named lv1 is created under vg0. The Initial Size of that Logical
Volume is 100MB. Now you required the size 500MB. Make successfully the size of
that Logical Volume 500M without losing any data. As well as size should be
increased online.
Explanation:
The LVM system organizes hard disks into Logical Volume (LV) groups.
Essentially, physical hard disk partitions (or possibly RAID arrays) are set up in
a bunch of equal sized chunks known as Physical Extents (PE). As there are several
other concepts associated with the LVM system, let's start with some basic
definitions:
Physical Volume (PV) is the standard partition that you add to the LVM mix.
Normally, a physical volume is a standard primary or logical partition. It can also
be a RAID array.
Logical Volume (LV) is composed of a group of LEs. You can mount a file
system such as /home and /var on an LV.
Explanation:
1. Use fdisk /dev/hda to create new partition.
2. Type n For New partitions.
3. It will ask for Logical or Primary Partitions. Press l for logical.
4. It will ask for the Starting Cylinder: Use the Default by pressing Enter
Key.
5. Type the Size: +100M you can specify either Last cylinder of size here.
6. Press P to verify the partitions lists and remember the partitions name.
7. Press w to write on partitions table.
8. Either Reboot or use partprobe command.
9. Use mkfs -t ext3 /dev/hda?
OR
You are new System Administrator and from now you are going to handle the system
and your main task is Network monitoring, Backup and Restore. But you don't know
the root password. Change the root password to redhat and login in default
Runlevel.
When System Successfully boot, it will ask for username and password. But you
don't know the root's password. To change the root password you need to boot the
system into single user mode. You can pass the kernel arguments from the boot
loader.
You are a System administrator. Using Log files very easy to monitor the system.
Now there are 50 servers running as Mail, Web, Proxy, DNS services etc. You want to
centralize the logs from all servers into on LOG Server. How will you configure the
LOG Server to accept logs from remote host?
Explanation:
Some users home directory is shared from your system. Using showmount -e localhost
command, the shared directory is not shown. Make access the shared users home
directory.
Explanation:
Add a new logical partition having size 100MB and create the data which will be the
mount point for the new partition.
Explanation:
OR
Explanation:
Explanation:
Explanation:
vi /etc/resolv.conf
nameserver 172.24.254.254
host server1.example.com
On every clients, DNS server is specified in /etc/resolv.conf. When you
request by name it tries to resolv from DNS server.
Your System is going use as a router for 172.24.0.0/16 and 172.25.0.0/16. Enable
the IP Forwarding.
1. echo "1" >/proc/sys/net/ipv4/ip_forward
2. vi /etc/sysctl.conf net.ipv4.ip_forward=1
Explanation: /proc is the virtual filesystem, containing the information
about the running kernel.
To change the parameter of running kernel you should modify on /proc. From
Next reboot the system, kernel will take the value from /etc/sysctl.conf.
Explanation:
Make on /archive directory that only the user owner and group owner member can
fully access.
Explanation:
Notes:
NFS: NFS instructor.example.com:/var/ftp/pub/rhel6/dvd
YUM: http://instructor.example.com/pub/rhel6/dvd
ldap: http://instructor.example.com/pub/EXAMPLE-CA-CERT
Explanation: /etc/sysconfig/selinux
SELINUX=enforcing
In the system, mounted the iso image /root/examine.iso to/mnt/iso directory. And
enable automatically mount (permanent mount) after restart system.
Explanation:
/etc/fstab:
/root/examine.iso /mnt/iso iso9660 loop 0 0 mount -a
mount | grep examine
Configure your NFS services. Share the directory by the NFS Shared services.
1. Find all sizes of 10k file or directory under the /etc directory, and copy to
/tmp/findfiles directory.
2. Find all the files or directories with Lucy as the owner, and copy to
/tmp/findfiles directory.
There is a local logical volumes in your system, named with common and belong to
VGSRV volume group, mount to the /common directory. The definition of size is 128
MB.
Requirement:
Extend the logical volume to 190 MB without any loss of data. The size is allowed
between 160-160 MB after extending.
There is a local logical volumes in your system, named with shrink and belong to
VGSRV volume group, mount to the /shrink directory. The definition of size is 320
MB.
Requirement:
Reduce the logical volume to 220 MB without any loss of data. The size is allowed
between 200-260 MB after reducing.
Create a swap space, set the size is 600 MB, and make it be mounted automatically
after rebooting the system (permanent mount).
Explanation:
if=/dev/zero of=/swapfile bs=1M count=600 mkswap /swapfile
/etc/fstab:
/swapfile swap swap defaults 0 0 mount -a
According the following requirements to create user, user group and the group
members:
- A group named admin.
- A user named mary, and belong to admin as the secondary group.
- A user named alice, and belong to admin as the secondary group.
- A user named bobby, bobby’s login shell should be non-interactive. Bobby not
belong to admin as the secondary group.
Mary, Alice, bobby users must be set "password" as the user's password.
Explanation:
groupadd admin
useradd -G admin mary
useradd -G admin alice
useradd -s /sbin/nologin bobby
echo "password" | passwd --stdin mary
echo "password" | passwd --stdin alice
echo "password" | passwd --stdin bobby
Explanation:
mkdir -p /common/admin
chgrp admin /common/admin
chmod 2770 /common/admin
Configure the FTP service in your system, allow remote access to anonymous login
and download the program by this service. Service is still running after system
rebooting.
Explanation: cd /var/www/html
wget http://instructor.example.com/pub/serverX.html mv serverX.html
index.html /etc/init.d/httpd restart
chkconfig httpd on
Create a volume group, and set the size is 500M, the size of single PE is 16M.
Create logical volume named lv0 in this volume group, set size is 20 PE, make it as
ext3 file system, and mounted automatically under data.
Explanation:
getenforce // Check the current mode of SELinux // SELinux runs in
enforcing mode // Check
getenforce 1
getenforce
vim /etc/selinux/config selinux=enforcing // To temporarily enable SELinux
: wg
sestatus
Explanation: vim/etc/yum.repos/base.repo
[base]
name=base
baseurl= http://server.domain11.example.com/pub/x86_64/Server
gpgcheck=0
enable=1
Save and Exit
Use yum list for validation, the configuration is correct if list the package
information. If the Yum configuration is not correct then maybe cannot answer the
following questions.
Resize the logical volume vo and its filesystem to 290 MB. Make sure that the
filesystem contents remain intact.
Note: Partitions are seldom exactly the same size requested, so a size within the
range of 260 MB to 320 MiB is acceptable.
Explanation:
df -hT
lvextend -L +100M /dev/vg0/vo
lvscan
Note: This step is only need to do in our practice environment, you do not
need to do in the real exam
resize2fs /dev/vg0/vo // Use this comand to update in the real exam df -hT
OR
e2fsck -f/dev/vg0/vo
umount /home
df –Ht
Explanation:
groupadd sysmgrs
useradd -G sysmgrs Natasha
We can verify the newly created user by cat /etc/passwd)
# useradd -G sysmgrs harry
# useradd -s /sbin/nologin sarrh
# passwd Natasha
# passwd harry
# passwd sarrah
Explanation:
cp -a /etc/fstab /var/tmp
cd /var/tmp
ls -l
getfacl /var/tmp/fstab
chmod ugo-x /var/tmp/fstab
Explanation:
mkdir /home/admins
chgrp -R adminuser /home/admins
chmodg+w /home/admins
chmodg+s /home/admins
Explanation:
ftp server.domain11.example.com Anonymous login
ftp> cd /pub/updates ftp> ls
ftp> mget kernel* ftp> bye
rpm -ivh kernel*
vim /etc/grub.conf
Check the updatted kernel is the first kernel and the orginal kernel remains
available. set default=0
:wq!
The base DN for the authentication service is dc=domain11, dc=example, dc=com LDAP
is used to provide both account information and authentication information. The
connection should be encrypted using the certificate at
http://host.domain11.example.com/pub/domain11.crt
When properly configured, ldapuserX should be able to log into your system, but
will not have a home directory until you have completed the autofs requirement.
Username: ldapuser11
Password: password
Explanation:
system-config-authentication LDAP user DN=dc=domain11,dc=example,dc=com
Server= host.domain11.example.com
LDAP password
OK
starting sssd
su -ldapuser11 Display Bash prompt #exit
Explanation:
#system-config-date
Note: dialog box will open in that
Check mark Synchronize date and time over network. Remove all the NTP SERVER
and click ADD and type
server.domain11.example.com
****************And then press ENTER and the press OK***************
This filesystem contains a pre-configured home directory for the user ldapuser11
ldapuser11's home directory is host.domain11.example.com /rhome/ldapuser11
ldapuser11's home directory should be automounted locally beneath /rhome as
/rhome/ldapuser11
Home directories must be writable by their users
ldapuser11's password is 'password'.
Explanation:
vim /etc/auto.master /rhome /etc/auto.misc
:wq!
# vim /etc/auto.misc
Create a user alex with a userid of 3400. The password for this user should be
redhat.
Explanation:
useradd -u 3400 alex
passwd alex
su -alex
SIMULATION
Explanation:
fdisk -l
fdisk -cu /dev/vda
p n
e or p select e
default (first): enter
default (last): enter n
default(first): enter
default(first): +754M t (1-5)
l: 82 p
w #reboot
#mkswap /dev/vda5
vim /etc/fstab
:wq
mount -a
swapon -a
swapon -s
Locate all the files owned by ira and copy them to the /root/findresults directory.
Explanation:
# find / -user ira > /root/findresults (if /root/findfiles is a file)
# mkdir -p /root/findresults
# find / -user ira -exec cp -a {} /root/findresults\; [ if /root/findfiles is a
directory] ls /root/findresults
Find all lines in the file /usr/share/dict/words that contain the string seismic.
Put a copy of all these lines in their original order in the file
/root/wordlist. /root/wordlist should contain no empty lines and all lines must be
exact copies of the original lines in /usr/share/dict/words.
Explanation:
grep seismic /usr/share/dict/words> /root/wordlist
Explanation:
cd /usr/local
tar -jcvf /root/backup.tar.bz2*
mkdir /test
tar -jxvf /root/backup.tar.bz2 -C /test/
Explanation:
fdisk -cu /dev/vda
partx -a /dev/vda
pvcreate /dev/vdax
vgcreate datastore /dev/vdax -s 16M
lvcreate-l 50 -n database datastore
mkfs.ext3 /dev/datastore/database
mkdir /mnt/database
vi /etc/fstab
/dev/datastore /database /mnt/database/ ext3 defaults 0 0 mount -a