Академический Документы
Профессиональный Документы
Культура Документы
Note:- new virtual system will be given for RHCE Exam Paper so set the password and put ur system on
dhcp according to the exam paper.
IPADD=DHCP
DNS 192.168.0.254
YUM Repository URL ftp://instructor.example.com/pub/rhel6/dvd/Server
Initial Configuration :-
Go to single user mode and set the password.
Firewall and Selinux configration
#lokkit --disabled
#lokkit --selinux=permissive
#setup
Setup the network configration to dhcp and dns as specified.
Now set yum Client
#vi base.repo
[base]
name=my base
baseurl=ftp://192.168.0.254/pub/rhel6/dvd/Server
enabled=1
gpgcheck=0
:wq!
#init 6
#ifconfig
#hostname
#ping 192.168.0.254 server ip address
#nslookup 192.168.0.117 your ip address
1) Selinux
#lokkit --disabled
#lokkit --selinux=enforcing
#sestatus
#setenforce 1
#sestatus
2) Ipforward
#vi /etc/sysctl.conf
:wq!
#sysctl -p
3) SMTP
Configure an SMTP mail server. Your host should be able to receive remote
mails.
Mail of root should be spooled to /var/spool/mail/root.
:wq!
#mail root@server17.example.com
#mail
4) ALIAS
#useradd harry
#passwd harry
#useradd admin
#passwd admin
#vi /etc/aliases
At the end
admin: harry
:wq!
#newaliases
Local testing
#mail admin@server17.example.com
#su - harry
$ mail
$ logout
Remote testing
#mail admin@server17.example.com
#su - harry
$mail
$logout
5) Script
Create a script in bash /root/s1.sh such that ,If the script is run in the
following manner -
# /root/s1.sh apple
o/p --> mango
AND
# /root/s1.sh mango
o/p --> apple
Make sure that if the no. arguement is not provided properly , then error
o/p
should be displayed as
o/p --> Invalid Arguement
If wrong arguement is provided , then error o/p should be displayed as
o/p --> mango|apple
#vi /root/s1.sh
#!/bin/bash
If [ $# -ne 1 ]; then
echo “invalidargument” >&2 use this if redirection is der
else
echo “mango|apple” >&2 use this if redirection is der
fi
:wq!
Configure an ftp server. User <sam> should be able to login via ftp .
anonymous user can download from your site.
(.my133.org) .remote.test should be denied access to ftp server
#useradd sam
#passwd sam
#yum install vsftpd*
#head -15 /etc/vsftpd/vsftpd.conf
Check anonymous_enable=yes
#tail -5 /etc/vsftpd/vsftpd.conf
Check tcp_wrapper=yes
Note:- if any of the above is no then open the file with vi editor and
change to yes.
vsftpd:.remote.test
or -- depends on question
vsftpd:ALL EXCEPT .example.com
:wq!
Local testing
#yum install ftp
#ftp 192.168.0.117
Username: sam
Password: password
ftp> bye
remote testing
#ftp 192.168.0.117
Username: sam
Password: password
ftp> bye
7) NFS
#mkdir /nfsshare
#rpm -qa nfs-utils
#vi /etc/exports
/nfsshare 192.168.0.0/24(sync)
:wq!
Local testing
#showmount -e
Remote testing
#showmount -e 192.168.0.117
8) LOOP
#cd
#ls
#mkdir /disks
#vi /etc/fstab
:wq!
#mount -a
#df -h
9) SSH
:wq!
#service sshd restart
Remote testing
#ssh root@server17.example.com
#logout
10) Website
<VirtualHost 192.168.0.117>
ServerAdmin webmaster@server17.example.com
DocumentRoot /var/www/html
ServerName server17.example.com
Errorlog logs/server17.example.com.........
Customlog logs/server17.example.com.........
</VirtualHost> save the file and exit
#httpd -t
#service httpd restart
#chkconfig --level 35 httpd on
#restorecon -R /var/www/html
#elinks server17.example.com
Remote testing
#elinks server17.example.com
11) iSCSI
Copy iqn.2010-09.com.example:rdisks.server17
#fdisk /dev/sda
N
P
1
P
W
#mkfs.ext4 /dev/sda1
#mkdir /mnt/iscsi
#blkid /dev/sda1
Copy UUID
#vi /etc/fstab
:wq!
#mount -a
#df -h
#cd /mnt/iscsi
#lftp 192.168.0.254
~>cd pub
~>get a
~>bye
#ls
#cd
12)Virtual Web
#lftp 192.168.0.254
~>cd pub/web
~>mget ww*
~>bye
#ls
#mkdir /var/www/html/virtual
#mv www.html /var/www/html/virtual/index.html
#vi /etc/httpd/conf/httpd.conf
:wq!
#httpd –t
#service httpd restart
#chkconfig –level 35 httpd on
#restorecon –R /var/www/html/virtual
#elinks http://www17.example.com
Remote testing
#elinks http://www17.example.com
13) Samba
[GLOBAL]
workgroup=MYGROUP Change it to IT
Go to end of script
[SAMBA]
path = /samba
browseable = yes
read list = natasha
hosts allow = 192.168.0
:wq!
#testparm
#service smb restart
#smbpasswd –a natasha
#smbpasswd –e natasha
#service smb restart
#chkconfig –-level 35 smb on
#chcon –t samba_share_t /samba
#ls –lZd /samba
#getsebool –a |grep samba
#setsebool –P samba_enable_home_dir 1
#getsebool –a |grep samba
#smbclient //192.168.0.117/samba –U natsha
Smb:\>
Remote testing
The user jean should not be able to add a cron job for herself
#useradd jean
#passwd jean
#vi /etc.cron.deny
Jean
:wq!
#su – jean
$crontab –e
15) copy the file boot.iso to /var/www/html/secure/ . Secure the file & make
it available to only <server17.example.com> over apache webserver .
#mkdir /var/www/html/secure
#cp boot.iso /var/www/html/secure
#vi /etc/httpd/conf/httpd.conf
<Directory “/var/www/html/secure/boot.iso”>
AllowOverride None
Order deny,allow
Allow from server17.example.com
Deny from all
</Directory>
:wq!
#httpd –t
#service httpd restart
#chkconfig –level 35 httpd on
Local testing
Open firefox
http://server17.example.com/secure
remote testing
Open firefox
http://server17.example.com/secure
#vi /etc/grub.conf
Kernel.................................................
............................auto rhgb quiet
:wq!
#init 6
Now check all your configration after reboot
#nmap 192.168.0.117
#chkconfig --list
#cat /proc/cmline
#df –h
#smbclient //192.168.0.117/samba –u natasha
#mail admin@server17.example.com
#showmount –e
#su – harry
$mail
$logout
#ftp 192.168.0.117
Username:sam
Password:password
#elinks http://server17.example.com
#elinks http://www17.example.com
Open firefox
http://server17.example.com/secure
#/root/s1.sh
#/root/s1.sh apple
#/root/s1.sh mango
#/root/s1.sh abcd