Open Source Software and Linux


September 19, 2008  7:47 PM

Convert your dpkg, rpm, tgz and slp applications to another package with alien



Posted by: Xjlittle
alien, centos, convert, deb, debian, Linux, linux package conversion, package conversion, red hat, RPM, slackware, solaris, sun, sun solaris

alien is software that allows you to convert an rpm package to dpkg or vice versa. It can also convert a .tgz package to the rpm or dpkg format allowing you to use software that has been packaged for a different package manager on your machine.

The latest version release is 8.72. The author of the software states that even though the version number is high alien should be considered experimental software and should not be used to convert or replace important system packages. That said alien has been in use many years and converted many packages.

The CentOS repositories don’t show an alien package. Apparently this seems to be a debian thing. Never fear though, alien to the rescue before ever installing the package!

First obtain the source package, unpack it and cd into that directory:

wget http://ftp.de.debian.org/debian/pool/main/a/alien/alien_8.72.tar.gz
tar xzvf alien_8.72.tar.gz
cd alien

Don’t install it! We get to have that fun here in a couple of steps. Now get the alien*deb package and download it into the source directory which you just unpacked. Once that is done we’ll convert the deb package to rpm and install it.

wget http://http.us.debian.org/debian/pool/main/a/alien/alien_8.72_all.deb
./alien.pl -r alien_8.72_all.deb
alien-8.72-2.noarch.rpm generated
ls
Alien alien_8.72_all.deb alien.lsm.in alien.spec debian GPL Makefile.PL README
alien-8.72-2.noarch.rpm
rpm -ivh alien-8.72-2.noarch.rpm
Preparing... ########################################### [100%]
1:alien ########################################### [100%]
which alien
/usr/bin/alien

There you have it! You now have alien and can convert your favorite rpm packages to deb or deb packages to rpm. Enjoy!

-j

September 17, 2008  12:34 PM

TheBrain visualization mind mapping software



Posted by: Xjlittle
brain software, knowledgebase, mind map, mind mapping, mindmap, mindmapping, thebrain, visual knowledge

TheBrain is highly visualized mind mapping software. I tried out this software using the PersonalBrain. The PersonalBrain is a free version of TheBrain software available for personal use. TheBrain software is cross platform and available for Linux, Windows and Mac.

Webster’s dictionary defines a mind map as

a diagram used to represent ideas or information branching from a central key word or idea and used as an aid in study, organization, problem solving, decision making, and writing

Reference:

“mind map.” Webster’s New Millenniumâ„¢ Dictionary of English, Preview Edition (v 0.9.7). Lexico Publishing Group, LLC. 14 Sep. 2008.

This first thing that I noticed about TheBrain is the visualization of the mind map. The graphics for this application are outstanding.
theBrain-virtualMachines

The 2nd thing that I noticed is the ease of use of this powerful software. To start you create a new brain by clicking on File=>New Brain and naming it. Once you have your brain started right click on it to create a Parent and Children for the subject of the your brain.

TheBrain software is animated. Once you have the Parent(s) and Children of your brain created you can click on any one of these to bring it into focus. This will expand all associations with that particular part of you brain.

TheBrain goes even further in making your ideas and concepts into an integrated knowledge base. You can attach supporting documents and links to web pages to any thought or process in your brain.

TheBrain is an excellent tool for collaboration between individuals and groups. Your brain can be exported as a static html page. If you have a web server you can export it complete with it’s xml files for the complete animated package. You can also zip it and send to colleagues.

The developers of TheBrain software provide many tools for making TheBrain as useful as possible to you. In addition to the typical forums every Friday they have a free Getting Started webinar from 10am to 11am PDT.

TheBrain software does an excellent job of putting the information together described in Webster’s definition of a mind map. It has won several awards including one of KMWorld’s 100 Companies that Matter in Knowledge Management for its 6th year.

So go put your thoughts together with your new visual brain. You’ll be glad you did!

-j


September 15, 2008  8:28 PM

VIM Shortcuts



Posted by: Xjlittle
editor, Linux, text editor, vi, vim, windows

I like the VIM text editor. Yes, VIM took some getting used to. Yes, VIM requires that you use a keyboard although there is now a graphical VIM for Windows and Linux which is pretty cool as well.

I am writing this so that maybe you will begin to like the VIM editor. Once you get used to the keyboard it becomes quick and easy to edit your text files. You may even get to avoid Carpel Tunnel Syndrome.

Ok so let’s get to it shall we?

Saving a file
To close a file without saving type ctrl +q. To save a file type ctrl + w. To save and close a file type ctrl + wq or ZZ (yes those are caps).

Ok, all of that was straight forward and anyone who has used VIM knows these things.

Let’s try a few more.

To open a file at a given line number type vim + <line number> . To open a file at the first instance of a word type vim +/<word to find> .

Ok let’s do some work inside of a file.

Basics
To undo text that you have entered type u and to undo all changes to a line type U. Typing :e! will revert back to the last saved copy of a file if you really mess up. To create a new line below the cursor type o and to create a line above the cursor type O. For searching a string use /<string to find> to search to the right of the cursor and ?<string to find> to the left of the cursor.

Deleting text
To delete a line place the cursor on the line and type dd. To delete several lines type <number of lines to delete>dd. For instance 3dd would delete the line where the cursor is and the next two lines. To delete all text from the cursor to the end of the line type D. For deleting all the text from the beginning of the line to the cursor type d. To delete all of the lines from the cursor to the end of the screen type dL and to delete all text from the cursor to the end of the file type dG. To delete all of the text from the cursor to the beginning of the file use d1G. If you want to delete all text from the cursor position to a given line number type d#$ where # is the line number of the specified line.

Changing text
If you want to change a word move the cursor to the beginning of the word and type cw. Note that the cursor will only remove up to any special character, punctuation or space. If you want to change the current sentence type cs. To change the current line type c$ or C. Note that preceding the command here with a number, as in most VIM commands, will change that number of words, sentences or lines.

Copying and pasting
To copy a line or lines type yy on the line with the cursor. To copy several lines from the location of the cursor down type <number of lines to copy>yy. For instance 5yy would copy the line where the cursor is and the next 4 lines. To paste those lines below the cursor type p and P to paste them above the cursor.

Ok now let’s have some fun!
How about finding and replacing a word or group of words in a file? Easy and fast. Let’s say we want to replace the word module with the words kernel module. At the VIM prompt type:
:%s/module/kernel module/
That would replace the first instance of module with kernel module. But what if you want to replace all instances? Simply add a g at the end of the line:
:%s/module/kernel module/g
If you want confirmation each time before the replace add a c to the end of the above:
:%s/module/kernel module/gc

How about opening another file from which you want to copy something into your current file? This is quite a simple operation and with VIM’s tab completion, which works much the same as bash tab completion, it is really a snap. Ok let’s say we have two files, a sample file in /home/jslittl/sample.txt and a config file in /etc/myapp/app.conf.

Let’s open the application file:
vim /etc/myapp/app.conf
Now open the sample file. Remember we have tab completion so you can use that. In the file that you just opened type:
:split /home/jsl<tab>/samp<tab>
Now the sample file is open and your cursor is in the sample file. Move the cursor to the line that you want to copy and type:
yy
and then:
ctrl w
to move into the app.conf file. Move the cursor to the line above where you want to paste and type;
p
Easy stuff huh?

The real beauty of an application like VIM starts to shine when you telnet or ssh into a remote machine and have to edit a configuration or ini file.

I hope that you picked up a pointer or two from this that will help make your work quicker and easier. I know I became more efficient when I learned some of these shortcuts.

-j


September 13, 2008  8:46 PM

Netbooks, Notebooks, Windows and Linux



Posted by: Xjlittle
Linux, netbook, notebook, windows

Most of us have heard of the Netbook. You know, the small 7″ screen Linux powered EeePC from ASUS. Of course Dell, Acer and MSI have joined in the fray. That’s fine. Competition is a good thing.

For one reason or another, probably because ASUS did not set reasonable expectations about what a netbook is capable of, or more to the point what it is not, they had a 35% return rate according to some sources. You see people bought the netbook with the idea in mind that it was a cheap notebook. They bought it wanting to hook up printers, cameras and other devices to their shiny new cheap computer. They were disappointed. Things happen.

What really gripes me though are articles like this one. This writer alludes to the idea that the problem was not the lack of capabilities of the the netbook, but instead that it was because the netbook had Linux installed as the operating system. He then goes on to extol the virtues that the netbook will have when the manufacturers begin to install Windows XP and Windows Vista Home.

Now don’t misunderstand me. I think people should have choice. If someone wants to use Windows that is their choice. I can and do use and administer both. It’s just that my preference is to use Linux because I find it easier use as a workstation and in many cases as a server. But when I read an article like the one mentioned above, that among other things, states that the netbook is an underpowered computer, and then goes on to say that it will zing with a bloated operating system like Windows Vista, I have to question the validity and purpose of such an article.

It seems to me the article was written, at least in part, to take a shot at Linux. Maybe, maybe not. I don’t know. What do you think?

-j


September 13, 2008  12:26 AM

Grub and boot errors



Posted by: Xjlittle
/root, centos, grub, grub.conf, initrd, Linux, menu.lst, red hat, vmlinuz

If you’ve administered or customized Linux long enough you’ve no doubt created a situation at some point where, during the boot process, that GRUB throws an error. We’re going to discuss some of these situations below along with ways to work through them.

If a file name or partition in the GRUB configuration file is incorrect GRUB won’t be able to find critical files such as the Linux kernel. For instance if the root directive points to something other than the /boot directory GRUB will throw one of the following errors:

Error 17: Cannot mount selected partition
Error 27: Unrecognized command
Error while parsing number
Cannot mount selected partition

If the GRUB configuration file is completely missing you will see the following:

grub>

If you find yourself at this prompt you can find a list of available commands by hitting the tab key.

The first thing that you are going to want to do in any of these cases is check and make sure that your root directive is correct. To do this, at the grub prompt, use the find command to locate the GRUB configuration file. Your search would begin something like this:

grub> find (hd0,0)/grub/grub.conf

where hd0,0 is the 1st hard disk and the 1st partition on the hard disk. Repeat the process using the various partitions on the 1st disk (hd0,1 hd0,2) and so on until you find the configuration file. If the partition is not found you will get an error:

Error 15: File not found

Once you have found the GRUB configuration file check it’s location against what the boot loader is showing. You can check the contents of the file by using the cat command:

grub> cat (hd0,0)/grub/grub.conf

Another way to find the same information is to locate the stage1 boot loader file:

grub> find /grub/stage1

You will see output specifying the /boot partition:

(hd0,0)

Perhaps the most simple way to get this information is to simply type root at the prompt:

grub>root
(hd0,0) : Filesystem type is ext2fs, partition type 0x83

Command completion also works from the GRUB command line. If you don’t remember the name of the kernel file type kernel / and press the tab key. This will show you the available files in the boot directory. The same holds true for the initrd file.

To sum all of this up and get your machine booted, at the GRUB configuration file type c for the GRUB command line. You should be at the grub> prompt.

Start by issuing the root directive as described above. This will set up your /boot partition. Now setup your kernel command line as described above. Remember that you can use command completion as this is a long line. At the prompt type:

grub> kernel /vmli (hit the tab key to complete the vmlinuz line).

You will also need the root=/your/root/partition directive on this line for Linux to boot. Last setup the third line by typing initrd which specifies the initial RAM disk.

grub> initrd /init (hit the tab key to complete the initrd line)

Now enter boot at the command prompt and your Linux machine should boot if you have the correct parameters.

Of course you could possibly prevent all of this by keeping a backup copy of the GRUB configuration file in the root’s home directory at /root.

-j


September 11, 2008  12:36 AM

Troubleshooot your Linux boot process with GRUB



Posted by: Xjlittle
/boot, /root, grub, grub.conf, Linux, menu.lst

Red Hat and subsequently Fedora and CentOS use the the GRUB (Grand Unified Boot Loader) to initialize the kernel and boot into Linux. I’m going to look at some of the common error messages possible when booting Linux and how to edit the GRUB boot loader to test and fix the errors.

GRUB has 6 basic editing commands:

b=boot the currently listed operating system
d=delete the current line
e=edit the current line
a=append a parameter to GRUB
o=create an empty line underneath the current line
O=create an empty line above the current line

These are the commands with which I will initially be working to access the grub configuration file.

After you boot to the GRUB menu screen highlight the line the Linux version that you want to edit. I like to use e so that I can choose which line that I want to edit.

On Red Hat and it’s derivatives you will usually see three lines at this point:

root
kernel
initrd

While any of the three could need editing to pass a parameter to the kernel you will want to use the kernel line. Highlight this line and press e to edit. Move to the end of the line to add a parameter. The kernel has many parameters that you can add here. I will use some of the more commonly used.

Booting into a different runlevel is probably one of the most common tasks of a Linux administrator. The Red Hat kernel has 7 parameters that you can use to boot to the runlevel that you want. These are 1, single (or s), emergency, 2, 3, 4, or 5. If you add single or s to the end of this line you will boot into single user mode. If you boot into runlevel 0 or 6 you will either halt or reboot your machine.

Another common area that not only administrators but users as well find themselves requiring is the VGA setting. Occasionally on updating a video driver or for various other reasons your machine may continue booting but only showing a black screen without any output. A possible way to overcome this so that you can see the output and at least get to runlevel 3 is vga=ask.

Some other commonly used parameters are selinux=[0|1] where 0 disables selinux, acpi=[force|off|noirq|ht|strict] and mem=n[KMG].

The ACPI option controls parameters that the Advanced Configuration and Power Interface (ACPI) subsystem can use. This is the main option for the Advanced Configuration and Power Interface (ACPI). The values are:
force: Force ACPI to be enabled. Can be used to override the kernel configuration option that disabled it.
off: Disable ACPI. Can be used to override the kernel configuration option that enabled it.
noirq: Prevent ACPI from being used for IRQ routing.
ht: Run only enough of the ACPI layer to enable HyperThreading on processors that are capable of it.
strict: Make the ACPI layer be less tolerant of platforms that are not fully compliant with the ACPI specification.

The mem option forces a certain amount of memory used by the kernel. When
used with the memmap= option, physical address space collisions can be avoided. Without the memmap= option, this option could cause PCI devices to be placed at addresses that belong to unused RAM. n specifies the amount of memory to force and is measured in units of kilobytes (K), megabytes (M), or gigabytes (G).

That covers some basics kernel parameters, how to access and edit them. You will find these most useful generally on a new install or after adding new hardware that is either not detected or acting properly.

If you want to see more on the various kernel options and parameters install the kernel-doc package. The documentation can then be found under /usr/share/doc/kernel-doc-2.6.18/Documentation on recent Red Hat and CentOS versions.

Next post I’ll get into some of the error messages that are common when you Linux machine refuses to boot.

-j


September 9, 2008  6:00 PM

Why I like TinyMe Linux



Posted by: Xjlittle
Linux, notebook, notebook computer, operating system, tinyme

TinyMe Linux is the Operating System of choice if you have an older pc or notebook that you want to use. I have one of those and I have put it to good use with TinyMe.

My wife likes to have a notebook computer in the kitchen. This way she can look at recipes, check mail, check on her Longaberger sales or whatever else she wants to do while cooking. The kids look up the weather before going outside to get on the bus or some other information that they quickly want to know. TinyMe to the rescue!

I read an evaluation of TinyMe in an article long since forgotten. The writer of the article did an excellent job of comparing several of the smaller footprint Linux distributions. After reading through the article and looking at all that TinyMe provided I decided that this was the way to go. I have never looked back.

The notebook computer that I am referring to has a 1Ghz Intel processor, 256Mb of ram and a 30Gb hard drive. I used 1Gb of swap to cover the reduced amount of ram.

The download size is a whopping 200Mb :-) in size so it easily fits on a CD. Even better the default install uses a whopping 792Mb in disk space.

The default applications that ship with TinyMe should satisfy about anyone for general computer use. The Opera web browser is the default along with Abiword word processor, Audacious audio player, TightVNC, Python and Perl. Flash is the only app that I needed to install to meet the requirements of my wife. This is handled quickly and easily with the Synaptic package manager.

Given that the minimum requirements of TinyMe are a Pentium processor and 64Mb of ram TinyMe really flies with my 1Ghz cpu and 256Mb of ram.

If you are wanting to put that old notebook or pc to use you should really give TinyMe a look. You’ll be impressed!

-j


September 8, 2008  3:37 PM

Graphical Linux File Structure representation



Posted by: Xjlittle
/bin, /boot, /home, /root, /sbin, fhs, file system, Filesystem Hierarchy Standard, kernel, Linux, linux kernel

I ran across the following jpeg file on another blog. I thought it a reasonable idea to distribute this as much as possible as it is a very good representation of the Linux file structure.

A couple of things to note about this graphic:
The author did it in caps for readability. None of the files or directories shown are in caps on a Linux system. The ROOT label at the top is to designate that it is representing the root file system. It does not represent the root’s home directory which is /root in the lower right hand corner of the graphic. This probably should have been labeled “ROOT FILESYSTEM”.

For new Linux users reading this you should note that most systems today will by default create three to four partitions for mounting various directories:
/boot holds the kernel and files that the boot loader uses to boot Linux
/ holds the user (/bin)and system (/sbin) binaries as well as other configuration and log files
/home holds the directories of users that have been added to the system
/swap the partition the system uses for swap memory

Here’s the graphic. Enjoy!
-j

Click to enlarge
Linux File System Graphic


September 8, 2008  1:00 AM

Create an Apache Virtual Host



Posted by: Xjlittle
apache, centos, dav, http, httpd, https, Linux, virtual host, web server, webdav

Creating Apache virtual hosts allow you to use a single IP address for many web servers. I use mine for general web serving as well as secure WebDav over HTTPS. The Apache web server is arguably the most popular web server on the internet and has been since 1996.

Ok let’s get started setting up your Apache virtual host. I am using Centos 5.x for our operating system. The apache server is the stock install using YUM.

Edit the /etc/httpd/conf/httpd.conf file. The virtual hosts section is towards the bottom.
Uncomment the NameVirtualHost *:80 directive If you want virtual hosts accessed over SSL you will need to add the NameVirtualHost *:443 directive as well.

For virtual hosts over SSL the virtual host containers should be added to the /etc/httpd/conf.d/ssl.conf file.

Almost any Apache directive may go into a VirtualHost container. Following is a sample virtual host container. Use the auth directives if you want authentication for your host. The users are set up with the htpasswd command. See man htpasswd for more info.

When apache receives a web site request on the IP address it looks to the configuration files
to determine if it has the host. If it has the host it then looks to the DocumentRoot of the host to determine what pages and directories are available and serves them to the client.

ServerAdmin webmaster@www.luvlinux.net #email address on error pages
DocumentRoot /var/www/vhosts/luvlinux #where apache looks for web site documents
ServerName www.luvlinux.net #dns name of server (Web site host name)
ErrorLog logs/www.luvlinux.net-error_log #logs are located relative to serverroot
CustomLog logs/www.luvlinux.net-access_log common
#put options in here
Options Indexes Multiviews #shows an index of files if no index.html
# AuthType Basic #authentication type
# AuthName “My this site” #name that shows on login dialogue
# AuthUserFile /etc/httpd/webpass #name of the password file
# Require user engineer1 #name of authorized user(s)

ServerAdmin webmaster@www.example.net
DocumentRoot /var/www/vhosts/example.net
ServerName www.example.net
ErrorLog logs/www.example.net-error_log
CustomLog logs/www.example.net-access_log common

Options Indexes Multiviews

Use the following command to check your virtual host configuration:
httpd -D DUMP_VHOSTS

You will get output similar to the following indicating that everything is ok.

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443 myhost.example.com (/etc/httpd/conf.d/ssl.conf:82)
*:80 is a NameVirtualHost
default server www.example.net (/etc/httpd/conf/httpd.conf:993)
port 80 namevhost www.example.net (/etc/httpd/conf/httpd.conf:993)
Syntax OK

Use the following to check the general syntax of your configuration files:
httpd -t
Syntax OK

Congratulations! You should now have your Virtual Host setup. Don’t forget to make your hosts and/or DNS entries for accessing your web server. Enjoy!

-j


September 6, 2008  8:05 AM

Squid proxy server quick start



Posted by: Xjlittle
centos, ftp, http, https, Linux, proxy, proxy cache, squid, squid.conf, unix, web proxy, windows, Yum

Here is a quick start plan for installing the squid-cache.org proxy server. Squid is a caching proxy server that uses HTTP, HTTPS and FTP for caching web pages from the internet. By caching web pages locally the squid server helps you save on bandwidth and increases page response time for web surfing.

When you first open the squid configuration file it can be overwhelming with over 4000 lines. Many of these are comments but there are still hundreds of configuration choices. I am going to reduce these down to a solid foundation which will get you up and running quickly. This will give you some time to study the other configuration choices that may be necessary for your use. For most people some form of the configuration entries that we use here will be enough to control and proxy your web access.

Squid can be installed on Linux, Unix or Windows. For our purposes here we are installing on Centos 5.x.

Let’s get started:

Install the Squid package
yum install squid

cd to the configuration directory
cd /etc/squid

The default squid config file contains over 4000 lines. Remove the comments so that the file
is a workable size
Copy the squid.conf file to dist.conf.squid to preserve the comments for reference
cp squid.conf dist.squid.conf
The following sed command edits the squid.conf file in place removing comments and empty lines
sed -i.tmp '/^#/d; /^$/d' squid.conf
This will produce a file that contains the following entries:


http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
coredump_dir /var/spool/squid

After doing this you will need to add some lines to the squid file for your environment

vim squid.conf
visible_hostname
acl our_networks src / /
as in 192.168.1.0/24 192.168.2.0/24
http_access our_networks

Save your changes and exit the squid.conf file.

Create the squid cache directories in /var/spool/squid
quid -z

Set squid to start on reboot
chkconfig squid on

Start squid
service squid start

This should work out of the box after pointing the clients to the correct proxy server and port.

Additional configuration directives can be issued through the /etc/sysconfig/squid file and the /etc/init.d/squid script.

I hope this helps you get squid up and running quickly. Enjoy!

-j


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: