My blog has been moved to ariya.ofilabs.com.
Showing posts with label opensuse. Show all posts
Showing posts with label opensuse. Show all posts

Saturday, February 20, 2010

distcc, VirtualBox, NAT

The following scenario is quite typical. Your family member, spouse, or coworker has this fantastic, powerful, brand-new multicore machine which, for some reasons, has to run Windows or Mac OS X. On the other hand, you probably have some el-cheapo laptop which is also wonderful but it lacks the processing power to do heavy-duty build and compile. Now, what if you can exploit the other box for a distributed compile? Especially if the powerful box seems to be idle once a while, doing nothing.

Many of you already figure it out the solution: let's install Linux on a virtual machine and use tools like distcc or icecream. In fact, this is quite easy to do. I managed to find out the details, even if I have only little idea about network stuff.

Side note: I don't see why icecream would not work. But since I did try distcc, that's what I wrote below.

For the following explanation, refer to the above exemplary network setup. Basically I run virtualized openSUSE inside VirtualBox. You don't even need a full-blown graphical system, you can create a customized openSUSE installation (no X11 but with some development tools like make, gcc, g++, etc) using SUSE Studio.

First of all, we need to configure VirtualBox to do port forwarding. If you read the manual, you see that the default networking is NAT, which is what we use, along with extra forwarded ports. To do this, run the following on the command prompt (in your installation folder, e.g. C:\Program Files\Sun\VirtualBox for Windows, tweak for Mac OS X), changing openSUSE with the name of your virtual machine:

VBoxManage.exe setextradata "openSUSE" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/distcc/HostPort" 3632
VBoxManage.exe setextradata "openSUSE" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/distcc/GuestPort" 3632
VBoxManage.exe setextradata "openSUSE" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/distcc/Protocol" TCP
VBoxManage.exe setextradata "openSUSE" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage.exe setextradata "openSUSE" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage.exe setextradata "openSUSE" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

The last 3 lines are not important for distcc itself, however it's quite handy since you will be able to ssh to the machine (on the port 2222, i.e. the forwarded one and not port 22) and start or stop distcc remotely.

Side note: I was told that bridged networking mode should work as well (even without the hassle of port forwarding). However, I did not manage to make it working in my setup.

In addition, tweak the settings of your virtual machine so you get more than one CPU cores. For example, on a quad-core machine, giving the virtualized openSUSE two or three cores might be better, considered if the host system does not run need all that burning power.

Next step is to install distcc both on the virtualized openSUSE (anjali) and your laptop (latika). The easiest way is to use the one click install feature, just go to software.opensuse.org, click on Package Search, type in distcc and press Enter and then install both distcc and distcc-server. To do it manually, add http://download.opensuse.org/repositories/home:/dbahi/openSUSE_11.2/ to your repositories and install using:

sudo zypper in distcc distcc-server

After that, on anjali, run the following (as normal user, no need to sudo/root):

/usr/sbin/distccd --daemon --allow 192.168.1.0/24

Now on your own machine, latika in the above example, set first where you want to distribute the compile:

export DISTCC_HOSTS='anjali,lzo'

If you want, do this in your .bashrc or shell startup script for your convenient.

Compiling and building a project is now as easy as replacing the plain make command with:

make -j4 CC=distcc CXX=distcc

For troubleshooting, run distccmon-text 3 (nice for static logging) or watch distccmon-text (useful for real-time view).

Supposed another machine, e.g. naina, wants to join the party, just do the same steps. Don't forget to adjust DISTCC_HOSTS so that the compile will be distributed also to naina.

That's it! For more info (I barely scratch the surface) and better optimization, refer to the manpage of distcc and distccd.

Now the (trivia) question is, the host that runs anjali, who do you think he is? :)

Tuesday, October 20, 2009

Chromium on OpenSUSE

Though Google Chrome for Linux is not yet officially announced, people have been working to make Chromium, the open-source version thereof, available for different popular distributions. I wrote before about CrossOver Chromium, but not only this is just a hack, it is also not up-to-date at all. The easiest way for OpenSUSE 11.1 users is to use the package from Contrib.

Though for veteran OpenSUSE fans, the steps to install Chromium are obvious, here I write down the idiot-proof version. Go to http://software.opensuse.org/search, type Chromium and click the Search button, wait for a moment, find the entry from openSUSE:Factory:Contrib/openSUSE_11.1, then well, click on the 1-Click Install button there. Follow the usual installation guides (mostly just agreeing and confirming some stuff), then in few minutes you will get:

Who says installing software in Linux is difficult? :)

Sunday, January 13, 2008

KDE 4.0 on OpenSUSE 10.3

KDE 4.0 is doubtlessly the most discussed KDE release at the moment. Some praise it, some don't really favor it. But whether you're going to like it or not, it's worth to, at least, give it a try.

If you use OpenSUSE 10.3, installing KDE 4.0 is very easy, it's just one-click away! Simply click on the following icon:

Wait few minutes (or hours), then you'll get the desktop:

KDE 4.0 on OpenSUSE 10.2

Update: and add some plasmoids to get something like

Plasmoids on KDE 4.0

Sunday, October 07, 2007

OpenSUSE 10.3: first look

I know I should be doing something "useful", but the fresh-from-oven OpenSUSE 10.3 is just too good to skip. Thus, I decided to waste a weekend to try it. In short: it's very solid and attractive, without doubt the best OpenSUSE release so far.

Installation (and upgrade) was easier than ever. Now we need only one CD. I choose KDE of course. For most users, this means getting openSUSE-10.3-GM-KDE-i386.iso through http/ftp/torrent, burning it, and using it to perform the installation.

The first boot after the installation (yes, it's green again!) shows that boot time is needed really improved. My laptop needs 54 seconds until I get a fully functional KDE desktop, it takes at least 70 seconds with OpenSUSE 10.2, 90 seconds with Windows XP.

Green Desktop

Post installation, I had little problem trying to connect to Internet using my DSL modem, even after the usual steps of removing NetworkManager and installing KInternet. It turned out, somehow smpppd is not activated by default. If you experience the same problem, the solution is easy: run YaST, System, System Services (Runlevel) and then enable smpppd. While you're there, try to tweak some services and turn off what you don't need (e.g. for pure desktop, no need for postfix).

And while doing software management, one quickly notices that package management is thousand times better compared to the previous versions. With OpenSUSE 10.1/10.2, doing things with packages is just unbearable without Smart, IMO zmd along with its Mono stuff are not for mere mortals. However, now zmd is gone, zypp is already greatly improved and thus making application installation in OpenSUSE 10.3 significantly faster than ever. Even better, if you are used to subscribe to alternative repositories (e.g. Guru, Packman, KDE:Backports, etc), there is a new Community Repositories module in YaST which allows you to add common non-official repositories with only few mouse clicks. This is extremely simple even for novices.

OpenSUSE 10.3: Click-and-install feature

But the best is yet to come. Now OpenSUSE offers one-click application install. This is a new feature which will be appreciated by typical desktop users. Rather than using YaST to install new software, you just go to http://software.opensuse.org/search, search for the program, and then click on the 1-Click Install button to start the installer, which will download the packages (and handle the dependencies, if necessary) and install them for you. It couldn't be easier, extremely useful for Linux newbies. It also resembles the way most applications are installed in Windows, a plus for those who switched or want to switch.

Of course you can still use the familiar YaST to install and remove programs as usual. At first, maybe you'll be a bit surprised because the icons in YaST have been changed. Looks like these new icons are designed to match Tango icon sets. If you prefer the good old Crystal style, just follow binner's tips: remove package yast2-theme-openSUSE and install yast2-theme-openSUSE-Crystal instead.

As with any fresh Linux box nowadays, you need to perform the extra steps to install non open-sourced stuff so that you can enjoy e.g. your MP3 music. With the new click-and-install, this also couldn't be easier. Just go to http://opensuse-community.org/Restricted_Formats/10.3 and click on codecs-kde.ymp link. The same installation wizard will pop-up, then just follow the step-by-step instructions. In addition to multimedia codecs, you can have the option to install Java (1.5 or 1.6) and Flash plug-in as well. All with few mouse clicks.

The same easy procedures apply also for installation of proprietary NVIDIA or ATI driver. For example, for ATI graphics card, just read the super-simple instructions, again a matter of clicking a link (even a child can do that!). You don't even need to know the model of the graphics card.

Conclusion: with one CD install, faster boot, easier package management, single-click application install, OpenSUSE 10.3 is definitely worth to try. For 10.2 users: upgrade!