samedi 14 mars 2015

How to Install KVM and Create Virtual Machines on Ubuntu


image
If you’re using Linux, you don’t need VirtualBox or VMware to create virtual machines. You can use KVM – the kernel-based virtual machine – to run both Windows and Linux in virtual machines.
You can use KVM directly or with other command-line tools, but the graphical Virtual Machine Manager (Virt-Manager) application will feel most familiar to people that have used other virtual machine programs.

Installing KVM

KVM only works if your CPU has hardware virtualization support – either Intel VT-x or AMD-V. To determine whether your CPU includes these features, run the following command:
egrep -c ‘(svm|vmx)’ /proc/cpuinfo
A 0 indicates that your CPU doesn’t support hardware virtualization, while a 1 or more indicates that it does. You may still have to enable hardware virtualization support in your computer’s BIOS, even if this command returns a 1 or more.
image
Use the following command to install KVM and supporting packages. Virt-Manager is a graphical application for managing your virtual machines — you can use the kvm command directly, but libvirt and Virt-Manager simplify the process.
sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
Only the root user and users in the libvirtd group have permission to use KVM virtual machines. Run the following command to add your user account to the libvirtd group:
sudo adduser name libvirtd
image
After running this command, log out and log back in. Run this command after logging back in and you should see an empty list of virtual machines. This indicates that everything is working correctly.
virsh -c qemu:///system list
image

Creating Virtual Machines

Once you’ve got KVM installed, the easiest way to use it is with the Virtual Machine Manager application. You’ll find it in your Dash.
image
Click the Create New Virtual Machine button on the toolbar and the Virtual Machine Manager will walk you through selecting an installation method, configuring your virtual machine’s virtual hardware, and installing your guest operating system of choice.
image
The process will by familiar if you’ve ever used VirtualBox, VMware, or another virtual machine application. You can install from a disc, ISO image, or even a network location.
image
To assign more than 2GB of memory to a virtual machine, you’ll need a 64-bit Linux kernel. Systems running 32-bit kernels can assign a maximum of 2 GB of RAM to a virtual machine.
image
By default, KVM gives you NAT-like bridged networking – your virtual machine won’t appear on the network as its own device, but it will have network access through the host operating system. If you’re running server software in your virtual machine and want it accessible from other devices on the network, you’ll have to tweak the networking settings.
image
After selecting your installation method, Virt-Manager will boot the guest operating system in a window. Install the guest operating system as you would on a physical machine.
image

Managing Virtual Machines

The Virtual Machine Manager window displays a list of your installed virtual machines. Right-click virtual machines in the window to perform actions, including starting, shutting down, cloning, or migrating them.
image
You can view information about the virtual machine and configure its virtual hardware by clicking the i-shaped toolbar icon in the virtual machine’s window.
image

jeudi 13 novembre 2014

How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?

The Script way


If you're on a fresh installation of Ubuntu with no previous Java installations, this script automates the process outlined above if you don't want to type all that into a console. Remember, you still need to download Java from Oracle's website -- Oracle's links are not wget friendly.
Before using this make sure that this script is in the same directory as the .tar.gz file extension that you downloaded and there are no files that start with jdk-7 in the same folder. If there are, please move them out of the folder temporarily. Remember to make the script executable (chmod +x <script's file>).
#!/bin/sh

tar -xvf jdk1.8*  #Change by the you downloaded from oracle
sudo mkdir /usr/lib/jvm
sudo mv ./jdk1.7* /usr/lib/jvm/jdk1.7.0
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdkx.y.z/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdkx.y.z/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdkx.y.z/bin/javaws" 1
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
If you want to install the plugin for Firefox then add this to the end of the script:
mkdir ~/.mozilla/plugins
ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
sudo /etc/init.d/apparmor restart

mardi 23 septembre 2014

How to Enable DVD Playback in Ubuntu 14.04

Thanks to the open-source software libdvdread, it provides the library to read DVDs in Ubuntu Linux.
To install it, open Ubuntu Software Center and search for and install the packagelibdvdread4 and libdvdnav4.
install libdvdread4 library to read DVD
After that, press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run:
sudo /usr/share/doc/libdvdread4/install-css.sh
This script will allow you to play encrypted DVDs in Ubuntu.
UPDATE: Since Medibuntu is no longer available, you have to install libdvdcss2 repository manually. Download it from the link below:
Once installed, you’ll be able to playback and navigate DVD menus in most video applications, including the default Totem and VLC.

lundi 12 mai 2014

10 Useful “IP” Commands to Configure Network Interfaces

review how we can assign Static IP AddressStatic RouteDefault Gateway etc.  Assigning IP Address on demand using IP command. IFCONFIG command is deprecated and replaced by IP command in Linux.

http://www.tecmint.com/ip-command-examples/

jeudi 8 mai 2014

Easy network traffic shaping on your ubuntu system (debian/Ubuntu)



Traffic shaping on Linux system used to require knowledge of lot of things like iptables, qdiscs & networking protocols. Things have changed and now there are couple of tools which handle all of this complexity without requiring much knowledge. And one of them is wondershaper.

First install wondershaper by issuing following command. sudo apt-get -y install wondershaper


Use following command template to make it work right away.

sudo wondershaper <interface name> <down speed> <up speed>


Where interface name is your network interface name like eth0 or eth1 or wifi0 and down speed , up speed are self explanatory and specified in kilo bits per second.

So sample command will look like

sudo wondershaper eth0 512 512


To disable wondershaper from controlling particular interface use following command. sudo wondershaper clear <interface name>


To make these changes permanent add following lines to /etc/network/interfaces under relevant interface section. up /sbin/wondershaper <interface name> <downspeed> <upspeed> down /sbin/wondershaper clear <interface name>


Thats it, From now on all sensitive traffic like your voip, HTTP, SSH will get prioritied while heavy traffic like bit torrent will not be prioritized. This is not a perfect tool for the job but simple enough to be used by newbies.