Wednesday, December 17, 2008

Tip: Updating FreeBSD with freebsd-update with full filesystem

My old 266 Mhz Celeron (soon to be replaced my an ASUS I220GC motherboard with integrated Celern 220 CPU) is installed on a 4GB HDD which leaves about 297Mb for the /var filesytem.

freebsd-update, the base tool to perform binary system updates, uses by default the /var filesystem. While updating to the recent FreeBSD 7.1-RC1 I couldn't finish the update due to a full filesystem.

Here's how solve the issue and fully update the system:
  • % su
  • # freebsd-update -d /path/to/big/path/directory/ upgrade -r 7.1-RC1
  • # freebsd-update -d /path/to/big/path/directory/ install
  • # shutdown -r now
  • # freebsd-update -d /path/to/big/path/directory/ install
  • # shutdown -r now
In other words, simply use freebsd-update's -d option. man freebsd-update and http://lists.freebsd.org/pipermail/freebsd-stable/2008-December/047014.html for more info.

Happy updating ;)

Tip: Fix freebsd-update problems

I tried to update my desktop from FreeBSD 7.1-PRERELEASE to 7.1-RC1 however I came across an error along the lines of "No mirrors remaining, giving up" .

Here's how to fix the issue:

% su
# env UNAME_r=7.1-PRERELEASE freebsd-update upgrade -r 7.1-RC1

Substitute the current and target versions according to you particular system and you should be able to update the system as usual.

Friday, December 5, 2008

Tip: Enable sound on Enemy Territory under FreeBSD

Enemy Territory is available in FreeBSD's ports system under /usr/ports/games/linux-enemyterritory. The port's Makefile makes no mention that if you install the game and run it you'll be playing without sound.
Here's a quick tip on how to enable sound on Enemy Territory under FreeBSD 7.0:
  1. % su
  2. # sysctl hw.snd.compat_linux_mmap=1
  3. # echo "hw.snd.compat_linux_mmap=1" >> /etc/sysctl.conf
  4. # exit
Step 2 enables sound immediately and with step 3 sound will be enabled at boot time.
And that's it. Now hurry and go play the world great first-person shoot ever.
d^.^b

Wednesday, November 19, 2008

HowTo: Logitech MX500 under FreeBSD

I have both a Logitech MX500 and a MX518, however I've loaned the MX518 to my brother. So I took my previous post on MX518 and mirrored it to MX500.

Being an Enemy Territory (ET) old timer I need to make full use of the MX500 mouse under FreeBSD, which means having the Back, Forward and the other weird button below the wheel working as available binds while playing ET.

The bellow xorg.conf settings were tested under FreeBSD 7.0 and X.Org X Server 1.4.2.
  • % su
  • # vim /etc/X11/xorg.conf

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5"
Option "ButtonMapping" "1 2 3 6 7 8 9 10 4 5"
Option "Emulate3Buttons" "false"
EndSection
With these settings you're free to bind MOUSE4, MOUSE5 and KP_EQUALS to Enemy Territory.

As a bonus, you can now use the Back and Forward buttons under Opera.

HowTo: Activate keyboard numlock on KDE under Gentoo

Having finished compiling KDE 3.5.9 as described here I proceeded fine tuning it which involves among other things enabling the keyboard numlock.

In this post I'll lay down some alternatives that will allow you to activate the keyboard numlock on the KDE desktop environment:
  1. on a per user basis using KDE's autostart mechanism
  2. through the KDM login manager
  3. installing the kxkb package and graphically using the Kcontrol center
Alternative 1
You can activate the keyboard numlock on peer use basis like so:
  • $ su
  • # emerge --ask --tree --verbose numlockx
  • # exit
  • $ vim .kde3.5/Autostart/numlockx
#!/bin/sh
numlockx on
  • $ chmod +x .kde3.5/Autostart/numlockx
Alternative 2
In alternative if you use KDM as your login manager you can set it on system wide:
  • $ su
  • # echo "/usr/bin/numlockx on" >> /usr/kde/3.5/share/config/kdm/Xsetup
Alternative 3
Yet another alternative is to install kde-base/kxkb if you've installed KDE using split ebuilds (like I did here):
  • $ su
  • # emerge --ask --tree --verbose kxkb
  • browse to KDE's Control Center > Peripherals > Keyboard > NumLock > Turn on
As a side note the above procedures can easily be mirrored to any Unix like system.

Now go ahead and fully use your keyboard ;-)

Resources:
http://www.gentoo-wiki.info/TIP_Numlock
http://wiki.archlinux.org/index.php/Activating_Numlock_on_Bootup
http://linux-bsd-sharing.blogspot.com/2008/10/howto-install-and-setup-kde-35x-on.html

Tip: Fixing e2fsprogs block on Gentoo

A portage block as popped up lately on the portage tree. The block regards sys-fs/e2fsprogs, sys-libs/e2fsprogs-libs, sys-libs/ss and sys-libs/com_err.

Normally when facing with blocks on world it just a matter of unmerging the blocking packages, resuming and running revdep-rebuild just in case. However in this particular block were dealing with the system set. This means that while unmerging the blocking packages there a good chance you'll break something... badly.

Here's how to deal with the e2fsprogs block:
  1. $ su
  2. # eix-sync
  3. # emerge --fetchonly e2fsprogs e2fsprogs-libs
  4. # emerge --unmerge com_err ss e2fsprogs
  5. # emerge --oneshot e2fsprogs
Basically on step 3 we've fetched the source for e2fsprogs and e2fsprogs-libs. On step 4 we've unmerged the blockers and finally on step 5 emerge e2fsprogs.

Notice that by unmerging com_err or ss you'd break wget making it impossible to fetch the e2fsprogs and ef2progs-libs packages through portage (though you could fetch them manually). The --oneshot option is used on step 5 as e2fprogs is a system package and should not be in world.

Also consider as a safety precaution adding buildsyspkg to the FEATURES variables in /etc/make.conf as this enables the build of binary packages for just packages in the system set.

Wednesday, October 29, 2008

HowTo: Using Fstab entries to mount Samba shares on Linux

Samba is an Open Source/Free Software suite that provides file and print services to all manner of SMB/CIFS clients. Samba is freely available, and allows for interoperability between Linux/Unix servers and Windows-based clients.

Samba shares can be accessed in several ways, such as issuing the mount command, using /etc/fstab entries, accessing it through file browsers such as Konqueror, Midnight Commander and Nautilus.

The current post addresses /etc/fstab entries on Linux systems.

To automatically mount a Samba share at boot time we need to edit the /etc/fstab file and add the necessary entry:
  • $ su
  • # vim /etc/fstab
//192.168.0.1/share /mnt/samba smbfs username=username,password=yourpassword 0 0
Due to security issues it’s not a good idea to put username/password in the /etc/fstab file. So you can change the username=username,password=password section and replace it with credentials=/root/.fstabcredentials:
  • # vim /etc/fstab
//192.168.0.1/share /mnt/samba smbfs credentials=/root/.fstabcredentials 0 0
Next we create the /root/.fstabcredentials file and add the needed information:
  • # vim /root/.fstabcredentials
username=username
password=password
Substitute the username and password arguments according to your system.

To further close access to the file we change it's permissions:
  • # chmod 600 /root/.fstabcredentials
And that's it!

Resources:
http://us3.samba.org/samba/

HowTo: Network traffic & bandwidth monitoring with darkstat on Gentoo

Following the footsteps on installing darkstat on my old 266 Mhz FreeBSD machine I've mirrored the install procedures on my 1.3 Ghz Pentium-M Gentoo Hardened server. This post will cover the installation and configuration of darkstat on a x86 machine running Gentoo Hardened stable.

Darstat captures network traffic, calculates statistics about usage, and serves reports over HTTP.

Darstat provides the following features:
  • Traffic graphs, reports per host, shows ports for each host.
  • Embedded web-server with deflate compression.
  • Asynchronous reverse DNS resolution using a child process.
  • Small. Portable. Single-threaded. Efficient. Uncomplicated.
Follow the bellow steps to update the portage tree and install darkstat:
  • $ su
  • # eix-sync
  • # emerge --ask --tree --verbose darkstat
To enable darkstat at boot time add it to the default runlevel by:
  • # rc-update add darkstat default
Now let's edit /etc/conf.d/darkstat to identify the network interface (in my case eth0) that we wish to monitor and enable logging:
  • # vim /etc/conf.d/darkstat
INTERFACE="eth0"
DAYLOGFILE="darkstat.log"
The next step is to start darkstat by running the following command:
  • # /etc/init.d/darkstat start
To check darkstat daemon status:
  • # /etc/init.d/darkstat status
By default darkstat serves graphs to http://localhost:667, so fire up your browser and point to the location. If you are planning (like me) on accessing to the graphs for another location add port 667 (you can choose another port number in /etc/conf.d/darkstat) to your router Port Forwarding settings.

Hope you enjoy darkstat. I find it extremely useful and refreshing.

Resources:
man darkstat
http://dmr.ath.cx/net/darkstat/
http://linux-bsd-sharing.blogspot.com/2008/10/howto-network-traffic-bandwidth.html

Tuesday, October 28, 2008

HowTo: Setup a Rsync server on Gentoo

I've been invited to write for TuxTraining and help it become a reference for open source users, so this and future posts will most likely be available at TuxTraining.

If you are looking for tutorials, tips and guides covering not only Linux but also BSD and Solaris visit the site. It's updated on a daily basis so I'm sure you'll find it to be very useful.

The goal of this tutorial is to detail the needed steps to setup a general purpose rsync server on Gentoo. Note: this guide doesn't focus on setting up your own Gentoo local rsync mirror, for that please consult Gentoo's official documentation on the matter, namely Gentoo Linux rsync Mirrors Policy and Guide.

rsync is an open source utility that provides fast incremental file transfer, available in multiple platforms such as Linux, *BSD and Solaris.

Let's begin by becoming the superuser, synchronize the portage tree and install rsync:
  • $ su
  • # eix-sync
  • # emerge --ask --tree --verbose net-misc/rsync
Having installed rsync let's add it to the default runlevel so that it automatically starts at boot time:
  • # rc-update add rsync default
Now we move into the rsync server configuration. The rsync server works with modules with are defined in the /etc/rsyncd.conf file. Let's set up a general purpose module:
  • # vim /etc/rsyncd.conf
motd file = /usr/local/etc/rsync.motd
log file = /var/log/rsyncd.log
pid file = /var/log/rsyncd.pid
lock file = /var/log/rsyncd.lock
transfer logging = true
use chroot = yes
[backup]
path = /home/username
read only = yes
list = yes
comment = Example of a rsync backup module
hosts allow = 192.168.1.0/24
It should be noted that a list of modules is returned from a rsync server when the server is queried:
  • $ rsync example.no-ip.org::
backup Example of a rsync backup module
To start the rsync server immediately:
  • $ su
  • # /etc/init.d/rsyncd start
An example of a client side synchronization:
  • $ rsync -av example.no-ip.org::backup/ /destination/
This would recursively transfer all files from the backup module directory on the example.no-ip.org machine into the /destination directory on the local machine. The files are transfered in "archive mode", which ensures that symbolic links, devices, attributes, permissions, ownership, etc are preserved in the transfer. Also, compression is used to reduce the size of data portions of the transfer.

Take a look at the utility's website for ideas on how to use rsync in useful ways.

Additional sources of information:
rsync website
man rsync
man rsyncd.conf

Tuesday, October 21, 2008

HowTo: IPFW firewall setup on FreeBSD

Today I'll lay down the steps needed to enable and configure FreeBSD' IPFW firewall.

The IPFIREWALL (IPFW) is a FreeBSD sponsored firewall software application authored and maintained by FreeBSD volunteer staff members. It uses the legacy stateless rules and a legacy rule coding technique to achieve what is referred to as Simple Stateful logic.

I'm running FreeBSD 7.0 and use freebsd-update to update the system side of FreeBSD so this guide assumes that your using a stock kernel. However if you're running a custom kernel that a look here (Section 31.6.1) before using the current guide.

Let's start by becoming the superuser and enable IPFW at boot time:
  • % su
  • # vi /etc/rc.conf
firewall_enable="YES"
firewall_script="/usr/local/etc/ipfw.rules"
firewall_logging="YES"
Now we define an IPFW rule set. Bellow you'll find a rule set shamefully stolen from here and adapted to my needs:
  • # vi /usr/local/etc/ipw.rules
IPF="ipfw -q add"
ipfw -q -f flush

#loopback
$IPF 10 allow all from any to any via lo0
$IPF 20 deny all from any to 127.0.0.0/8
$IPF 30 deny all from 127.0.0.0/8 to any
$IPF 40 deny tcp from any to any frag

# statefull
$IPF 50 check-state
$IPF 60 allow tcp from any to any established
$IPF 70 allow all from any to any out keep-state
$IPF 80 allow icmp from any to any

# open port ftp (21), ssh (22), mail (25)
# http (80), dns (53), mldonkey (4080, 21452, 6882),
# darstat (667)
$IPF 110 allow tcp from any to any 21 in
$IPF 120 allow tcp from any to any 21 out
$IPF 130 allow tcp from any to any 22 in
$IPF 140 allow tcp from any to any 22 out
$IPF 150 allow tcp from any to any 25 in
$IPF 160 allow tcp from any to any 25 out
$IPF 170 allow udp from any to any 53 in
$IPF 175 allow tcp from any to any 53 in
$IPF 180 allow udp from any to any 53 out
$IPF 185 allow tcp from any to any 53 out
$IPF 200 allow tcp from any to any 80 in
$IPF 210 allow tcp from any to any 80 out
$IPF 220 allow tcp from any to any 4080 in
$IPF 230 allow udp from any to any 4080 out
$IPF 240 allow tcp from any to any 21452 in
$IPF 245 allow udp from any to any 21452 in
$IPF 250 allow tcp from any to any 21452 out
$IPF 255 allow udp from any to any 21452 out
$IPF 260 allow tcp from any to any 6882 in
$IPF 270 allow tcp from any to any 6882 out
$IPF 280 allow tcp from any to any 667 in
$IPF 290 allow tcp from any to any 667 out
$IPF 300 allow tcp from any to any 1024-65000 keep-state

# deny and log everything
$IPF 500 deny log all from any to any
If you aren't planning to use FTP remove the $IPF 300 allow tcp from any to any 1024-65000 keep-state line. This line circumvents IPFW troubles with FTP connections.

To enable logging run the following commands:
  • # vim /etc/syslog.conf
!ipfw
*.* /var/log/ipfw/ipfw.log
  • # mkdir /var/log/ipfw
  • # touch /var/log/ipfw/ipfw.log
  • # killall -HUP syslogd
The firewall_logging variable sets the net.inet.ip.fw.verbose_limit=5 to the value of 1. To increase the verbose level to the value of 5:
  • # echo "net.inet.ip.fw.verbose_limit=5" >> /etc/sysctl.conf
  • # sysctl net.inet.ip.fw.enable=1
  • # sysctl net.inet.ip.fw.verbose=1
  • # sysctl net.inet.ip.fw.verbose_limit=5
To start IPFW and load the rules set:
  • # vim /etc/rc.d/ipfw start
  • # sh /usr/local/etc/ipfw.rules
The following command shows the rules list that is currently loaded:
  • # ipfw list
And we're done. In future I plan to try OpenBSD's PF firewall so stay tuned ;-)

Resources:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html
http://www.freebsd-howto.com/HOWTO/Ipfw-HOWTO
http://tuxtraining.com/2008/10/16/setting-up-firewall-using-ipfw-in-freebsd
http://www.cyberciti.biz/faq/howto-setup-freebsd-ipfw-firewall/

Monday, October 20, 2008

HowTo: Network traffic & bandwidth monitoring with darkstat on FreeBSD

My old Celeron 266 Mhz runs a couple of network related services, namely MLDonkey and FTP.

With the goal of monitoring network and bandwidth traffic I used vnStat. vnStat is small and efficent console based application however I wanted something that could serve the statistic over HTTP and this is where darkstat fills the bill.

Darstat captures network traffic, calculates statistics about usage, and serves reports over HTTP.

Darstat provides the following features:
  • Traffic graphs, reports per host, shows ports for each host.
  • Embedded web-server with deflate compression.
  • Asynchronous reverse DNS resolution using a child process.
  • Small. Portable. Single-threaded. Efficient. Uncomplicated.
Follow the bellow steps to install darkstat on FreeBSD 7.0:
  • % su
  • # cd /usr/ports/net-mgmt/darkstat
  • # make install clean
  • # rehash
To enable darkstat at boot time add the following lines to /etc/rc.conf:
darkstat_enable="YES"
darkstat_interface="rl0"
Change the darkstat_interface to reflect your network interface (mine is rl0).

Bellow you'll find a set of optional configurations flags that can be added to /etc/rc.conf:
darkstat_dir="/var/run/darkstat"
darkstat_pidname="darkstat.pid"
darkstat_dropuser="nobody"
darkstat_flags=""
Now that we have darkstat installed and configured let's start it:
  • # /usr/local/etc/rc.d/darkstat start
To check darkstat daemon status:
  • # /usr/local/etc/rc.d/darkstat status
By default darkstat serves graphs to http://localhost:667, so fire up your browser and point to the location. If you are planning (like me) on accessing to the graphs for another location add port 667 to your router Port Forwarding settings.

Hope you enjoy darkstat. I find it extremely useful and refreshing.

Resources:
http://dmr.ath.cx/net/darkstat/
man darkstat

HowTo: Setup a Pure-FTPd server with virtual users on FreeBSD

Having setup a FTP server using FreeBSD's own FTPd I decided to explore other FTP server options, namely Pure-FTPd.

Pure-FTPd is a free (BSD), secure, production-quality and standard-conformant FTP server.

This guide provides instructions for using the virtual user system to manage and control users. By using virtual users, FTP accounts can be administrated without affecting system accounts.

Let'
s initiate Pure-FTPd's installation by entering the following commands:
  • % su
  • # cd /usr/ports/ftp/pure-ftpd
  • # make config
A menu containing Pure-FTPd options will pop-up. In my case, I've opted to leave these options at their defaults.
  • # make install clean
  • # rehash
Having finished the installation process we now move into the configuration stage. We'll start by copying the sample configuration file and set the configuration options:
  • # cd /usr/local/etc
  • # cp pure-ftpd.conf.sample pure-ftpd.conf
  • # chmod 644 pure-ftpd.conf
The chmod command was run to be able to edit the file (default permissions are set to -r--r--r--).
  • # vi pure-ftpd.conf
VerboseLog yes
PureDB /usr/local/etc/pureftpd.pdb
CreateHomeDir yes
The CreateHomeDir option makes adding virtual users more easy by creating a user's home directory upon login (if it doesn't already exist).

We can either import users with system-level accounts (defined in /etc/master.passwd) at once or create new users manually. To import users that already exist on your system into the virtual user database, enter these commands:

  • # pure-pwconvert >> /usr/local/etc/pureftpd.passwd
  • # chmod 600 /usr/local/etc/pureftpd.passwd
  • # pure-pw mkdb
It should be noted that pure-pwconvert only imports accounts that have shell access. Accounts with the shell set to nologin have to be added manually.

To add users to the Pure-FTPd virtual user database manually, we need to create a system-level account that will be associated with virtual users. Create a new user named vftp like this:
  • # pw useradd vftp -s /sbin/nologin -w no -d /usr/home/vftp\
  • ? -c "Virtual FTP user" -m
Having done this we can now add users to the virtual users database using the commands below:
  • # pure-pw useradd user -u vftp -g vftp -d /usr/home/vftp/user
  • # pure-pw mkdb
Replace user with the desired username. With -d flag, the user will be chrooted. If you want to give user access to the whole filesystem, use -D instead of -d.

If you want to add additional users, just repeat the commands above with a different user.

To remove a user:
  • # pure-pw userdel user

Now to start Pure-FTPd:

  • # /usr/local/etc/rc.d/pure-ftpd onestart

Initiate a FTP connection to test the server:

  • % ftp localhost

Trying 127.0.0.1...
Connected to localhost.
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 2 of 50 allowed.
220-Local time is now 13:39. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (localhost:username):
Now log in with a user account created as explained above. Commands such as ls, cp, pwd and less work just like in tcsh and bash shells. To quit the FTP session type exit.

To configure Pure-FTPd to start at boot time:

  • # echo 'pureftpd_enable="YES"' >> /etc/rc.conf
To restart Pure-FTPd and determine if it is running:
  • # /usr/local/etc/rc.d/pure-ftpd restart
  • # /usr/local/etc/rc.d/pure-ftpd status

Pure-FTPd provides useful features for personal users as well as hosting providers. I've only touched the tip of the iceberg so do take a look at the project's website for the excellent documentation that is available.

That's it for now. On a future post I'll explain how to setup Pure-FTPd for anonymous FTP access.

Resources:
http://www.pureftpd.org/project/pure-ftpd/doc

Friday, October 17, 2008

HowTo: Install and setup MLDonkey on Gentoo

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.

To cater to my brother's P2P needs I decided to install MLDonkey without X11 support leaving only the core with both telnet and web interfaces. The target computer was my 1.3GHz Pentium-M laptop headless server (faulty display) running Gentoo Hardened located at my parents house.

Bellow are the steps needed to install MLDonkey on Gentoo with Bittorrent, eDonkey and Overnet support:
  1. $ su
  2. # eix-sync
  3. # echo "net-p2p/mldonkey ocamlopt -doc -fasttrack -gd -gnutella -gtk -guionly -magic" >> /etc/portage/package.use
  4. # emerge -tav mldonkey
Now that MLDonkey is installed let's activate it at boot time and start the service:
  1. # rc-update add mldonkey default
  2. # /etc/init.d/mldonkey start

Now we are going to modify the MLDonkey configuration:

  1. # /etc/init.d/mldonkey status
  2. # exit
  3. $ telnet 127.0.0.1 4000
  4. > auth admin ""
  5. > passwd newpassword
  6. > set allowed_ips "127.0.0.1 192.168.1.0/24"
  7. > save
  8. > 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 5 takes care of that. On step 6 we set the ips that are allowed to connect to the application, in the example the localhost and all clients in the local network.

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. # /etc/init.d/mldonkey start
  2. # /etc/init.d/mldonkey stop
  3. # /etc/init.d/mldonkey restart
  4. # /etc/init.d/mldonkey status
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/.

Tuesday, October 14, 2008

Tip: Konqueror with Flash support (YouTube) on Gentoo

Following the footsteps of my previous post on how to install and setup KDE 3.5.x on Gentoo I'll explain bellow how to get Flash support for Konqueror and with it YouTube heaven.
  1. $ su
  2. # emerge --ask --tree nsplugins netscape-flash
  3. open Konqueror and point to Settings -> Configure Konqueror -> Plugins -> Scan for New Plugins.
We started becoming superuser, on step 2 the plugins packages were installed and on the final step we told Konqueror to re-scan all plugin directories.

It's done ;-)

HowTo: Install and setup KDE 3.5.x on Gentoo

KDE is a powerful Open Source graphical desktop environment for Unix and Unix-like workstations. It combines ease of use and unparalel functionality.

Having married I can't "afford" running cool window managers such as dwm and Xmonad, so I began moving into desktop environments such as Gnome and KDE. KDE was there on my first contact with Linux and truth be said I prefer it over Gnome.

Bellow you'll find the steps I took to install and setup KDE 3.5.9 on Gentoo. Why 3.5.9? Because in my opinion KDE 4 is lacking taking into account the mature 3.5.x versions.

Let's begin by becoming the superuser:
  • $ su
Edit your /etc/make.conf file and make sure that the qt3, kde, hal, dbus and arts flags are enabled. If you access Samba shares consider adding the samba flag also.
  • # vim /etc/make.conf
Now we update the portage tree:
  • # eix-sync
List and select a desktop profile:
  • # eselect profile list
    [1] default-linux/x86/2006.1
    [2] default-linux/x86/2006.1/desktop
    [3] default-linux/x86/2007.0
    [4] default-linux/x86/2007.0/desktop
    [5] hardened/x86/2.6
    [6] selinux/2007.0/x86
    [7] selinux/2007.0/x86/hardened
    [8] default/linux/x86/2008.0
    [9] default/linux/x86/2008.0/desktop *
    [10] default/linux/x86/2008.0/developer
    [11] default/linux/x86/2008.0/server
    [12] hardened/linux/x86
  • # eselect profile set 9
Now let's update our system along with all package dependencies, removing unneeded dependencies in the process:
  • # emerge --ask --verbose --tree --update --newuse --deep world && emerge --depclean && revdep-rebuild
The fun stuff begins: the installation of kdebase-startkde. I choose this over kde-meta because I really don't need the full KDE environment. This takes around 2 hours on my desktop, a 2.2Ghz Athon XP-M.
  • # emerge --ask kdebase-startkde
Having installed the base environment I proceeded by installing the individual KDE applications that I like:
  • # emerge --ask --tree konsole kdm kpdf ktorrent ksnapshot amarok k3b kaffeine kmix kate kopete kcalc kolourpaint ark media-gfx/gwenview kget knetattach kchmviewer yakuake
From the previous package list special attention should be given to knetattach as this package allows Konqueror access to Samba shares.

Also, if you are planning on customizing KDE's look consider installing the following packages:
  • # emerge --ask --tree kdmtheme nuvox polymer qtcurve gtk-engines-qt gtk-engines-qtcurve x11-themes/crystal
After emerging the KDM graphical login manager let's activate it by editing the /etc/conf.d/xdm file and add it to the boot scripts:
  • # vim /etc/conf.d/xdm
DISPLAYMANAGER="kdm"
  • # rc-update add xdm default

To have KDE automatically mount CDROMs and USB sticks, we need to add hal and dbus to the default runlevel and add yourself to the plugdev group.

  • # rc-update add dbus default
  • # rc-update add hald default
  • # gpasswd -a plugdev
As I also want to access Samba shares I've also added samba to the default runlevel:
  • # rc-update add samba default
And that's it. Reboot your system and gaze upon the wonderful desktop environment that KDE is.

Resources:
http://www.gentoo.org/proj/en/desktop/kde/kde-config.xml
http://www.kde.org/

Monday, October 13, 2008

Tip: Getting Flash working on Debian

I've been running Debian Testing (Lenny) for a while with Gnome and Iceweasel however only recently I've been using it regularly.

So I reached a point where I wanted to check a TV schedule and the TV station's website needed Flash. Latter on I've also found that YouTube required a Flash

To fix this and get myself Iceweasel working with Flash websites:
$ su
# apt-get install flashplayer-mozilla

Just fire up Firefox and happy YouTube browsing ;-)

Friday, October 10, 2008

HowTo: Setup an Anonymous FTP server on FreeBSD

To test the speed differences between SFTP and FTP I decided to setup an anonymous FTP server on my trusted old 266 Mhz Celeron running FreeBSD 7.0.

The File Transfer Protocol (FTP) provides a simple and classic method for transferring files from one computer to another across the internet.

FreeBSD base install includes FTP server software, namely ftpd.

I'm fully aware of the security implications regarding FTP's transmission of usernames and passwords in clear text hence the choice of an anonymous FTP server in real-only mode.

Let's start by creating a ftp user:
  • % su
  • # adduser
Username: ftp
Full name: Anonymous FTP user
Uid (Leave empty for default):
Login group [ftp]:
Login group is ftp. Invite ftp into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash zsh nologin) [sh]: nologin
Home directory [/home/ftp]: /var/ftp
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: no
Username : ftp
Password :
Full Name : Anonymous FTP user
Uid : 1004
Class :
Groups : ftp
Home : /var/ftp
Shell : /usr/sbin/nologin
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (ftp) to the user database.
Add another user? (yes/no): no
Goodbye!
Anonymous FTP restricts access to the home directory of the user ftp. So let's create an additional directory:
  • # mkdir -p /var/ftp/pub
  • # chown ftp:ftp /var/ftp/pub
From the point of view of the user /var/ftp is the root directory, and he cannot access any files outside of the ftp directory.

To display a welcome notice before users login edit the /etc/ftpwelcome file:
  • # vi /etc/ftpwelcome
After a successful login the contents of the /etc/ftpmod file are displayed to the user.
  • # vi /etc/ftpmod
Next let's proceed by enabling the ftpd server in /etc/inetd.conf:
  • # echo "ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l -S -A -r" >> /etc/inetd.conf
In which:
-l default flag
-r read-only mode
-o write-only mode
-A anonymous FTP connections only
-S logging of all anonymous FTP activity
The -S flag allows logging to /var/log/ftpd, however the file needs to exist before ftpd can use it:
  • # touch /var/log/ftpd
To start ftpd at boot time:
  • # echo 'inetd_enable="YES"' >> /etc/rc.conf
Having finished the configurations steps we can start ftpd immediately by:
  • # /ect/rc.d/inetd start
You can now log on to your FTP server by typing:
  • # exit
  • % ftp localhost
In which the username can be either ftp or anonymous and the password can be anything. Commands such as ls, cp, pwd and less work just like in tcsh and bash shells. To quit the FTP session type exit.

And we're done ;)

Additional information:
FreeBSD Handbook
man ftpchroot
man ftpd
man chroot
man inetd

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.

Friday, August 29, 2008

HowTo: Widescreen resolutions on Enemy Territory

One of the most often technical questions posed on ET servers are "How do I get ET to use a widescreen resolution?" "I have an new monitor but ET sucks on it. How do I fix it?".

ET, Quake 3, SOF2, RTCW, RTCW-demo and Tremulous use the same game engine, more precisely Quake 3's engine. So the bellow instructions also apply to those games.

Assuming you using a 19" monitor with a native resolution of 1440x900, add the following cvars to your autoexec.cfg:
set r_mode "-1"
set r_customwidth "1440"
set r_customheight "900"
If your want a different resolution change the r_customheight and r_customwidht accordingly, e.g. on a 22" monitor with a native resolution of 1680x1050 you'd get r_customwidth "1680" and r_customheight "1050".

In alternative type the above commands in ET's console. Pull the console by pressing \ on an European keyboard or press ~ if you are using an US keyboard (or run the game under Linux or BSD).

When typing on the console make sure that there is a \ before typing or else when you hit enter it will come out as global chat instead of a command. Also when using the console there is no need for set or the ". A simple vid_restart command will get you up and running with the new resolution.

In a future post I'll explain the purpose of autoexec.cfg which is one of the cornerstones of setting up a proper config and scripting.

Happy frags. :D

Monday, August 25, 2008

Tip: Getting flash (YouTube) to work on OpenSUSE 11.0 KDE 3.5.9

During my vacations I decided to install OpenSUSE's KDE (3.5.9) flavor on my desktop.

My laptop is running OpenSUSE (Gnome flavor) since 11.0 came out and I must that it impressed me. So having liked the Gnome environment I decided to install KDE 3.5.9 starting from the net install disk.

Surprisingly when I fired up Firefox and pointed to YouTube I came across a warming telling me that I didn't have the flash plugin installed.

Here's how to fix the issue:

First make sure that you have the Non-OSS repository enabled.
  • $ su
  • # zypper lr
If the list doesn't contain the Non-OSS repository add it by:
  • # zypper ar http://download.opensuse.org/distribution/11.0/repo/non-oss/ non-oss
To install the flashplayer package:
  • # zypper in flashplayer-player
Now fire up Firefox and happy YouTube browsing.

Saturday, August 16, 2008

HowTo: Codecs and DVD support for Debian Lenny

In this time and age we can't "survive" without multimedia support in our personal computers. To help those struggling to get codecs and DVD support under Debian Lenny I've compiled a series of steps to follow.

Let's start be becoming superuser:
  • $ su
Next we add the needed repositories to sources.list:
  • # echo "deb http://debian-multimedia.org/ lenny main" >> /etc/apt/sources.list
  • # echo "deb-src http://debian-multimedia.org/ lenny main" >> /etc/apt/sources.list
  • # apt-get update
Now let's get the gpg key for the repository:
  • # wget http://debian-multimedia.org/gpgkey.pub -O - | apt-key add - && apt-get install debian-multimedia-keyring
If the above step fails, do the following as alternative:
  • # exit
  • $ cd ~
  • $ wget -c http://www.debian-multimedia.org/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2007.02.14_all.deb
  • $ su
  • # dpkg -i debian-multimedia-keyring_2007.02.14_all.deb
After getting the key we move onto updating the database:
  • # apt-get update
Install the codecs and DVD support packages:
  • # apt-get install w32codecs libdvdcss2
If you plan on watching YouTube movies on Firefox I'd suggest:
  • # apt-get install flashplayer-mozilla
Finally we need a movie player. Here you have several options raging from Mplayer (my favorite) to VLC. Choose one and install it or try them all ;):
  • # apt-get install mplayer
  • # apt-get gnome-mplayer
  • # apt-get install smplayer
  • # apt-get install vlc
  • # apt-get install kaffeine
And we're done.

Resources:
http://debian-multimedia.org/faq.php
http://vivapinkfloyd.blogspot.com/2008/07/how-to-install-codecs-and-dvd-support.html

HowTo: Creative Audigy 4 under FreeBSD

The snd_emu10kx driver provides support for Creative SoundBlaster Live! and Audigy sound cards, namely for Audigy 4.

Assuming that you are running FreeBSD 7's generic kernel it's simply a matter of loading the driver as a module at boot time.

To do so :
  • % su
  • # echo 'snd_emu10kx_load="YES"' >> /boot/loader.conf
If you are planning on compiling your own custom kernel, place the following lines in your kernel configuration file:
device sound
device snd_emu10kx
Just to be sure if the sound driver was correctly loaded run:
  • % cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2007061600/i386)
Installed devices:
pcm0: on emu10kx0 [MPSAFE] (4p:1v/1r:1v channels duplex default)
pcm1: on emu10kx0 [MPSAFE] (1p:1v/0r:0v channels)
pcm2: on emu10kx0 [MPSAFE] (1p:1v/0r:0v channels)
pcm3: on emu10kx0 [MPSAFE] (1p:1v/0r:0v channels)
pcm4: on emu10kx0 [MPSAFE] (1p:1v/0r:0v channels)
To setup sound output levels for various audio sources and frequency ranges you can use the FreeBSD mixer. To display the current mixer values do the following:
  • % mixer
Mixer vol is currently set to 75:75
Mixer pcm is currently set to 75:75
Mixer speaker is currently set to 75:75
Mixer line is currently set to 75:75
Mixer mic is currently set to 0:0
Mixer cd is currently set to 75:75
Mixer rec is currently set to 0:0
Mixer igain is currently set to 0:0
Mixer ogain is currently set to 50:50
Mixer line1 is currently set to 75:75
Mixer line2 is currently set to 0:0
Mixer line3 is currently set to 0:0
Mixer dig1 is currently set to 0:0
Mixer dig2 is currently set to 0:0
Mixer dig3 is currently set to 0:0
Mixer phin is currently set to 0:0
Mixer phout is currently set to 0:0
Mixer video is currently set to 75:75
Recording source: mic
To change mixer values you can type mixer followed by the name of the device and the desired level. If you wanted to change the CD output volume to 95 percent on left channel and 85 on the right channel:
  • # mixer cd 95:85
And were all done.

If you want additional information on the driver take a look at snd_emu10kx and mixer's man pages.

HowTo: Logitech MX518 under FreeBSD

I have both a Logitech MX500 and a MX518. Being an Enemy Territory old timer I need to make full use of the MX518 mouse under FreeBSD, which means having the Back, Forward and the other weird button below the wheel working.

The bellow xorg.conf settings were tested under FreeBSD 7.0 and X.Org X Server 1.4.2.
  • % su
  • # vim /etc/X11/xorg.conf
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "Buttons" "10"
Option "ZAxisMapping" "4 5"
Option "ButtonMapping" "1 2 3 6 7 8 9 10 4 5"
Option "Emulate3Buttons" "false"
EndSection
With these settings you're free to bind MOUSE4, MOUSE5 and KP_EQUALS to Enemy Territory.

The sensitivity buttons work as their intended purpose: change the sensitivity on-the-fly. It was possible under Windows XP to change their behavior and bind them to keyboard keys however I'm not aware of how to do this under a *NIX system.

As a bonus, you can now use the Back and Forward buttons under Opera.

HowTo: Musicpd (Music Player Daemon) on FreeBSD

MPD stands for Music Player Daemon. It is made to control music through a very unique way. MPD has support for MP3, Ogg, FLAC, AAC, Mod, and wav files.

Let's proceed with the steps needed to install musicpd from ports:
  • % su
  • # cd /usr/ports/audio/musicpd ; make install clean
  • if you want select additional audio formats such as AAC and MOD files
Now let's move onto the configuration by copying the port's supplied example and editing from there:
  • # cp /usr/local/share/doc/mpd/mpdconf.example /usr/local/etc/mpd.conf
  • # chmod 644 /usr/local/etc/mpd.conf
  • # vi /usr/local/etc/mpd.conf
music_directory "/mnt/music"
playlist_directory "~/playlists"
db_file "~/database"
log_file "~/log"
error_file "~/error"
pid_file "~/pid"
state_file "~/state"
user "musicpd"

port "6600"
bind_to_address "127.0.0.1"

audio_output {
type "oss"
name "OSS"
}
To prevent MPD running as root we can setup a new user (musicpd):
  • # adduser
Username: musicpd
Full name: Music Player Daemon
Uid (Leave empty for default):
Login group [musicpd]:
Login group is musicpd. Invite mpd into other groups? []:
Login class [default]: daemon
Shell (sh csh tcsh bash rbash nologin) [sh]: nologin
Home directory [/home/musicpd]:
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: yes
Username : musicpd
Password :
Full Name : Music Player Daemon
Uid : 1002
Class : daemon
Groups : musicpd
Home : /home/musicpd
Shell : /usr/sbin/nologin
Locked : yes
OK? (yes/no): yes
Add another user? (yes/no): no
Goodbye!
  • # mkdir -p /home/musicpd/playlists
  • # chown muiscpd:musicpd /home/musicpd/playlists
To start MPD at boot time:
  • # echo 'musicpd_enable="YES"' >> /etc/rc.conf
Finally we start MPD and create the database:
  • # /usr/local/bin/mpd --create-db /usr/local/etc/mpd.conf
Now that we have the daemon up and running we need to put it to good use. I use the NCMPC client for the job.

To install NCMPC from ports:
  • # cd /usr/ports/audio/ncmpc ; make install clean

Wednesday, August 6, 2008

Book Review: SUSE Linux Toolbox

I like reading and I like Linux/BSD/Unix. So when I hop to the bookstore I have a tendency to check out any book related to Unix-like operating systems.

In the past Monday I came across SUSE Linux Toolbox on the Linux section. As the Linux section is always very small it caught my attention and decided to flip a couple of pages.

As I picked up the book I thought "A book for dummies, full of stupid GUI screenshot with no depth I bet". Well I couldn't be more wrong!

As flipped through I was amazed: the book was entirely focused on the CLI on a very straight to the point fashion. It was love at first sight and I ended up spending about 15 minutes in the bookstore reading a couple sections/topics.

My girlfriend was also checking out a book and as we were leaving she gazed upon my sad face as I took the book back to the shelf and suggested that I should buy it. I just thought "It's a book about SUSE and that's not exactly my favorite distro" so decided to place it back in the shelf. As I got there the bookstore guy had just finished re-arranging the shelf and there wasn't any room where the book originally was. It was destiny: I just had to buy the book!

So I did. For the past days I've gone through 4 of its 14 chapters and read several sections/topics of a couple more chapters and so far haven't come across a single incongruence.

It really is a great book and a wonderful purchase.

I've been running Linux for about one and a half years and gone through distros such as Debian, Gentoo, OpenSUSE, Ubuntu, PCLinuxOS and on the BSD side FreeBSD. I know my way around, I'm no guru but nor am I a newbie, and SUSE Linux Toolbox fits like a glove to anyone who enjoy tinkering with their system and learning.

The book contains tons of information that aren't distro specific while identifying SUSE only things such as the zypper's use on chapters 1 and 2.

Chapter 3 is all about the shell and how to use it. Chapters 4 and 5 expand on subjects like working with files and manipulating text.

From chapter 7 onwards it focuses on my main area of interest which is administration and does a damn good job at it in my humble opinion.

To sum up, great buy for anyone into Linux, CLI and widely applicable to any other distro. I for one am glad of the purchase.

On a final note there are 2 other books on the series: Ubuntu Linux Toolbox and Fedora Linux Toolbox.

Monday, July 28, 2008

HowTo: Add a new disk to FreeBSD

I needed to add a 120GB IDE drive to my FreeBSD 7.0 install on the old Celeron 266.

Here are the steps:
  1. become superuser
  2. # mkdir /mnt/data
  3. # sysinstall
  4. Choose Configure -> Fdisk
  5. If there are existing partitions press D to delete them
  6. To create a slice press C. To use the entire disk press A
  7. To commit changes press W. A warning pops up, choose YES.
  8. When asked to install a boot manager choose STANDARD
  9. Leave Fdisk by pressing Q
  10. Choose Configure -> Label
  11. Create a new partition by press C. Choose FS.
  12. Type in the mountpoint, e.g. /mnt/data. Take note of the drive device node, e.g. /dev/ad4s1d
  13. Commit changes by pressing W
  14. Exist the sysinstall.
  15. # vi /etc/fstab accordingly, e.g. /dev/sda4s1d /mnt/data ufs rw 2 2 in my case
I essentially used my 120GB drive to be entirely by FreeBSD and mounted under /mnt/data.

Take a look on section 18.3 "Adding disks" of the official FreeBSD Handbook for finner details.

Saturday, July 12, 2008

Tip: Fix GCC upgrade problems on Gentoo

Here's a typical problem on gcc upgrades:
configure:error: installation or configuration problem: C complier cannot create executables.
To solve the problem perform the following:
  1. become superuser
  2. gcc-config -l
  3. gcc-config 1
  4. source /etc/profile
Step 2 lists the available gcc versions. On step 3 select one from the list by number or typing the full name (in my case I only had one available).

Problem fixed. Happy emerging ;)

HowTo: Changing default mouse cursor in Debian

Having just finished installing XFCE4 on Debian Lenny I've came across with X11's default cursor: an ugly jagged black cursor.

Here's the procedure on installing my favourite mouse cursor theme (DMZ-white) and how to change the cursor in Debian with update-alternatives:
  1. become superuser
  2. apt-get install dmz-cursor-theme
  3. update-alternatives --config x-cursor-theme
  4. enter selection number for DMZ-White
Under XFCE4, browse to Settings -> Mouse Preferences -> Cursor and select DMZ-White.

Logout from XFCE4 to commit the changes, Quit -> Logout.

That's it.