Q40/Linux Journal Issue #2 www.geocities.com/SiliconValley/Pines/5865/q40lin.html Editor: Timothy Swenson (swensont@lanset.com) Editor's Forumn I got some positive feedback from the first issue of the Q40/Linux Journal. I noticed a number of people at the QL 2000 show carrying it around. In all I'm glad I did it and hope to continue doing issues. Q40/Linux is not the only thing in my life. I'm working on other QL projects (Turbo Manual, learning TurboPTR, etc.). I've also got some non-computer hobbies eating my time. I'm making sure that I spend some time working on Linux. I'm actually hoping to start supporting Linux professionally. So, here is the 2nd issue of the Q40/Linux Journal. Hope you enjoy it. Tip of the Month I don't know I'm the only one who did not know this, but the CTRL-ALT-DEL key combination will send INIT a SIGTERM and will cleanly shutdown Linux. I got into a situation where I could not get a shell, and so my only solution was to reset the Q40. Since the disks were not unmounted properly, I spent about 5-10 minutes in fsck the next time Linux booted. Finding the CTRL-ALT-DEL solution was much nicer. If you are in X-windows and it seems to lock up, a CTRL-ALT-BACKSPACE will kill X-windows and return you to the console prompt. Backing up to Floppy Having spent some time being a Unix system administrator, I know how important backing up data can be. Typical Unix systems backup whole file systems to tape. On the Q40, we have the software to do it, but we don't have access to tape drives. For some, having a CD-R is a good way to backup data. For most of us, floppies is about the only way to back data up. Backing up to floppies can take time, but the standard Linux tools does not allow for easily spreading a backup across multiple disks. Looking around www.linux.org, I found an application that can do this. Span is a utility that takes the output from a program like tar, and spreads it across a number of diskettes. Span knows when one disk is full and prompts you for the next disk. Span can be found a the following location: users.gtn.net/fraserm/span.html users.gtn.net/fraserm/span-0.2.4.tar.gz I downloaded the tar file, transfered it to the Q40, ungzipped it, and untared it. % gzip -d span-0.2.4.tar.gz % tar -xvf span-0.2.4.tar This put the files in the directory span-0.2.4. Span comes as source code and requires that it be compiled. Without making any changes to the source code or Make file, I did the following: % make % su % make install The 'make install' put the executable in /usr/local/bin and puts the man page where it 'man' can find it. Using span is fairly easy. The easiest way to get it to work is the following command line: tar -cfz - /dir | span /dev/fd0 What this does is this: It creates a tar file for the directory /dir and pipes it to span and has span use the device /dev/fd0 ( the first floppy drive). Span prompts you for the first disk and starts putting the data on it. When the disk is full, span will again prompt you to put in the next disk. The -z option of GNU tar compresses the tar ouput with GZIP. This will store more data on the disks. The disks I used were formated as MSDOS, but span seems to use it as a raw device and it may not care if the disk is formatted at all. The disks I used were no longer viewable my MS-DOS. To restore the files, do the following: despan /dev/fd0 | tar -xfz - This works in just the opposite as putting the data on disk. Despan will prompt you for the first disk and then start pulling the data off the disk and feed it to tar. I had problems running span as a user, so I resorted to running it as root. I think the problem I had is using the -l "label" option of span. It kept spitting out an error about the disk not being previously written by span. I'd avoid using the -l option. I did find one major problem with span. It reacts in a bad way to a SIGTERM signal (kill). It starts outputing that it recieved a kill signal and is aborting. This message is repeated over and over again, locking up the console for other uses. a SIGKILL (kill -9) should work, as SIGKILL is non-trapable by a program. When backing up your data, I'd recommend numbering the diskettes so that you can have them in the proper order when restoring the data. Installing MySQL By Claus Graf (cgraf@q40.de) According to the MySQL reference manual, "MySQL is a very fast, multi-threaded, multi-user and robust SQL (Structured Query Language) database server. For Unix and OS/2 platforms, MySQL is basically free; for Microsoft platforms you must get a MySQL license after a trial time of 30 days. The MySQL home page (http://www.mysql.com/) provides the latest information about MySQL." As the Q40 is Microsoft free, you can happily use MySQL. Since there is no RPM with a m68k binary of MySQL you need to get the Source RPM. I am using the one out of SuSE Linux 6.4 PowerPC Edition. The source RPM package, is independant of the hardware architecture and any Linux distribution that contains the MySQL sources should be suitable. After mounting the CDROM and locating the MySQL source package you can install it by typing % rpm -i /cdrom/full-names/src/mysql-3.22.32-55.src.rpm Your version number of MySQL might be different, of course. After that, some new files appear in /usr/src/redhat/SOURCES: DBI-1.13.tar.gz Data-ShowTable-3.3.tar.gz Data-ShowTable-3.3.dif Msql-Mysql-modules-1.2210.tar.gz mysql-3.22.32.dif mysql-3.22.32.tar.gz At first only the files mysql-3.22.32.tar.gz and mysql-3.22.32.dif are necessary. sql-Mysql-modules are Perl modules for MySQL that need the BI/BD interface. Data-ShowTable is also a Perl module for formatted output of results of database queries. Now copy mysql-3.22.32.tar.gz to the place where you want to compile the sources and uncompress and unpack the source data: % gzip -d mysql-3.22.32.tar.gz % tar xvf mysql-3.22.32.tar % cd mysql-3.22.32 % cp /usr/src/redhat/SOURCES/mysql-3.22.32.dif . The last command puts the diff file into the source directory. With the patch command you can apply small changes to the data in order to fix bugs etc: % patch -p1 < mysql-3.22.32.dif I had to skip two patch operations, the rest did work well. I don't know the reason for that. You can find more on how to apply patches in the file INSTALL-SOURCE, chapter "Applying patches". Now you're ready for compilation. This is done by the usual configure and make runs. It's described in detail in the file INSTALL-SOURCE-GENERIC. Here are the steps to do in short form: % ./configure % make % make check % make install % make clean % ldconfig % scripts/mysql_install_db The whole procedure takes a lot of time (hours). I'm waiting for a Q60 :-). Now you're ready to run. Before you can do anything with the database system, you have to start the MySQL server: % safe_mysqld & Administration is done with the "mysqladmin" program. For example, check out if the server really is running by % mysqladmin version and then shutdown the server with % mysqladmin shutdown For the sake of security you should also set a password, this is again done (after restarting the server) with mysqladmin: % mysqladmin -u root password new_password Here you have to replace "new_password" with the one you want to have. If you want to explore the existing databases and tables, use the "mysqlshow" command. Here are some simple sample commands (if you've set a password, you need the -p option and you have to type in the password after submitting the command) : % mysqlshow -p % mysqlshow -p mysql % mysqlshow -p mysql db If you want to pass SQL commands to the DBMS, there is the "mysql" command. Here is one example with a select statement. The password can also be supplied directly, but then everyone who is looking over your shoulder can read it: % mysql -pmy_password -e "select host, db, user from db" mysql In order to get into that I suggest that you read the chapter "Post-installation setup and testing" in the file INSTALL-SOURCE. The main manual in the ./Docs directory is very good and describes everything in detail, but is is also very long and it takes a while to find what you're looking for. If you like to produce a m68k binary RPM of MySQL you may try % rpm --rebuild MySQL-VERSION.src.rpm I haven't done that yet and cannot guarantee that it works. MySQL is a fairly complex application. There are a number of commercial books that cover using MySQL. To example books are: MySQL, Paul DuBois, New Riders MySQL & mSQL, O'Reilly & Associates At www.mysql.com is an online version of a manual that includes a tutorial. Adding Themes to WindowMaker I've decided to make WindowMaker my default window manager. There seems to be a fair amount of support in the Linux community for it, versus the lack of support for fvwm95, the default window manager for Red Hat 5.2. A Theme in WindowMaker is a overall look for the window manager. It includes a background image, a different look for menus (but still the same menus), a different font, and so on. I ran across Themes when I was looking into the different window managers available on the Q40. The web site www.themes.org, is a repository for themes for many different window managers. The web page wm.themes.org has a listing of all of the themes for WindowMaker. The best way to get a feel for what a Theme is, is to check out this web site and see all of the examples. I browsed around the web site and found a couple of themes that I wanted to try. I downloaded them, put them on floppy, and sneaker netted them to the Q40. The themes are in a gzip tar file. The files go into the ~/GNUstep/ Library/WindowMaker directory. Then do the following % gzip -d file.tar.gz % tar -xvf file.tar The files should be untarred to the proper directory. The next step is to start up WindowMaker and select a new theme. Before doing this, make a backup of the files in ~/GNUstep/Defaults/ directory. I ran into one Theme that seemed to have a problem and caused WindowMaker to core dump on start up. Since I could not run WindowMaker, I could not change the Theme back. I had to move the files in ~/GNUstep/Defaults/ aside and only then could I restart WindowMaker. Once in WindowMaker, select the menu (right mouse) and then select Appearance Themes select Theme from the list. The new Theme should take affect in a few seconds (give it time to read in the new Background image). That's all there is to it.