Showing posts with label virtual machine. Show all posts
Showing posts with label virtual machine. Show all posts

Wednesday, May 20, 2015

Computer Lab? || In a big room? || Or in a computer Itself?

 Introduction to Virtual Machines.


Hey, Its Budhaditya the Tech guy again, And I am here today to introduce you to something awesome here. Its every tech guy's dream to have multiple computers interconnected in a room, May be software testing, Different OS choices, Penetration testing etc. But what if you don't have funds like me?
|
Here I come to introduce you to Virtual Machines....
|
So What are they? They are emulated hardware platforms where you can install almost all existing operating systems without even paying a penny (Optional).
Two years ago, I wandered what Virtual Machines were? You know techie movies always have these names? For example, Untraceable, Hackers, Algorithm. etc. Now I am the one using 4 Virtual Machines at a time.
|
Some Names, - Oracle Virtual Box - Free, VMWare Workstation - Free Player and Payed Full version Workstation, Windows Virtual PC - Also free.
|
Requirements, -You Need 3 Main Things - Good Hard Drive Space, Great Processing Power, Intel - i5 - i7 Would be great, and a hell lot or RAM. Preferred 16 GB.
|
Another thing you must have is a Virtualization enabled CPU. You must enable it from Bios. It will be on bios as either VT-x (Intel) or AMD -V (AMD).
|
What I Personally use? - Oracle Virtual Box. Why? its Free.
|
How to set it up?
- Setting up any Virtual Host Platforms are pretty same. I will be showing today's example with Virtual Box.
Download link - Click Here
We need another addon called Virtual Box Extension for USB2/Intel PXE Rom/Guest Options etc - Talking about this later.
Extension Download Link - Click Here
|
Installation - Installation is pretty easy. Just run the Setup.exe and follow on screen instructions until successfully installed, And after The main package is done, Install the Extension pack, And now you are all set.
|
Creating and Installing a Virtual Machine. -
Download the OS Image file you wish to try/work/test. Or You can use bootable USB, Or just an old school CD/DVD. I Suggest using Image options for better speeds.
|
Follow The Images.

Open up Virtual Box, And Create NEW by clicking it.


In the Create New Virtual Machine Menu,
Name your VM,
and Select Kernel type and version
Select adequate amount of RAM,
based on OS requirements
Create a new Drive.
 There are other options for adding a drive manually later.
Choose VDI (default)
VDMK will also be compatible VMWare
Rest are rare and developing based.
I suggest to go with Dynamic Allocation,
Advantage on Dynamic over fixed is, After you setup a specific disk space, Dynamic Allocation will limit the drive to that space, but will fill up as per Data usage unlike Fixed. Fixed will just cut off a specific size from the HDD, which is not very economical.
Set the dynamically or fixed allocated disk space,
according to OS requirements.
After you click the last "create" button,
Your VM is now ready to be setup.
Click and go to the newly created VM's properties, and setup according to following images.
Until you want to leave your VMs completely unattached with host,
Enable these. Shared clipboard means, You can copy paste from host to guest or vice - versa
And Drag'n drop means, you can transfer files with simple Drag and Drop.
Leave rest options as default.
Boot Order is pretty important, As you need CD/DVD to boot your VM up
RAM adjustment can also be done here.
On to the next tab, is the Processor.
Leave execution cap as default. 
Now, If you have multi core CPU, and if you are going to do heavy CPU consuming jobs on VM, I suggest to increase Core count. 2 cores for Windows 7 is okay. 
Very Important - Enable PAE/NX. 
PAE lets to Above 4 GB usage of RAM on 32 Bit Operating Systems.
NX protects RAM From Random execution of Malicious Codes.
Some OSes need it, Some Don't. If OS Boots up without PAE/NX then no need to enable it.
If you are gonna use GUI VMs and t do basic Graphical jobs, I suggest to enable 3D Acceleration and Giving the full video memory. If you want to use multiple monitors, Just increment the monitor count.
This Part is important.
Networking - NAT means Network Address Translation which breaks down one IP Address to several internal IP Addresses to be used by multiple terminals. VirtualBox has NAT Built in.
Bridged will be another main option, Bridged will make your VM another machine on your Router.
So before you select Networking modes, Know what you want to do.
And You can also use multiple adapters, and can use both NAT and Bridged.
Others are Host Only, Internal NAT, etc. which are not for Web Connections.
In this Shared folders stage, You can define a specific folder/drive to be used as network drive from VM. You can check read only, So you can just read/ and copy files from Shared drive to VM, But in unchecked mode, You can read/write the drive. And Checking Auto-mount will automatically mount the drive for VM use.
After you are done with settings, Start your VM and it will wait for Disk. Select Real DVD/CD or virtual image drive. And after that. You are ready for as usual OS installation like as it would have been in a real host machine.


After Installation - After installation, Mount Guest Additions Disk from devices tab and install required drivers including Guest. Its easy on Windows systems, And if you want the same in linux,
This is the link to another of my blog posts about just "Installing Guest Additions on Linux"
Link - Click Here

Conclusion - Until your computer is Super fast, Do not expect to get smooth Virtual Experience. Virtual Machines will not be as fast as host, Host will be slowed down, Processor will be at peak, But you got your own lab right in your PC. 
|
This tutorial was a request from a fellow friend RKZ. 

THANK YOU


Saturday, February 22, 2014

Installing Virtual Box Guest Additions To Kali Linux.....

Installing Virtualbox Additions in Kali Linux, A Debian Distro

Kali Linux
The Rebirth of
Backtrack


Back track used to be the most popular penetration testing software based on Ubuntu, Which Offensive Security gave a rebirth named as Kali Linux, which is based on Debian. I cannot state all the differences because I am very new to Linux and started with Kali and Mint 16 Petra KDE. I am a computer geek myself and thats why I am digging on these. Now My Main topic is about installing Virtual Box Guest Additions in Kali Linux. What is Virtual Box? I will explain that in upcoming blogs. Now if you google, installing VBox additions in kali linux, there will be many search results, Showing 5 steps to do that. Seems easy right? As I said I am new to linux, when I installed Kali in VBox, I was unable to do what is said over there. After 5 - 8 re installs and trials, And after mixing my own moves, I was successful. Now I am sharing with you all noobies like me who are new to this Enviornment and struggeling about installing This addition.

Step 1 -> After installing Kali, you will see a windowed mode, driver less version of Linux. Go to VBox menu bar, click devices and from the drop down menu, go o install VBox Guest additions. The Image and shortcut of the CDRom will come in the desktop, and will promt you to run. If you click Run, It will say an autorun error. It cannot find the desired autorun progrum. So installing this is not very easy like of Windows.
Dont get frustrated. This was not the right way. I am going to explain the right way now. 

Go to Device - > Insert Guest additions CD


If you Click Run,

This Will Happen.
   

Step 2 -> There is a part during the installation. There is a place during installation, where you will be asked for a mirror link for updates. If you select yes, then Kali itself will figure out the essential repositories. If you click no, then installation will complete way faster and earlier. Now if you click no, you will have to add the repositories manually. This is the most easy technique to add. You can go to this link to see all the repositories, or just copy/paste these two repositories in the place shown in the following picture - 




  1. deb http://http.kali.org/kali kali main non-free contrib
  2. deb-src http://http.kali.org/kali kali main non-free contrib

Copy these two links to the sources list which is located in /etc/apt/sources.list in the following manner shown in the picture, and give hashes in the starting of CD ROM reposite to bypass CD ROM read as shown.

This is the picture of the Sources list file. Do as shown.

Step 3 -> Save and close this file and go to terminal and Run  apt-get update followed by apt-get upgrade. BTW Make sure you have the latest Kali installed and You are running as ROOT. These commands will update the base systems and Other relevant items. Picture as follows -

Go to Terminal

Write apt-get update and press enter.
After update done,
Type apt-get upgrade.
After updates done, go to next step

Step 4 -> Installing the Linux Header files. Now what are headers. Headers are files which help Linux or Any Kernals to Identify, Run, and Work with any Unknown softwares and Drivers. Remember? when you install Graphics drivers? or any unknown drivers, Windows ask you to varify driver signature? But Windows have a laid back attitude so you just click a couple of nexts and you are done. But in linux,  - In Hangover 1 COP accent - "NOT UPP IN HEREEEE" . In Layman language, You are the Kernal, Science is the Subject, Books are the Headers here which helps you to interact with science. Here Virtual Box and its additions are kind of a set of Virtual Rams, HDDs, CPUs, BIOS, and Drivers here, for which Linux needs Headers to interact with VB. So to install Headers -

Type in terminal  -  apt-get install linux-headers-$(uname -r)

There will be a little download session and the headers will be installed soon.



Now, the headers are successfully installed. Its time to install the Additions file now.
As we know, the files to be installed resides in The VBOXADDITIONS CD Rom. So as said in Kali Forums, We will have to first navigate to the file and copy it to the root. Now why to copy? because we have to give it root and read/write permissions which is not possible to do from the CD Rom because its Called ROM - Read Only Memory. To copy it, we will run the command cp. So the whole command will be


  1. cp /media/cd-rom/VBoxLinuxAdditions.run /root/         -   (Its now copied)
  2. chmod 755 /root/VBoxLinuxAdditions.run                     -   (Its given Read/Write Permissions)
  3. cd /root                                                                             -   (Changed directry to to Root)
  4. ./VBoxLinuxAdditions.run                                              -   (Ran the file named VBoxLinuxAdditions.run) 

Now You might have a question What the hell is chmod 775. Basically it has a complex permission protocol. each 7, 7, 5 here have different meanings, which I am currently studying about. You now only know that giving a file 775 or 777 permission means to make the file fully accessible to any users. If you write 777 instead of chmod 775, it will work no matter what.

Now I will post a picture where I used this and it didn't work. In my case, In place of "cd-rom" command, "cdrom0" worked. 

Now give it 2 minuits and Those additions will be installed successfully. Give it a restart. I am posting the pictures. Then will discuss the may come problems.

Did as Directed

Copy Error with cd-rom

In this case, cdrom0 worked for me

This is the case I struggled the most with. There are no blogs saying this cdrom thing. I saw this in a different site where it was stated the ways to Change Directry to CD Rom. I just kept this in mind. This will help you a lot. So This worked.



After the final ./VBoxLinuxAdditions.run    command, This will be the screen for 2 minuits showing successful loading. After this, Just restart. You are done.

Way 2 ->  If the CD ROM thing fails with any of the described ways, or you are too lazy for terminalling or a Passionate Windows user :p , There is another way. Navigate to CD ROM by opening it from My Computer. Copy the VBoxLinuxAdditions.run file to Desktop. Right-click the file on desktop and go to properties. There you will find a permissions Tab, Where change all the Privilages to READ/WRITE/EXECUTE. And Definitely check the "run as program" tick box. If you do not check this option, This will open with a Text Editor. And if you check the tick box, It will open in terminal and install the additions same as terminal installation one. Rest the Pictures will describe.

Go to - Computers/CD ROM and do the following

Copy the file to desktop

Change the file permissions to all read/write
and check allow executing file as program

Here you did the same thing what " chmod775/777 "command does in terminal.

Now you can see OPEN which came there
for enabling run file as program.
Click here and click run or run in terminal on the dialogue box.
Same installation will successfully occur and then restart.

Restart Now. Final Image -->
Full Resolution and
All Drivers Installed.

Possible Failures and Solutions :-

Possible Failure 1 --> The most common here is the Failure during installation of the Kernal Headers. After you write 
 apt-get install linux-headers-$(uname -r), This will appear

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-headers-3.7-trunk-686-pae

E: Couldn't find any package by regex 'linux-headers-3.7-trunk-686-pae'

So, what to do. Make sure you have the correct sources and repositories installed. Repeat step 2 here. If you had clicked YES for mirrors during installation, this error is unlikely to happen. But if not, check sources list for correct repositories. Add more from lots of websites available up there. check software package manager for additional options, choose updates to install. etc.etc . Then again Run apt-get update && apt-get upgrade. Then again run the Headers installation. Another thing, Make sure that you have the latest Kali Version installed because, installing the headers of old linux from New updates of the server is a bit complicated.
Possible Failure 2 -->  When installing the Additions by commanding ./VBoxLinuxAdditions.run, If it is successful, It should say stuff like - building guest additions ------ done
bla bla bla  ---------- done
bla bla bla  ---------- done

But in case of failures, the error will be - building guest additions --------- fail . In case of  this fail, means the headers are not successfully installed. Run an apt-get update again and re-install the headers. 
Image samples -
This is the fail I was talking about.

I am currently working and studying on working with kali in Virtual networks : Outer LAN. Like/comment/share/follow to get more updates and ask any questions freely. Will try to answer as easy as I can. 

And - Don't just scan over. Go through it thoroughly or you will fail to understand why and what is done over there.....

THANK YOU