Friday, September 26, 2008

Tip: Matching Ktorrent for KDE 3.5.9 on OpenSUSE

I like KTorrent and I like KDE 3.5.9 on OpenSUSE. But I dislike the default KTorrent that came with the KDE 3.5.9 install: KTorrent 3.1.2 for KDE4.

So I decided to fix the issue. To do so I performed a zypper se ktorrent and found out that there is a ktorrent2 package with version 2.2.7 and a ktorrent package with version 3.1.2. A quick browse to http://ktorrent.org/ showed me that version 3.1.2 is for KDE4 while 2.2.7 is directed to KDE3.

To sum up:
  1. $ su
  2. # zypper rm ktorrent
  3. # zypper in ktorrent2
End result is the right KTorrent for the right KDE ;-)

Tip: Multimedia codecs on OpenSUSE 11.0

Support for some multimedia formats isn't on the openSUSE install media because they're proprietary, patented, Restricted Formats. Some of these include MP3, MPEG-4, playing of Encrypted DVDs, etc.

To enable support for multimedia codecs on OpenSUSE 11.0 point your web browser to http://opensuse-community.org/Multimedia.

If you are using the Gnome desktop environment refer to http://opensuse-community.org/codecs-gnome.ymp.

If you prefer the KDE desktop then point to http://opensuse-community.org/codecs-kde.ymp.

Both links point to a '1-Click' of the codec pack. If you prefer to perform the codec pack install manually:
  • $ su
  • # zypper in ffmpeg
  • # zypper in flash-player
  • # zypper in
  • # zypper in gst-fluendo-mp3
  • # zypper in java-1_5_0-sun-plugin
  • # zypper in k3b-codecs
  • # zypper in libdvdcss
  • # zypper in libxine1
  • # zypper in w32codec-all
Now go dig into your media collection for some stuff ;-)

Monday, September 22, 2008

HowTo: Install and setup MLDonkey on FreeBSD

Update 18-07-2012:
Added details on debugging MLDonkey, namely /var/log/mldonkey.
Added explanation of telnet authentication.

MLDonkey is an open source, free software multi-network peer-to-peer application. Currently the following protocols are supported: eDonkey, Overnet, Bittorrent, Gnutella, Gnutella2, Fasttrack, FileTP and Kademlia.

I wanted to put my 266 Mhz Celeron to good use so I've decided to install MLDonkey without X11 support leaving only the core with both telnet and web interfaces.

Bellow are the steps needed to install MLDonkey on FreeBSD 7.0:
  1. % su
  2. # cd /usr/ports/net-p2p/mldonkey
  3. # make WITHOUT_GUI=yes WITHOUT_X11="YES" WITHOUT_TK="YES" install clean
  4. # rehash
Now that MLDonkey is installed let's activate it at boot time:
  1. # echo 'mlnet_enable="YES"' >> /etc/rc.conf
  2. # echo 'mlnet_user="p2p"' >> /etc/rc.conf
  3. # echo 'mlnet_logfile="/var/log/mldonkey"' >> /etc/rc.conf
  4. # touch /var/log/mldonkey
  5. # chown p2p:p2p /var/log/mldonkey
Notice the mlnet_user option, for added security we'll create a p2p user:
  1. # pw user add p2p
  2. # mkdir /home/p2p
  3. # chown p2p:p2p /home/p2p
Restart the system for the changes to apply.

Now we are going to modify the MLDonkey configuration:
  1. % su
  2. # /usr/local/etc/rc.d/mlnet status
  3. # exit
  4. % telnet 127.0.0.1 4000
  5. > auth admin ""
  6. > passwd newpassword
  7. > set allowed_ips "127.0.0.1 192.168.1.0/24"
  8. > save
  9. > exit
Basically, we've checked to see if MLDonkey was running and accessed it through its telnet interface. Initially the application is configured without an admin password, so step 6 takes care of that. On step 7 we set the ips that are allowed to connect to the application, in the example the localhost and all clients in the local network.

In the future to authenticate through telnet:
  1. % telnet 127.0.0.1 4000
  2. > auth admin "mypasssword"
Replace mypassword with your own but keep it under "".

MLDonkey's web server can be accessed on http://localhost:4080, so fire-up your browser and point to the address. If your planning to access the server from another computer replace localhost bit by the server's ip or hostname.

The following are a few useful commands that can be passed on to MLDonkey:
  1. # /usr/local/etc/rc.d/mlnet start
  2. # /usr/local/etc/rc.d/mlnet stop
  3. # /usr/local/etc/rc.d/mlnet restart
  4. # /usr/local/etc/rc.d/mlnet status
If you come across any problems such as MLDonkey not starting check /var/log/mldonkey as this is file golden in debugging issues.

There are tons of configuration options available both in the telnet and web interfaces so I've opted to mention only the basic stuff. For more information I suggest browsing the project's website at http://mldonkey.sourceforge.net/.

Thursday, September 18, 2008

Tip: Add OpenSUSE Community repositories


To use OpenSUSE to a fuller experience its more or less required that you add a few third-party software repositories. These repositories provide loads more packages, as well as some non-free formats which may be of use.

To enable the Community repository starting from the Gnome desktop environment, point to Computer -> YaST -> Software -> Software Management.

Then, in the menu: Repositories -> Repository Manager. Once there hit the Add -> Community Repositories, and select:
  • Main Repository (OSS)
  • Main Repository (Non-OSS)
  • Packman
  • Main Update Repository

And we're set. Lots of goodies just zypper install away. ;)

Tip: Add Google Linux software repository to OpenSUSE

To add the Google repository start by becoming the superuser:
  • $ su
Add the repository using the Zypper package manager:
  • # zypper sa -t YUM http://dl.google.com/linux/rpm/stable/i386 google
Update the repositories and force Google repository's key import:
  • # zypper up
After running the above command you are prompted to answer yes/no twice, say yes on both ocasions.

HowTo: Setup a NFS server on Gentoo

To share the content of my P2P workhorse (1.3Ghz Pentium-M laptop running Gentoo Hardened) across my other Unix like machine I've decided to use NFS (Network File System).

To serve as reminder if I ever need to setup a NFS server on Gentoo and to help anyone seeking help I'll lay down the need steps to achieve success.

First become superuser:
  • $ su
Before setting the sever we need to make sure that client and server machines have support for NFS volumes:
  • # cd /usr/src/linux
  • # make menuconfig
  • check if the following options are enabled in the kernel config:
File Systems --->
Network File Systems --->
<*> NFS file system support
[*] Provide NFSv3 client support
<*> NFS server support
[*] Provide NFSv3 server support
Save your kernel config and re-compile the kernel. If you need help on this please refer to Gentoo's documentation as kernel configuration isn't the focus of this post.

Now install the nfs-utils package from portage:
  • # emerge nfs-utils
Editing the /etc/exports file to identify what are your sharing and to whom:
  • # vim /etc/exports
  • to share the /downloads directory to all computers on 192.168.1 network add the following line:
/downloads 192.168.1.1/24(rw,sync,no_subtree_check)
Let's start the nfs service:
  • # /etc/init.d/nfs start
To have the nfs service starting at boot time:
  • # rc-update add nfs default
Also, the showmount command can be used to display the exports on the server:
  • # showmount -e
If you perform any changes changes to the /etc/exports file, reload it by:
  • # /etc/init.d/nfs reload
I've focused on the basis to setup a home network NFS share on Gentoo, however there are loads of performance tunning flags that can be set on both server and client sides.

For more detailed documentation take a look into:
http://nfs.sourceforge.net/nfs-howto/index.html
http://gentoo-wiki.com/HOWTO_Share_Directories_via_NFS
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#book_part1_chap7
http://www.gentoo.org/doc/en/kernel-upgrade.xml

Wednesday, September 17, 2008

HowTo: Install and boot RIPLinux

RPLinux is a sysadmin distribution which comes with a vast array of tools for disk management, backup and troubleshooting. Despite the impressive number of tools it is still slim, fast and very well put together.

Bellow are the steps I took to install it from Windows XP to an USB flash drive and boot it in my laptop.
  • download the archive from http://www.tux.org/pub/people/kent-robotti/looplinux/rip/linux.exe
  • create a folder and move linux.exe into it
  • double-click to auto extract the contents of linux.exe (notice that a new linux folder was created)
  • insert an USB flash drive in the computer
  • click START -> MY COMPUTER -> right-click on the USB flash drive and select FORMAT -> choose FAT32 -> click OK
  • take notice of the drive letter of the USB flash drive
  • START -> Run
  • change directory of the created linux folder, typically it should be something like cd Desktop\linux
  • on the prompt type mkusb.bat h: in which h is the drive letter
Now we've created an USB flash drive capable of booting into RPLinux.

To boot it up, restart the computer and follow your BIOS instructions on how to boot from an USB device. On my laptop, a Dell Latitude D620, I simply press F12 and select the USB device and press ENTER; this of course changes from laptop to laptop so read your computer motherboard manual.

Resources:
http://www.tux.org/pub/people/kent-robotti/looplinux/rip/

HowTo: Monitor network traffic with vnStat on Gentoo

Following an install of vnStat on FreeBSD I took the opportunity and had it installed also in my 1.3 Ghz Pentium-M laptop running Gentoo Hardened. This laptop serves my p2p needs namely runs MLDonkey, SSH, Samba and NFS making it the perfect machine to monitor network traffic on.

Let's proceed with the steps needed to install vnStat from portage:
  • $ su
  • # emerge vnstat
Now let's find out the system network interface(s) in use, which in my case is eth0.
  • # ifconfig -a
To create vnStat's database we run:
  • # vnstat -u -i eth0
Finally, to activate the cron job to feed vnStat's database uncomment lines 7 through 9 on /etc/cron.hourly/vnstat as instructed by the file itself.

A nice list of switches can be viewed typing the following command:
  • $ vnstat --help
To display the default statistics:
  • $ vnstat
To display daily traffic statistics use the -d switch:
  • $ vnstat -d
Monthly traffic statistics can be viewed with the -m switch:
  • $ vnstat -m
To display current transfer rate in real time until interrupted:
  • $ vnstat -l
Further info on vnStat can be obtained in the project's homepage and in my previous post regarding vnStat on FreeBSD.

HowTo: Install and configure MPD on OpenSUSE

Following a previous post on how to install Music Player Daemon (MPD) on FreeBSD I'll be presenting the steps need to install it this time on OpenSUSE.
  1. $ sudo su
  2. # zypper ar http://packman.links2linux.de packman
  3. # zypper mr -r packman
  4. # zypper ref
  5. # zypper install mpd
  6. # vim /etc/mpd.conf
  7. # /etc.init.d/mpd start
  8. # chkconfig mpd on
With steps 2 to 4 we've added the Packman community repository and enable its auto-refresh and taken the opportunity to refresh the remaining repositories.

Step 6 deals with the configuration of MPD. Point to music_directory and type in the path of you music library.

On steps 7 and 8 we've started the MPD service and set MPD to start at each reboot.

If need you can update the database at any time by running:
  • # mpd --create-db
Now that we have the MPD server installed let's proceed by installing my favourite client: ncmpc.
  1. # zypper install ncmpc
  2. # exit
  3. $ ncmpc -c
As a side note, the Packman Repository's ncmpc rpm was built without the clock and search build options. You can rebuild the rpm yourself if you really want to use the mentioned options.

An heads-up: don't end you Gnome session with ncmpc paused. It seems that the next time you restart your system the /dev/dsp device will be in use effectively stopping you from using programs that use the device, such as Mplayer. Simply stop ncmpc before exiting it, press Backspace to do so.

Additional and extremely useful information can be found under /usr/share/doc/mpd and /usr/share/doc/ncmpc.

Monday, September 15, 2008

HowTo: Monitor network traffic with vnStat on FreeBSD

vnStat is a console-based network traffic monitor. It keeps a log of
hourly, daily and monthly network traffic for the selected interface(s).

Bellow you'll find the needed steps for its installation and setup on FreeBSD 7.0:
  1. % su
  2. # cd /usr/ports/net/vnstat ; make install clean
  3. # rehash
  4. # ifconfig -a
  5. # vnstat -u -i rl0
  6. # cat /usr/local/share/doc/vnstat/vnstat-cron >> /etc/crontab
On steps 1 to 3 we basically became to the superuser, changed to the vnStat's port directory, proceeded by compiling the port and rehashing the shell.

Step 4 purpose is to find out the system network interface(s) in use, which in my case is rl0.

Finally with step 6 we've activated the cron job to feed vnStat's database following the port's supplied example.

To display the default statistics:
  • % vnstat
To display daily traffic statistics use the -d switch:
  • % vnstat -d
Monthly traffic statistics can be viewed with the -m switch:
  • % vnstat -m
To display current transfer rate for the selected interface in real time until interrupted:
  • % vnstat -l -i rl0
A nice list of switches can be viewed typing the following command:
  • % vnstat --help
And we're done. ;)

Further documentation is available at http://humdi.net/vnstat/.

Friday, September 12, 2008

HowTo: Install Vim WITHOUT X11

I like Vim and I like using those cool colour schemes available for the editor.

So in my ingenuity I changed directory to /usr/ports/editors/vim and ran make install clean... big mistake! It tried to install all sorts of X11 related stuff and of course X11 itself. Normally this wouldn't be a problem, however on a 266 MHZ headless server I really don't want a GUI of any sorts.

To address the situation I read the port's Makefile and noticed several options that could be passed on the make step, namely WITHOUT_X11.

Here's how to install Vim without X11:
  1. % su
  2. # cd /usr/ports/editors/vim
  3. # make WITHOUT_X11=yes NO_GUI=yes LITE=yes install clean
  4. # rehash
And that's it.

Now I can finally use those cool colour schemes again. :D

Thursday, September 11, 2008

Fix: Touchpad not working on OpenSUSE 11.0

All of a sudden the touchpad on my Dell D620 stopped working. After googling for an answer I came across a post on LinuxQuestions.org pointing to the solution.

To sum up, browse to Control Center > Sessions and deselect Touchpad from the Startup Programs tab. After restarting your session you'll be able to use the touchpad once again.

Note that the KDE desktop enviornment on OpenSUSE is unaffected by this bug, it only affects GNOME.

Props to LinuxQuestion.org user swampdog20002 having posed the question and posting updates on how he was solving the problem. That's the opensource spirit!

HowTo: Setup a NFS server on FreeBSD

On a previous post I went through the needed steps to enable NFS client operations on FreeBSD 7.0 so now lets wrap up with the need steps to setup a NFS server.

Lets begin:
  1. % su
  2. # echo 'nfs_server_enable="YES"' >> /etc/rc.conf
  3. # echo 'rpcbind_enable="YES"' >> /etc/rc.conf
  4. # echo 'mountd_flags="-r"' >> /etc/rc.conf
  5. # echo 'rpc_lockd_enable="YES"' >> /etc/rc.conf
  6. # echo 'rpc_statd_enable="YES"' >> /etc/rc.conf
By passing these options we guarantee that NFS related daemons are started at boot time. Steps 2 to 4 are mandatory and enable the NFS daemons, steps 5 and 6 are optional and are used to guarantee file locking operations over NFS and monitor NFS client so that the NFS server can free resources when the host disappears.

Lets proceed by identifying what we want to share:
  1. % su
  2. # vi /etc/exports
  3. add the following line:
/usr/ports/distfiles -network 192.168.1 -mask 255.255.255.0
Step 3 shares the /usr/ports/distfiles directory and make it available to any client with an IP address beginning in 192.168.1 and netmask of 255.255.255.0.

Now that we've enabled the NFS server settings and configured the exports file, lets start the server by:
  1. % su
  2. # rpcbind
  3. # nfsd -u -t -n 4
  4. # mountd -r
If you perform any changes changes to the exports file, reload it by:
  1. % su
  2. # /etc/rc.d/mountd onereload
Also, the showmount command can be used to display the exports on the server:
  1. % su
  2. # showmount -e
I've focused on the basis to setup a home network NFS share, however there are loads of performance tunning flags that can be set on both server and client sides.
For more detailed documentation take a look into:
http://www.freebsd.org/doc/en/books/handbook/network-nfs.html
http://nfs.sourceforge.net/nfs-howto/index.html

Wednesday, September 10, 2008

HowTo: Mount NFS shares on FreeBSD

NFS (Network File System) is a nice and easy way to share files across Unix like systems such as *BSD, Solaris and Linux.

Here are the steps I took to enable the NFS client:
  1. % su
  2. # echo 'nfs_client_enable="YES"' >> /etc/rc.conf
  3. # echo 'nfs_client_flags="-n 4"' >> /etc/rc.conf
  4. # nfsiod -n 4
Basically steps 2 and 3 enable the NFS client at boot time, while step 4 starts the client immediately. In alternative to step 4 you can reboot or run /etc/rc.d/nfsclient start as root.

Now that we have the NFS client running we can proceed to accessing NFS shares. To mount NFS shares issue the following commands on the client:
  1. % su
  2. # mkdir /mnt/downloads
  3. # mount -v 192.168.1.101:/usr/local/downloads /mnt/downloads
Step 2 creates a directory in which to mount the remote share. On step 3 I've mounted a NFS share available on the 192.168.1.101 server (if you have hosts information properly configured you can use the server hostname instead).

And that's it. Pretty simple and straightforward.

HowTo: Start, stop and restart the network on FreeBSD

Having moved my old 266 Mhz Celeron to our apartment and facing a new (actually pretty old) router I needed to make adjustments to the FreeBSD 7.0 install, namely network related adjustments.

So here is a series of commands on how to start, stop and restart the network service on FreeBSD:

Start the network service:
  • % su
  • # /etc/rc.d/netif start
Stop the network service:
  • % su
  • # /etc/rc.d/netif stop
Restart the network service:
  • % su
  • # /etc/rc.d/netif restart
When performing network setting changes it's often necessary to restart the routing service:
  • % su
  • # /etc/rc.d/routing restart
To restart both the network and routing services simply combine the commands:
  • % su
  • # /etc/rc.d/netif restart && /etc/rc.d/routing restart
If you come accross a status: no carrier message, run the following (substitute re0 by your interface):
  • % su
  • ifconfig re0 down
  • ifconfig re0 up
Documentation on how to setup network interfaces can be found at http://www.freebsd.org/doc/en/books/handbook/config-network-setup.html.

Monday, September 1, 2008

Book Review: SUSE Linux Toolbox (follow-up)

Roughly a month after buying the book I've finished reading it.

All my initial impressions were right on the spot: it is really a great book and was worth every euro.

During the holidays I managed to read the remaining chapters and learned a lot and also refreshed some concepts. Loved chapters 3 "Using the shell", 4 "Working with files" and 5 "Manipulating text". All 3 chapters were really useful and covered with tips applicable to the everyday use of the shell.

Chapter 6 "Playing with multimedia" was one of those chapters that I left for the end as the subject didn't appeal much and thought I wouldn't enjoy it. Well I was wrong, it was very enjoyable and didn't regret reading it one bit.

The only chapter I found lacking was the last one "Locking down security". I was expecting security tips to harden my server but the entire chapter was very light and shallow, and ended up not learning anything new or helpful for that matter.

Appendix A, B and C are top notch specially for anyone using Vim.

When at the computer during my holidays I did browse it as a quick-reference whenever I couldn't remember that exact command in Vim and also used it to fine tune some aspects of a recent OpenSUSE 11.0 install. The book's straight to the point approach is very practical, which aligned with the fact that the book is around 300 pages makes it ideal to carry around and quickly consult it.

Now I'll be searching for another gem but if I don't manage to find anything in the local bookstore I'll probably order something online. Absolute FreeBSD, FreeBSD Basics and Building a Server with FreeBSD have caught my eye so I'll try to get my hands on them.