Command Line


SUSE Linux Enterprise is designed for the enterprise. Part of what it means to be “Enterprise-ready” is to have “rock solid” components in the distribution which have been fully tested and can be supported. Unstable and unsupportable components/packages just won’t do. BUT… Every now and then, it’s necessary to run “the latest” version of a component of the distribution. Perhaps you have a new application which requires the latest java, or a new development library, etc. So you don’t want to have to wait until that “latest version” of the package gets fully tested and “officially supported”. You’ve got to have that new version now!

You could go to the source and compile your own package for SUSE Linux Enterprise – and while not difficult, it is still kind of a pain – and certainly a turn-off for many a new Linux user. A much better option is to simply visit the openSUSE Build Service and see if your desired package is already being built for SUSE Linux Enterprise. You’ll find builds for SUSE Linux Enterprise, openSUSE, -plus- several other Linux distributions as well… Fedora, Debian, Ubuntu, … So save some time, and check to see if the package you need has already been built by looking here.

Want more info on the openSUSE Build Service, check out this good overview article and this blog entry. and of course the project site which includes other great info.

From the article:

When it comes to file systems, Linux® is the Swiss Army knife of operating systems. Linux supports a large number of file systems, from journaling to clustering to cryptographic. Linux is a wonderful platform for using standard and more exotic file systems and also for developing file systems. This article explores the virtual file system (VFS)—sometimes called the virtual filesystem switch—in the Linux kernel and then reviews some of the major structures that tie file systems together.

More here.

While Intel and Atheros are doing a great job writing wireless drivers for linux, there are still other wireless cards, specifically Broadcom, who do not have linux drivers or who do not have good linux drivers.

The purpose of this article is to explain how to configure ndiswrapper in SUSE Linux Enterprise Desktop 10 SP1. On my end I am using an old dell c640 (with the embedded wireless card turned off in BIOS) and a Linksys wusb54gc usb wireless device.

1: Go into Yast and install ndiswrapper and the appropriate ndiswrapper kernel module.
– hit alt+f2 enter yast2.
– open the software management module.
– search for ndiswrapper
– determine which version of the kernel you are running(bigsmp, default, smp) by opening a terminal and entering uname -r
– check off the “ndiswrapper” package as well as “ndiswrapper-kmp-<kernel version>” in yast and click accept to install.

2. Setup ndiswrapper
-Determine which chipset your wireless device is using. To do this enter:
hwinfo
or
lspci
or
lsusb
You can grep the results for wireless ex. hwinfo | grep -i wireless or just manually scroll through the output and search for something that looks like your wireless device.

In the case of my Linksys device it uses a Ralink chipset. I found the windows driver (rt73.inf) on the cd that came with the device. Find the .inf file for your card on your manufacturer’s website and download it. (Often times you will have to unzip the .exe driver installer to find the .inf).

-enter the following commands:
ndiswrapper -i /path/to/driver.inf #to install the driver
modprobe ndiswrapper #to load the module
ndiswrapper -m #To ensure that ndiswrapper will always use the same network interface name

3. Configure the wireless device in yast
– You should already have yast open from when you installed the ndiswrapper packages
– This time go into the “network card” module
– Verify that “NetworkManager” is selected and click next
– Click “Add”
– For Device Type choose “wireless”
– Configuration Name “0”
– Moduel Name “ndiswrapper”
– Click next then finish etc. to finish.

I have based this article off of the documentation that can be found in /usr/share/doc/packages/ndiswrapper/README.SUSE after installing ndiswraper

Why Worry About It?

Backups are essential, and so is the reducing the time needed to perform those backups. Many’s the time I have sat waiting for a backup to complete only to remember that I had a link to a large set of files, or a bunch of ISO files in the ./download directory, and had to migrate those over to somewhere else and restart the backup.

If you are like me, data = “files that contain data of original or irreplaceable content”. I don’t want to backup ISO files, large sets of files that can be gotten from an install DVD or things that are easy to download from a site somewhere.

I use a simple (yeah, it really is), script before every backup to find all the files over a particular size, which I then can so anything I want with. If I find anything that’s too large and expendable, I either use an -exclude statement (usually in the case of all ISO’s) or even move the files elsewhere quickly by re-running the script and tacking on a -exec statement.

The Script

Here is the script I use, it’s from a bunch of different sources, and uses a couple of useful tools to do it’s work:

#!/bin/bash

echo "Enter the fully-qualified start path"
read start_path
echo "Enter the lower size limit in Megabytes"
read lower_size
find $start_path \( -size +"$lower_size"M -fprintf ~/Desktop/bigfiles.txt '%kk %p\n' \)

Fables of the Deconstruction

#!/bin/bash

The first line is where you declare what shell you want to run this script with. This string is known as the “shebang”, not absolutely necessary since it defaults to the bash shell anyway, but it’s certainly good form.

echo "Enter the fully-qualified start path"
read start_path

Lines 3 and 4 work together, prompting you to enter the fully-qualified start path and then storing what you enter in the newly-created variable named start_path. This is expanded in Line 7 by referring to it’s name $start_path.

echo "Enter the lower size limit in Megabytes"
read lower_size

The same arrangement occurs with lines 5 and 6, you’re prompted to enter the smallest size in Megabytes you want to report on, which stores that in the newly-created variable named lower_size. This too is expanded in Line 7 with the name $lower_size.

All Together Now

Line 7 is where all the fun stuff happens. First you are using the find command, not the easiest thing for newcomers, but well worth, ahem, “finding” out more about. Find requires several things, shown below:

find (path) (-option) (expression)

We’re using the start_path variable as the (path), then we include a function (sort of a macro) that looks for files of a size that is at least the value of the lower_size variable we set and populated earlier. Then when it finds each file over that size, it will print out the file size in 1K blocks, followed by the LETTER k, so it’s obvious, and then the full path and name of the file that has been found. This will all then be output to a file named bigfiles.txt in the current user’s Desktop folder.

Note: The use of the tilde (technical name: squiggle 8-> ) character in a command means to expand the current user’s $HOME variable from the executing shell, so the full path of the bigfiles.txt file if rossb is running the script is:

/home/rossb/Desktop/bigfiles.txt

Running the Script

Executing scripts that aren’t in your path (the variable, not the physical directory) is different on Linux/Unix, either you’ll use this script as a parameter to the bash shell:

# /bin/bash findbigfiles.sh

Or you’ll use the following command to set the script to be executable:

# chmod +x findbigfiles.sh

Then when it’s set to executable, you’ll either need to put it in your path, (try /usr/local/bin) or execute it by preceding it with the characters “./”, which is necessary to execute something in the local directory if it’s not in the path:

# ./findbigfiles.sh

Summary

There are so many other things you can do with find, such as tack on a -exec statement and execute a command on each and every file found, or find and act on files that meet a particular permission set, the possibilities are nearly endless.

Of particular help in my work over the years with the find command has been the find man page, with it’s useful examples and Chapter 14 “Finding Files with Find” of the Unix Power Tools 2nd Edition from O’Reilly and Associates. (I know the 2nd Edition is out of print, but I don’t care much for the 3rd Edition’s updates).

Let us know in the comments what cool find scripts you have come up with, the randomly drawn winner will get a very cool Novell-Candy-Apple-Red 9 LED flashlight. (Sorry, Continental U.S. only).

Enjoy,

RossB

In my palatial estate in scenic Waltham, Massachusetts, aka my apartment, I have several computers. My two favorite computers to use are my Lenovo X60 (running SUSE Linux Enterprise Desktop 10 SP1) and my Apple Macbook Pro running OS X (10.4.10). I also have a whitebox machine from Intel that I use as my server running SLES 10 SP1.

The thought came across my mind the other day that I would like a central way to store and access my music. This way I can save room on my laptop hard drive for “business” items and utilize the larger disk on my server to store higher bit rate songs. (true audiophiles will really appreciate this)

To achieve this I scp’d all of my music files from my my Mac over to my SLES server using OS X’s terminal application located in /Applications/Utilities/terminal. In this example the ip address of my server is 192.168.2.5.

scp -r /Users/username/music 192.168.2.5:/music
The ‘-r’ stands for recursive and allows me to copy over a directory.

Next I setup a NFS server on my SLES machine. NFS is a network file system protocol that allows a user on a client computer to access files over a network as easily as if the network devices were attached to its local disks. This is perfect for our purposes.

To setup a NFS server:

  • Open up YaST: Alt+f2, enter yast2
  • Filter for “nfs server”
  • Check off “Start” under the NFS server section
  • Check off “open port in firewall” if you have a local firewall enabled
  • Hit next
  • Go to “Add directory”
  • Enter the path to your music folder.

Next you need to mount the NFS volume on your local machine

  • On Linux enter (in a terminal as root): mount 192.168.5:/Music /music
  • On OS X enter (in a terminal): sudo /sbin/mount_nfs -P linux:/install /music
  • I had to use the ‘-P’ option to get around an error that said something to the effect of “mount_nfs: Operation not permitted”

At this point you need to configure your desired music players to point to the appropriate directories.

On SLED 10 if you are using Banshee:

  • Open up Banshee
  • Go to Edit>Preferences
  • Make sure that “copy files to music folder when importing” is unchecked
  • Go to Music>Import Music
  • Choose Local folder and navigate to where you mounted the NFS share. (in this example in /music)

On OS X, if you are using iTunes:

  • Open up iTunes
  • Go to iTunes>Preferences
  • Go to the “Advanced” tab.
  • Make sure that the “Copy files to iTunes Music folder when adding to library” option is unchecked
  • Go to File>Import and browse to the location of your NFS mount (in this example /music).

In this example I do not set the machines to automatically mount the NFS share. Each time you reboot you will have to remount the NFS volume, but you shouldn’t have to re-import the music.

When you register SUSE Linux Enterprise Desktop or SUSE Linux Enterprise Server you automatically set nu.novell.com as an update source. Many enterprise customers prefer to setup their own local update servers which mirror nu.novell.com. The utility available to do this is called YUP, Yum Update Proxy.

YUP is not included in SUSE Linux Enterprise and can be downloaded from here (you must use the newest version of YUP if you want to mirror SP1 updates):

http://software.opensuse.org/download/home:/mge1512/SLE_10/noarch/

After installation, the configuration file resides in /etc/sysconfig/yup. You can either edit this file by hand or use the /etc/sysconfig YaST module.

Let’s take a look at some of the important parameters.

  • YUP_DEST_DIR=”/path/to/directory”
    • Specify the directory on your server where you want to save the updates.
    • Make sure you have a fair amount of disk space.
    • Yup will automatically setup the directory structure underneath this for all the different architectures and products you’re mirroring.
    • Configure your server to share these directories to clients. I use the “installation server” module to setup an http share.
  • YUP_ID=”blablabla1234″ and YUP_PASS=”password”
    • Your ID and Password can be found in 2 places:
      • Novell Customer Center. (This is the preferred method) In the Novell Customer Center (http://www.novell.com/center) click on the “Products and Subscriptions” tab, then select a relevant subscription (SLED or SLES), next double click on a subscription (you may have several). You’ll see a link to generate mirror credentials down at the bottom of the new page. This page will create credentials that you can use to access any and all catalogs that you own a subscription for.
      • /etz/zmd/secret and deviceid on a machine that has been registered with the Novell Customer Center. If you use userid/secret from /etc/zmd you can only download updates for the architecture you registered with.
  • YUP_SERVER=”nu.novell.com”
    • “nu.novell.com” is the new name of the update server at novell.
  • YUP_ID_SLED=””, YUP_ID_SLES=””,YUP_PASS_SLED=””,YUP_PASS_SLES=””
    • I just copy the ID and Password that we discussed above
  • YUP_ARCH=”i586″
    • Pick the architecture(s) that you want to mirror.
    • Multiple architectures are delimited by a spaces
    • Valid options: i586,ppc,s390x,ia64,x86_64
  • YUP_PRODUCTS=”SLES10″
    • Pick whether you want to mirror SLES or SLED
    • Multiple architectures are delimited by a spaces
    • Valid options SLES10 and/or SLED10
  • YUP_SUBVERSIONS=”SP1″
    • Pick the subversion(s) you want to mirror
    • Multiple architectures are delimited by a spaces
    • Valid options: “GA”,”SP1″

Once you have finished configuring, simply run the command “YUP” to pull down the updates. This process can take a long time depending on the speed of your connection and the number of products and architectures you want to pull down. You can create a cron job to update your mirror. After it is run once, yup will only pull down updates that you don’t already have.

After setting up the YUP server you have to configure clients to point to your server for updates.

From the command line use the rug command:

#assuming you’re using http, use this command to add the service.
rug sa --type=YUM http://ipaddress/install/sledyup/i586 repodata
#subscribe to the service
rug sub -a
# update your server
rug up

You can also use the ZMD applet

  • Right click on the ZMD applet
  • Choose configure
  • Add service
  • Choose ZYPP
  • Enter the URI and Service Name (repodata is the default name)

Good morning from beautiful and sunny Trenton, NJ all!

So I thought I’d share an interesting experience myself and a colleague ran into last week. We were with a customer building a Linux desktop build for them when they were hit with the potential Excel 2007 calculation error (http://www.foxnews.com/story/0,2933,298510,00.html in case you hadn’t seen it). They asked us if there was an easy way to deploy OpenOffice.org (OOo) on a large number of desktops….in the next 40 minutes :)

We did some poking around and found out an easy way to deploy OOo on Win unattended. If you unpack the OOo zip file and run setup.exe /qn the OOo installer fires up silently and deploys the whole suite using the default options. Pretty cool!

OzzyJ (aka Jason Ganovsky)

Next Page »

Follow

Get every new post delivered to your Inbox.