virtualizationandnetwork installation ch07

Download Virtualizationandnetwork Installation Ch07

If you can't read please download the document

Upload: pervez-khan

Post on 12-Sep-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Check virtualization packages are already installed:#rpm -qa | egrep 'virt|kvm'libvirt-client-0.10.2-29.el6.x86_64libvirt-python-0.10.2-29.el6.x86_64python-virtinst-0.600.0-18.el6.noarchvirt-who-0.8-9.el6.noarchvirt-viewer-0.5.6-8.el6.x86_64qemu-kvm-0.12.1.2-2.415.el6.x86_64virt-what-1.11-1.2.el6.x86_64virt-top-1.0.4-3.15.el6.x86_64libvirt-0.10.2-29.el6.x86_64virt-manager-0.9.0-19.el6.x86_64If pkg not installed: Check if they are available#yum grouplist | grep -i virtualization System installation required[root@butxapache ~]# yum grouplist | grep -i virtualizationThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Error: No group data available for configured repositoriesIf pkg group available in yum repository install them:# yum -y groupinstall virtualization "virtualization client" "virtualization platform" "virtualization tools"=================Configuring Network Installation servers:----Configuring an FTP installation serverConfigure FTP installation server on physical server(butxapache)Install necessary packagescopy file from DVD to /var/ftp/pub/rhel6.5set proper SELinux contextenable port21 to allow the traffic to pass throughStart ftp servicesopen browser and test===============================================1. Install the vsftpd software regestration required# yum install vsftpd -y[root@butxapache /]# cd media [root@butxapache media]# ls -ltotal 8dr-xr-xr-x. 12 root root 8192 Nov 11 2013 RHEL_6.5 x86_64 Disc 1[root@butxapache media]#2. create directory /var/ftp/pub/rhel6.5# mkdir -p /var/ftp/pub/rhel6.53. Load the installation DVD, Automatically mounted on /media/"RHEL_6.5 x86_64 Disc 1"Unmount the dvd and re-mount it to /mnt#umount /dev/cdrom#mount /dev/cdrom /mnt4. cd to /mnt and cp entire directory structure to /var/ftp/pub/rhel6.5# cd /mnt && find . | cpio -pmd /var/ftp/pub/rhel6.55. unmount and eject the DVD#umount /mnt#eject6. Copy the SELinux context set on the /var/ftp/pub to the /var/ftp/pub/rhel6.5#chcon -Rv --reference=/var/ftp/pub /var/ftp/pub/rhel6.5 7. Issue the semanage command and modify the contexts on the directory to ensure that the new context survive a SELinux relabeling:#semanage fcontext -a -s system_u -t public_content_t /var/ftp/pub/rhel6.5[root@butxapache /]# semanage fcontext -a -s system_u -t public_content_t /var/ftp/pub/rhel6.5-bash: semanage: command not found[root@butxapache /]# which semanage/usr/bin/which: no semanage in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)You need to use the yum command to find out which package provides file called /usr/sbin/semanage. Type the following command:# yum provides /usr/sbin/semanage OR# yum whatprovides /usr/sbin/semanage[root@butxapache /]# yum provides /usr/sbin/semanageType the following command to install the same, enter:# yum -y install policycoreutils-python8. Configure host-based access by allowing vsFTP traffic on port 21 to pass through the firewall:# iptables -I INPUT -s 192.168.1.0/24 -p tcp --dport 21 -j ACCEPT# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT9. Save the rule in the /etc/sysconfig/iptables file and restart the firewall to activate the new rule:# service iptables save; service iptables restart10. Restart vsFTP service and check the running status#service vsftpd start#service vsftpd status11. Set the vsFTP service to autostart at each system reboot and validate#chkconfig vsftpd on#chkconfig --list vsftpd12. Open up a browser window and type the following command to test access:# ftp://192.168.1.20/pub/rhel6.5 ----------------------------------troubleshootingdelete other iptable entry if there is one for port 21cp /etc/sysconfig/iptables /etc/sysconfig/iptables.bkvi /etc/sysconfig/iptablesNow edit the /etc/vsftpd/vsftpd.conf file. Uncomment and edit the lines in the vsftpd.conf file which are shown in bold.# Allow anonymous FTP? (Beware - allowed by default if you comment this out).anonymous_enable=NO# ASCII mangling is a horrible feature of the protocol.ascii_upload_enable=YESascii_download_enable=YES## You may fully customise the login banner string:ftpd_banner=Welcome to OSTECHNIX FTP service.#listen_ipv6=YESpam_service_name=vsftpduserlist_enable=YEStcp_wrappers=YESuse_localtime=YESNow let us restart the vsftpd service and try to connect to ftp server.[root@mainserver ~]# service vsftpd restartShutting down vsftpd: [ OK ]Starting vsftpd for vsftpd: [ OK ]-----------------------Error 500 Oops Cannot Change Directory /home/ftpuser in vsftpdsestatus chcon -t public_content_rw_t /home/nukhan/etc/vsftpd/user_listSo as I have understood, you want to login to the ftp server using khem id and want to get into the home directory of that user. Right?1. Is SELinux set to enforcing mode? to check this try the below command:Code:getenforceIf it's in enforcing mode, you need to check if ftp_home_dir boolean is set to on:Code:getsebool -a | grep ftp_home_dirIf that's off, turn it on to allow ftp user's to get into their home directory:Code:setsebool -P ftp_home_dir=12. By default, whatever user names you put in /etc/vsftpd/user_list file, it gets denied from logging into the ftp server. So either you remove the user khem from that file or you add "userlist_deny=NO" line at the end of /etc/vsftpd/vsftpd.conf file. Then, restart the vsftpd server. -------530 Permission denied.vi /etc/vsftpd/vsftpd.conf===============================================Cofiguring an HTTP installation serverTaskInstall necessary packages associated with apachecopy file freom DVD to /var/www/html/rhel6.5set proper SELinux contextenable port 80start HTTP serviceopen browser and testSteps.1. install the http software# yum install httpd -y2. create directory /var/www/html/rhel6.5mkdir -p /var/www/html/rhel6.53. Load the installation DVD, Automatically mounted on /media/"RHEL_6.5 x86_64 Disc 1"Unmount the dvd and re-mount it to /mnt# umount /dev/cdrom# mount /dev/cdrom /mnt4. cd to /mnt and cp entire directory structure to /var/ftp/pub/rhel6.5# cd /mnt && find . | cpio -pmd /var/www/html/rhel6.55. unmount and eject the DVD#umount /mnt#eject6. Copy the SELinux context on the /var/www/html to the /var/www/html/rhel6.5 directory#chcon -Rv --reference=/var/www/html /var/www/html/rhel6.57. Issue the semanage command and modify the contexts on the directory to ensure that the new context survive a SELinux relabeling:#semanage fcontext -a -s system_u -t httpd_sys_content_t /var/www/html/rhel6.58. Configure host-based access by allowing http traffic on port 80 to pass through the firewall:# iptables -I INPUT -s 192.168.1.0/24 -p tcp --dport 80 -j ACCEPT# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT9. Save the rule in the /etc/sysconfig/iptables file and restart the firewall to activate the new rule:# service iptables save; service iptables restart10. Restart vsFTP service and check the running status#service httpd start#service httpd status11. Set the vsFTP service to autostart at each system reboot and validate#chkconfig httpd on#chkconfig --list httpd12. Open up a browser window and type the following command to test access:# http://192.168.1.20/rhel6.5 -----------------troubleshootingThe virtual machine managerInteracting with virtual managerStart the VM bysing virt-managerSteps1. start xwindows like mobaxterm if you do not have download and install2. collect your descktop/laptop ipaddressYour DISPLAY is set to 192.168.1.53:0.0 3. Follow the following steps # DISPLAY=192.168.1.53:0.0You have new mail in /var/spool/mail/root# export DISPLAY# virt-manager4. vm WILL START OR FROM CDE Application->Stsrem Tools->Virtual Machine ManagerThe frost time VMM need to connet to KVM's QEMU(Quick emulator) hypervisor "localhost(QEMU)-not connectedright click and select Connect to connect to the hypervisor.If still unable restart daemon:Restart libvirtd daemon# service libvirtd restart Ensure the KVM module is loaded in the memory# lsmod | grep kvmIf the module still not loaded in the memory, issue the modprobe to load it# modprobe kvmCreate VMhttp://192.168.1.20/rhel6.5/images/install.img