Tagged: Slackware

slackware64: Installing qemu-kvm and virt-manager

I've been using VirtualBox for a while on my slackware box. It's been working ok but I recently read a couple of blogs/articles recommending KVM. They said that KVM is rapidly becoming the de facto standard for open source visualization. Interesting. So, I gave a shot with qemu-kvm with libvirt (for GUI).

Disclaimer:
The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.

Terminology:

libvirt
libvirt allows management of different virtualization solutions such as KVM and Xen through a common (programming and user) interface.
virt-manager
A graphical virtual machine manager
KVM (Kernel Virtual Machine)
KVM provides full virtualisation and can run unmodified Linux or Windows images, but it requires CPU virtualisation extensions (Intel VT or AMD-V).
Qemu
Qemu functioning as a userspace, software-only emulation package. It can be used standalone (that is, it does not require a special kernel module, or CPU virtualisation extensions, or a hypervisor layer) and is capable of running unmodified operating system images.

Prerequisite:

The CPU needs to support virtualization in order to take advantage of qemu-kvm. To check, execute below command: $ egrep -c '(vmx|svm)' /proc/cpuinfo

If the CPU supports virtualization, you should get a non-zero value.

Or, as Daniel Berrange suggested, virt-host-validate to validate host virtualization setup: # virt-host-validate qemu QEMU: Checking for hardware virtualization: PASS QEMU: Checking for device /dev/kvm : PASS QEMU: Checking for device /dev/whost-net : PASS QEMU: Checking for device /dev/net/tun : PASS

Installation and Post-Configurations:

Install qemu-kvm, libvirt, virt-manager and their dependencies from SlackBuilds.org.

There are a few notes for post-configuration:

  • Configure libvirt for user group and permission:
    Create a group called libvirt and assign a regular user to it. Then, uncomment unix_sock_group and unix_sock_rw_perms from /etc/libvirt/libvirtd.conf # groupadd libvirt # gpasswd -a USER libvirt # vim /etc/libvirt/libvirt.conf ----------------------------------------- unix_sock_group = "libvirt" unix_sock_ro_perms = "0770" unix_sock_rw_perms = "0770"
  • Default user group for kvm:
    The qemu-kvm SlackBuild patches the installed udev rules so that you no longer are required to use the system group kvm as the default. The users group is set as the default
  • Start the libvirt daemon at boot:
    To start the ibvirt daemon at boot, add a following piece of code to /etc/rc.d/rc.local # vim /etc/rc.d/rc.local ---------------------------------------- # Start libvirt: if [ -x /etc/rc.d/rc.libvirt ]; then /etc/rc.d/rc.libvirt start fi

Now Virtual Machine Manager (VMM) can be executed via: $ virt-manager

That's all!
-gibb

Slackware64: Configuring IBus

A Happy New Year!
This is the first blog entry in 2013.

I have been using "scim" for Japanese input since I started using slackware. It's an ok input method framework, but I always felt a bit uncomfortable for some reasons. So, I looked for another option and found IBus. It looks like this framework will be replacing scim in the near future. So, I decided to give it a try.

Disclaimer:
The information below is from Linuxquestions.org and some tweaking. It is solely used for my purpose and may not be suitable for others.

First, install ibus, pyxdg, ibus-anthy, and ibus-qt from SlackBuilds.
Then, create a directory and a file in it: # mkdir /etc/X11/xinit/xinput.d # vim /etc/X11/xinit/xinput.d/ibus.conf --------------------------------------------- #!/bin/sh export XMODIFIERS="@im=ibus" export GTK_IM_MODULE="ibus" export QT_IM_MODULE="xim" # allow capslock remap xmodmap -e 'clear Lock' -e 'keycode 66 = F13' XIM=ibus XIM_PROGRAM=/bin/true XIM_ARGS= SHORT_DESC="ibus" LONG_DESC="ibus"

Then, create a symlink to ~/.xinputrc: $ ln -s /etc/X11/xinit/xinput.d/ibus.conf ~/.xinputrc

Add following statement in the autostart file (~/.config/openbox/autostart): ibus-daemon -rxd &

Log out and log back in. There should be a keyboard icon in the system tray. Now, move onto its configuration.

Run ibus-setup: $ ibus-setup

This command brings up the IBus Preferences window: General->Next input method: "Shift+Meta_L" Input Method->Select and input method->Japanese->Anthy Advanced->(check) Share the same input method among all applications

That's all!
-gibb

Openbox: Customizing to My Liking

In another post, I mentioned that I love Openbox for its minimal overhead, few dependencies, customizable menu and key-binding, and speed. I use it on my home system and decided to use the same configuration on my new notebook. Here is how I currently configured my system(s).

Disclaimer: The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.

ObConf:

ObConf is the Openbox configuration tool which easily change themes of menus and windows. I happen to like 1977 Openbox theme available from Box-Look.org or here. $ mv 1977-Grey.obt /tmp $ obconf & ------------------------ Theme -> Install a new theme... -> 1977-Grey Appearance -> Button Order: IMC Appearance -> Active Window Title: Sans 4

Theme:

I use Morning Glory (GTK 2.x theme) available from Gnome-Look.org and customized it for my liking. My customized one is available here. Once downloaded it, un-tar it and move it to the .theme directory. Use lxappearance to select it as the theme. $ tar -xzvf MorningGlory.tar.gz $ mv MorningGlory ~/.themes $ lxappearance & ------------------------ Widget -> MorningGlory

Panel:

I use tint2 for my panel. My titn2rc is available here. $ tar -xzvf tint2.tar.gz $ mkdir ~/.config/tint2 $ mv tint2rc ~/.config/tint2/ $ tint2 & (or put it in autostart.sh)

Conky:

Conky is a fee software system monitor for X11 and is able to monitor system resources like CPU, memory, processes, disk usage, network interfaces, and much more. My conky is very simple and it displays system resources at the bottom of screen, looks much like a panel. My conkyrc file is available here. $ tar -xzvf conkyrc.tar.gz $ mv .conkyrc ~/ $ conky & (or put it in autostart.sh)

Autoscript:

When Openbox is launched with the openbox-session command, the environment script will be executed to set up the environment, and then the autostart script can launch any applications you want to run at startup, such as a panel, setting up a desktop wallpaper, etc... Once Openbox starts, the system-wide default script, located at /etc/xdg/openbox/autostart, will be run. Then the user script at ~/.config/openbox/autostart is run afterward. This is my autostart.

File managers:

I use Thunar; a fast, light-weight and easy-to-use file manager. It is the file manager for Xfce. I started using sunflower. It is available in AUR, so it needs to be built: $ mkdir ~/builds $ mv sunflower.tar.gz ~/builds $ tar -xzvf sunflower.tar.gz $ cd sunflower ------------------------ Check for PKGBUILD and any install files ------------------------ $ makepkg -s # pacman -U sunflower-<version number>-<package revision number>-<architecture>.pkg.tar.xz $ pacman -Qm

Icons:

Icons theme that I use is Faenza 1.2 available from Gnome-look.org. It comes with "zipped" format so I need an unzip program to extract it. $ mkdir icons; mv faenza_icons_by_tiheum-d2v6x24.zip icons/; cd icons $ unzip faenza_icons_by_tiheum-d2v6x24.zip $ ./INSTALL There is an INSTALL script for this so execute it and follow the instruction.

Wallpaper:

On my home system, I use nigrogen to draw wallpapers on my dual-head display, but I like feh for its lightweight and powerful image displaying capabilities. This is how to use it as a desktop wallpaper manager. $ feh --bg-scale /path/to/image.file As an image viewer: $ feh /path/to/image.file To browse images in a specific directory: $ feh -g 320x240 -d -S filename /path/to/directory
  • -g : Forces the images to appear no larger than 320x240
  • -d : Draws the file name
  • -S filename : Sorts teh images by file name
My current wallpaper for Arch Linux is available here.

Terminal:

I use rxvt-unicode (urxvt). It a terminal emurator forked from rxvt and supports unicode. It is highly customizable via ~/.Xdefaults and its complete reference is available from here. My .Xdefaults file is available here.

PS1:

My PS1 is very simple. Since there is only me on this system, I don't need to show the user name. Here is my .bashrc script $ vi ~/.bashrc ------------------------ ID=`id -u` if [[ "${ID}" -eq 0 ]]; then PS1='\]\e[01;35m\]root\]\e[00;31m\]@\h\[\e[00;37m\][\[\e[01;34m\]\w\[\e[00;37m\]]\n\[\e[47m\]\[\e[1;30m\]#\[\033[00m\] ' else PS1='\[\e[00;32m\]\A \[\e[00;91m\]\u\[\e[01;93m\]@\h\[\e[00;37m\][\[\e[01;34m\]\w\[\e[00;37m\]]\n\[\e[47m\]\[\e[1;30m\]$\[\e[00m\] ' fi set -o vi $ vim ~/.bash_profile ------------------------ if [ -f ~/.bashrc ]; then . ~/.bashrc fi

Key Binding:

One of Openbox’s great strengths is that every aspect of the window manager can be configured with keyboard. I'm still experimenting with this feature but here is my rc.xml. At this point, I move the active window with "Super" + l (to left), "Super" + h (to right), "Super" + k (to up), and "Super" + j (to down).

Menu:

My customized menu is here. This menu includes reboot and shutdown. For a regular user to be able run those commands, it needs to be added in the sudoers file:# vim /etc/sudoers ------------------------ [user_name] ALL=NOPASSWD: /sbin/shutdown That's all!
-gibb

Slackware64 14: Post Installation Configuration

Yep. Long waited Slackware 14.0 was finally released on 09/28/2012! I immediately downloaded and installed on my system as a guest OS for VirtualBox. Since the installation and a bit of customization, I have not had enough time to play with it, but now, I tried some more configuration today.

Disclaimer:
The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.

Switching to Generic Kernel:

During Slackware installation, it uses "huge" kernel, which has every hardware driver built in. It's not necessary to switch to "generic" kernel, but it is said that with "generic" kernel, it uses less memory and runs faster since "generic" kernel has virtually no drivers built in and all drivers are loaded into RAM on demand.

Create an initial RAM # /usr/share/mkinitrd/mkinitrd_command_generator.sh

This is an informational-only command which shows a next command (mkinitrd) to run to generate the initrd.gz image. # # mkinitrd_command_generator.sh revision 1.45 # # This script will now make a recommendation about the command to use # in case you require an initrd image to boot a kernel that does not # have support for your storage or root filesystem built in # (such as the Slackware 'generic' kernels'). # A suitable 'mkinitrd' command will be: mkinitrd -c -k 3.2.29 -f ext4 -r /dev/sdb2 -m ohci-hcd:mbcache:jbd2:ext4 -u -o /boot/initrd.gz

Add a new section in /etc/lilo.conf to load a new image. # vim /etc/lilo.conf ------------------------ image = /boot/vmlinuz-generic-3.2.29 initrd = /boot/initrd.gz # add this line so that lilo sees initrd.gz root = /dev/sda1 label = Slackware read-only

Also, put "lba32" in the global options in /etc/lilo.conf to avoid getting a warning message "lba32 addressing assumed" # vim /etc/lilo.conf ------------------------ # Override dangerous defaults that rewrite the partition table: change-rules reset lba32 # Normal VGA console

Save the file and run below command then reboot. # lilo -v

That's all!
-gibb

Slackware64: Name-Based Web Sites on a Single IP Address (vhosts)

Configuring VirtualHost with Slackware64 13.37 is also relatively easy. This is my local setup.

Uncomment below from /etc/httpd/httpd.conf. This enables virtual host. Include /etc/httpd/extra/httpd-vhosts.conf

Edit /etc/httpd/extra/httpd-vhosts.conf

Note on access control. From Apache version 2.4, Options, Allow, and other directives are replaced by the Require directive. Neglecting to make this change could result in 403 Forbidden You don't have permission to access / on this server. or AH01630: client denied by server configuration... in the error log.

For more detailed information, upgrading overview document is useful. NameVirtualHost *:80 <virtualhost *:80> <directory "/home/ubyt3m3/www/siteA"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Require all granted [Edit: To comply with Apache 2.4] </directory> ServerName siteA DocumentRoot "/home/ubyt3m3/www/siteA" ErrorLog "/var/log/httpd/siteA.err" CustomLog "/var/log/httpd/siteA.log" common </virtualhost> <virtualhost *:80> <directory "/home/ubyt3m3/www/siteB"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all Require all granted [Edit: To comply with Apache 2.4] </directory> ServerName siteB DocumentRoot "/home/ubyt3m3/www/siteB" ErrorLog "/var/log/httpd/siteB.err" CustomLog "/var/log/httpd/siteB.log" common </virtualhost>

Edit /etc/hosts so that the sites can be found by name: 127.0.0.1 siteA siteB

Restart the httpd process: /etc/rc.d/rc.httpd stop /etc/rc.d/rc.httpd start

That's all!
-gibb

Disclaimer:
Information in this page is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.