Wednesday, September 26, 2018

Enable and Configure http to https redirection for Apache on CentOS 7


Method 1
  • Create .htaccess file under the root of the web folder
         RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]

where www.coolexample.com should change to the url of the website

  • Check the line LoadModule rewrite_module modules/mod_rewrite.so in /etc/httpd/conf.modules.d/00-base.conf is not comment or missing. If it is commented or missed, the mod_rewrite of Apache is not enabled. 

  • Edit the /etc/httpd/conf/httpd.conf to allow override
          <Directory /var/www/html>
     AllowOverride All
</Directory>
       



  • Restart the Apache to put the change into effect 
Method 2

  • vi /etc/httpd/conf.d/ssl.conf
  • Add following
      <VirtualHost *:80>
                ServerAdmin webmaster@your domain name
                DocumentRoot /var/www/html/your folder root
                ServerName your server name
                RewriteEngine on
               RewriteRule ^(.*) https://your domain name$1 [R=301,L]
     </VirtualHost>

Monday, September 24, 2018

Install VMware Tools on Centos 6 with yum

Introduction
Often when managing a large number of systems you want to manage all software installs the same way. So when it comes to VMware Tools you may not want to follow the official instructions but instead install using yum, especially if you’re automating a large number of headless systems.
VMware makes their tools available via a web hosted yum repository, however this means you must also update the tools using yum. You server will show the tools status in vCenter as “Running (3rd-party/Independant)” and you will not be able to specify the “Update on boot” option in your vm settings.
Add repository
First we must add VMware’s repository. Create a new repository file with your text editor (we’ll use vi for now)
vi /etc/yum.repos.d/vmware.repo
and add the following content
[vmware-tools] name=VMware Tools for Red Hat Enterprise Linux $releasever - $basearch baseurl=http://packages.vmware.com/tools/esx/latest/rhel6/$basearch enabled=1 gpgcheck=1 gpgkey=http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
Install Package
Once you’ve done this you can simply install the headless version of the tools (no X) with this simple command. You’ll need to accept the installation of the GPG key.
yum install vmware-tools-esx-nox

Updating VMware Tools

From now on if you need to update VMware Tools you can simply run
yum update vmware-tools-esx-nox
or as part of a regular yum update.
Removing VMware Tools
If you change your mind and want to remove VMware Tools or switch back to the tar and perl scripts method of installing VMware Tools simply run the following command to remove them.
yum remove vmware-tools-esx-nox

Saturday, September 22, 2018

Restore Windows Server 2012 R2 from Windows Backup Image


  • Before restore the Windows Server 2012 R2 from a Windows Server Backup, please confirm the destination disk size must be same as or greater than original once. 
  • Also the boot type (BIOS or UEFI) of the destination server must be same as the original, no matter the destination machine is a physical or virtual machine.
  • Boot the machine (either physical machine or virtual machine) from Windows Server 2012 R2 iso.
  • After Boot and start the Windows Server Setup Wizard click Next.
  • Click "Repair your Computer"
  • Select "Troubleshoot"
  • Select "Command Prompt"
  • Type "start /w wpeinit"
  • Type "netsh interface ip set ipaddress "Ethernet" static aaa.aaa.aaa.aaa bbb.bbb.bbb.bbb" (where aaa.aaa.aaa.aaa is IP address and bbb is subnet mask) 
  • Type "Exit"
  • Click again "Troubleshoot"
  • Click "System Image Recovery"
  • Click "Cancel" in Error that you get and click "Next"
  • Click "Advance"
  • Select "Search for a System Image in the Network"
  • You will get a Warning if you want to connect in the Network. Click Yes
  • Type the path of your Windows Backup and click OK.
  • Select the Location which include the Backup and click Next
  • Select BACKUP that you want to Restore and click Next
  • You can find additional options of Restore Points but because will proceed with full restore leave the default options and click Next.
  • Click "Finish" and the Restore will start.
  • Wait unti finish the Restore

Prevent or Prohibit Server Drives From Being Visible to Users

  To make changes to this policy for one of the seven default values: Start the Microsoft Management Console. On the Console menu, click  Ad...