Linux

Ubuntu 14.04 üzerine KVM Kurulumu

Merhaba,

Yakın bir zamandır Openstack ile uğraşıyorum ve bununla birlikte’de KVM ile uğraşıyorum. Bu yazımda sizlere Ubuntu üzerine KVM kurulumu hakkında bilgi vereceğim. Sanallaştırma çözümlerine baktığınızda genel olarak birçok firma başta VMware vSphere ESXi olmak üzere Hyper-V, Citrix XenServer gibi hypervisor’leri kullanıyor.

KVM’i kurmak en önemli gereksinimlerden birtanesi CPU desteğinizin olmasıdır. Bunuda zaten kuruluma başlamadan önce check edebiliyoruz.

kvm kurulumu 1

Ben kurulumu Ubuntu 14.04 üzerine yapacağım. SSH ile bağlantı yapıyorum ve kullanmış olduğum CPU’nun KVM uyumluluğunu görmek için aşağıdaki komutu çalıştırıyoruz ve gerekli paketler kuruluyor.

[php]

tayfun@KVM2:~$ sudo apt-get install cpu-checker
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
msr-tools
The following NEW packages will be installed:
cpu-checker msr-tools
0 upgraded, 2 newly installed, 0 to remove and 88 not upgraded.
Need to get 17.5 kB of archives.
After this operation, 112 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main msr-tools amd64 1.3-2 [10.6 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main cpu-checker amd64 0.7-0ubuntu4 [6,834 B] Fetched 17.5 kB in 3s (4,985 B/s)
Selecting previously unselected package msr-tools.
(Reading database … 55709 files and directories currently installed.)
Preparing to unpack …/msr-tools_1.3-2_amd64.deb …
Unpacking msr-tools (1.3-2) …
Selecting previously unselected package cpu-checker.
Preparing to unpack …/cpu-checker_0.7-0ubuntu4_amd64.deb …
Unpacking cpu-checker (0.7-0ubuntu4) …
Processing triggers for man-db (2.6.7.1-1ubuntu1) …
Setting up msr-tools (1.3-2) …
Setting up cpu-checker (0.7-0ubuntu4) …

[/php]

cpu-checker paketi kurulduktan sonra, kullanmış olduğumuz CPU’nun kvm ile uyumlu olup olmadığını görmek için aşağıdaki komutu çalıştırıyoruz.

[php]

tayfun@KVM2:~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
tayfun@KVM2:~$

[/php]

2

KVM için önerilen kurulum 64 bit bir mimari üzerinedir ancak bu gerekli değildir. Yani 32 bit bir mimari üzerinede kurulum yapabilirsiniz. Aşağıdaki komutu çalıştırdığımızda;

Eğer 0 gözükür ise bu işlemcinin 64 bit olmadığı anlamına gelir.

Eğer 1 ‘den yüksek bir değer görürseniz bu CPU ‘nun 64 bit ile uyumlu olduğu anlamına gelir.

[php] tayfun@KVM2:~$
tayfun@KVM2:~$ egrep -c ‘ lm ‘ /proc/cpuinfo
16
tayfun@KVM2:~$
tayfun@KVM2:~$

[/php]

KVM Kurulumu:

3

KVM kurulumu için gerekli olan paketleri aşağıdaki komut ile yüklüyoruz.

[php] tayfun@KVM2:~$
tayfun@KVM2:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
[sudo] password for tayfun:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
acl augeas-lenses binutils build-essential cgroup-lite cpp cpp-4.8
dctrl-tools debootstrap devscripts diffstat distro-info-data dnsmasq-base
dpkg-dev dput ebtables fakeroot g++ g++-4.8 gcc gcc-4.8 gcc-4.8-base gettext
hardening-includes intltool-debian iproute ipxe-qemu kpartx libaio1
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
libapt-pkg-perl libarchive-zip-perl libasan0 libasound2 libasound2-data
libasprintf-dev libasyncns0 libatomic1 libaugeas0 libauthen-sasl-perl
libautodie-perl libavahi-client3 libavahi-common-data libavahi-common3
libbluetooth3 libboost-system1.54.0 libboost-thread1.54.0 libbrlapi0.6
libc-dev-bin libc6 libc6-dev libcaca0 libclone-perl libcloog-isl4
libcommon-sense-perl libcroco3 libdigest-hmac-perl libdistro-info-perl
libdpkg-perl libemail-valid-perl libencode-locale-perl liberror-perl
libexporter-lite-perl libfakeroot libfdt1 libfile-basedir-perl
libfile-fcntllock-perl libfile-listing-perl libflac8 libfont-afm-perl
libgcc-4.8-dev libgettextpo-dev libgettextpo0 libgmp10 libgomp1
libhtml-form-perl libhtml-format-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
libhttp-negotiate-perl libio-html-perl libio-pty-perl
libio-socket-inet6-perl libio-socket-ssl-perl libio-stringy-perl
libipc-run-perl libipc-system-simple-perl libisl10 libitm1 libjpeg-turbo8
libjpeg8 libjson-perl libjson-xs-perl liblist-moreutils-perl
liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libmnl0
libmpc3 libmpfr4 libnet-dns-perl libnet-domain-tld-perl libnet-http-perl
libnet-ip-perl libnet-smtp-ssl-perl libnet-ssleay-perl libnetcf1
libnetfilter-conntrack3 libnl-route-3-200 libnspr4 libnss3 libnss3-nssdb
libogg0 libparse-debcontrol-perl libpciaccess0 libperlio-gzip-perl
libpixman-1-0 libpulse0 libquadmath0 librados2 librbd1 libsdl1.2debian
libseccomp2 libsndfile1 libsocket6-perl libspice-server1 libstdc++-4.8-dev
libstdc++6 libsub-identify-perl libtext-levenshtein-perl libtie-ixhash-perl
libtsan0 libunistring0 liburi-perl libusbredirparser1 libvirt0 libvorbis0a
libvorbisenc2 libwww-perl libwww-robotrules-perl libx86-1 libxen-4.4
libxenstore3.0 libxml2-utils libxslt1.1 libyajl2 lintian linux-libc-dev
manpages-dev patchutils pm-utils python-cheetah python-libvirt
python-vm-builder python3-chardet python3-debian python3-magic
python3-pkg-resources python3-six qemu-keymaps qemu-system-common
qemu-system-x86 qemu-utils seabios sharutils t1utils unzip vbetool wdiff
Suggested packages:
augeas-doc binutils-doc cpp-doc gcc-4.8-locales debtags bsd-mailx mailx
cvs-buildpackage devscripts-el gnuplot libfile-desktopentry-perl
libterm-size-perl libyaml-syck-perl mutt svn-buildpackage debian-keyring
equivs libsoap-lite-perl mini-dinstall python-bzrlib g++-multilib
g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg gcc-multilib autoconf
automake1.9 libtool flex bison gdb gcc-doc gcc-4.8-multilib libgcc1-dbg
libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg
libquadmath0-dbg gettext-doc libasound2-plugins alsa-utils augeas-tools
libgssapi-perl glibc-doc libdata-dump-perl libcrypt-ssleay-perl pulseaudio
libstdc++-4.8-doc radvd libauthen-ntlm-perl binutils-multiarch
libtext-template-perl libyaml-perl cpufrequtils radeontool python-markdown
python-pygments python-memcache python3-setuptools samba vde2 sgabios
kvm-ipxe-precise zip
The following NEW packages will be installed:
acl augeas-lenses binutils bridge-utils build-essential cgroup-lite cpp
cpp-4.8 dctrl-tools debootstrap devscripts diffstat distro-info-data
dnsmasq-base dpkg-dev dput ebtables fakeroot g++ g++-4.8 gcc gcc-4.8 gettext
hardening-includes intltool-debian iproute ipxe-qemu kpartx libaio1
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
libapt-pkg-perl libarchive-zip-perl libasan0 libasound2 libasound2-data
libasprintf-dev libasyncns0 libatomic1 libaugeas0 libauthen-sasl-perl
libautodie-perl libavahi-client3 libavahi-common-data libavahi-common3
libbluetooth3 libboost-system1.54.0 libboost-thread1.54.0 libbrlapi0.6
libc-dev-bin libc6-dev libcaca0 libclone-perl libcloog-isl4
libcommon-sense-perl libcroco3 libdigest-hmac-perl libdistro-info-perl
libdpkg-perl libemail-valid-perl libencode-locale-perl liberror-perl
libexporter-lite-perl libfakeroot libfdt1 libfile-basedir-perl
libfile-fcntllock-perl libfile-listing-perl libflac8 libfont-afm-perl
libgcc-4.8-dev libgettextpo-dev libgettextpo0 libgmp10 libgomp1
libhtml-form-perl libhtml-format-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
libhttp-negotiate-perl libio-html-perl libio-pty-perl
libio-socket-inet6-perl libio-socket-ssl-perl libio-stringy-perl
libipc-run-perl libipc-system-simple-perl libisl10 libitm1 libjpeg-turbo8
libjpeg8 libjson-perl libjson-xs-perl liblist-moreutils-perl
liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libmnl0
libmpc3 libmpfr4 libnet-dns-perl libnet-domain-tld-perl libnet-http-perl
libnet-ip-perl libnet-smtp-ssl-perl libnet-ssleay-perl libnetcf1
libnetfilter-conntrack3 libnl-route-3-200 libnspr4 libnss3 libnss3-nssdb
libogg0 libparse-debcontrol-perl libpciaccess0 libperlio-gzip-perl
libpixman-1-0 libpulse0 libquadmath0 librados2 librbd1 libsdl1.2debian
libseccomp2 libsndfile1 libsocket6-perl libspice-server1 libstdc++-4.8-dev
libsub-identify-perl libtext-levenshtein-perl libtie-ixhash-perl libtsan0
libunistring0 liburi-perl libusbredirparser1 libvirt-bin libvirt0
libvorbis0a libvorbisenc2 libwww-perl libwww-robotrules-perl libx86-1
libxen-4.4 libxenstore3.0 libxml2-utils libxslt1.1 libyajl2 lintian
linux-libc-dev manpages-dev patchutils pm-utils python-cheetah
python-libvirt python-vm-builder python3-chardet python3-debian
python3-magic python3-pkg-resources python3-six qemu-keymaps qemu-kvm
qemu-system-common qemu-system-x86 qemu-utils seabios sharutils t1utils
ubuntu-vm-builder unzip vbetool wdiff
The following packages will be upgraded:
gcc-4.8-base libc6 libstdc++6
3 upgraded, 177 newly installed, 0 to remove and 85 not upgraded.
Need to get 61.1 MB of archives.
After this operation, 206 MB of additional disk space will be used.
Do you want to continue? [Y/n] [/php]

Devam etmek için Y butonuna basıyoruz ve ilgili paketler yükleniyor.

Kurulum tamamlandıktan sonra düzgün çalıştığına emin olmak için aşağıdaki komutu çalıştırıyoruz.

[php] tayfun@KVM2:~$ virsh -c qemu:///system list
error: failed to connect to the hypervisor
error: Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: Permission denied

[/php]

Yukarıdaki komutu çalıştırdığımızda eğer hata alıyorsanız relogin olun yani çıkıp tekrar giriş yapın SSH’a.

[php] tayfun@KVM2:~$ virsh -c qemu:///system list
Id    Name                           State
—————————————————-

tayfun@KVM2:~$

[/php]

Tekrar login olduktan sonra aynı komutu yine çalıştırıyoruz ve karşımıza liste geliyor. Tabi şuanda virtual machine create etmediğimiz için karşımıza herhangi bir liste gelmiyor 🙂

Ubuntu GUI arayüzünü aşağıdaki komut ile yüklüyoruz.

[php]

sudo apt-get install –no-install-recommends ubuntu-desktop

[/php]

Eğer KVM üzerinde yapacağınız işlemleri GUI arayüzünü kullanarak yapmak istiyorsanız bunun için virt-manager paketini yüklemeniz gerekiyor.

[php]

sudo apt-get install virt-manager

[/php]

Yukarıdaki komutu çalıştırdığımızda Y butonu ile paketlerin yüklenmesini başlatıyoruz.

[php]

etting up libgnome2-bin (2.32.1-4ubuntu1) …
Setting up libgnome2-0:amd64 (2.32.1-4ubuntu1) …
Setting up libbonoboui2-0:amd64 (2.24.5-0ubuntu3) …
Setting up libgnomeui-0:amd64 (2.24.5-3) …
Setting up python-gnome2 (2.28.1+dfsg-1ubuntu2) …
Setting up virt-manager (0.9.5-1ubuntu3) …
Processing triggers for libc-bin (2.19-0ubuntu6.5) …
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.30.7-0ubuntu1) …
tayfun@KVM2:~$
tayfun@KVM2:~$ sudo reboot

Broadcast message from tayfun@KVM2
(/dev/pts/0) at 1:06 …

[/php]

Kurulum tamamlandıktan sonra sudo reboot komutu ile sunucuyu reboot ediyoruz. Artık GUI arayüzünde açılacaktır.

4

User’imiz ile login oluyoruz.

5

Virtual machine yönetimini yapacağımız Virtual Machine Manager’i açıyoruz. Bunun için /usr/share/appliacations bölümüne giriyoruz ve Virtual Machine Manager’ı açıyoruz.

6

Virtual machine’lerinizi buradan yönetebilir yeni virtual machine’ler oluşturabilir hatta bunları farklı bir KVM’e migrate bile edebilirsiniz.

Umarım faydalı olmuştur.

İyi çalışmalar.

 

 

0 0 votes
Makaleyi Oylamayı Unutmayın !

Tayfun DEĞER

Bu yazı blog üzerinde Tayfun DEĞER tarafından paylaşılmıştır. 2009 yılında açılan blog kısa zaman içerisinde büyük bir izleyici kitlesine sahip olmuştur. Tayfun DEĞER danışmanlık ve eğitimler vermektedir. vExpert 2013-2019, VCP4/5/6, VCP5-DT, VCP-Cloud ve MCSE sertifikalarına sahiptir.Twitter 'dan @tayfundeger veya RSS ile sitedeki değişiklikleri takip edebilirsiniz.

İlgili Makaleler

Subscribe
Bildir
guest

6 Yorum
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Neslihan
Neslihan

Elinize sağlık hocam, kurulumu biliyordum ama cpu nun nasıl 64-bit olduğunu bu yazı sayesinde öğrenmiş oldum. Her yazınızda yeni bir bilgi ediniyorum. Yolunuz açık olsun inşallah.

Tayfun DEGER
Reply to  Neslihan

Çok teşekkürler.

Eralp Erat
Eralp Erat
Reply to  Tayfun DEGER

Tayfun selam , EsX , Hyper V ve KVM konusunda sağlam bir benchmark list ariyorum.Sende var mıdır ? Tşk. eralp attt pragmalinq nokta kommmm adresine atabilir misin ? Teşekkürler.

Tayfun DEGER
Reply to  Eralp Erat

Maalesef 🙁

Furkan Kulaber
Furkan Kulaber

Hocam öncelikle elinize sağlık, uzun zamandır openstack kvm ile ilgili araştırma yapmaktayım. Yapısal bakımdan tam anlamıyla cloud mantığı için kullanılabilir bir yapı fakat benim merak ettiğim konu türkiye’de sanallaştırma sektörü bakımından kullanışlı olur mu yada esxi üzerinden mi devam edilmeli, zira Fransa OVH, Openstack kvm ile satışı yapılıyor. Bu konular ile ilgili biraz aydınlatabilirseniz sevinirim.

Tayfun DEGER
Reply to  Furkan Kulaber

KVM gibi ürünlerin belirli bir support’u olmadığı ve sorun çözmek için ileri düzey linux bilgisi gerektiği için ben ESXi kullanılmasını herzaman için tavsiye ederim. Oluşan bir sorunda ESXi ile ilgili bir çok bilgi bulabilirsiniz ancak KVM ile ilgili bilgi bulmak biraz daha zor olacaktır.

Başa dön tuşu
6
0
Görüşlerini belirtmek ister misin?x