Building MySQL Workbench 1.0.1 for Linux (Part 2)

Following my earlier post of MySQL Workbench 1.0.1 for Linux and logging a MySQL Bug, I’ve had the Bug verified, and the a further update of a compiler success. Details of compile from Bug #16880

Compiled with:

- glibmm-2.8.1
- gtk+-2.8.8
- libsigc++-2.0.11

I’ve got:


libsigc++-2.0.17
glib-2.6.6
glibmm-2.6.1
atk-1.9.0
pango-1.8.2
gtk+-2.6.9
gtkmm-2.6.5
lua-5.0.2

So starting with the obvious downgrading of libsigc++


$ su -
$ cd /src
$ wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.0/libsigc++-2.0.11.tar.gz
$ tar xvfz libsigc++-2.0.11.tar.gz
$ cd libsigc++-2.0.11
$ ./configure --prefix=/usr
make
make install

Now to retrace the MySQL compiling.


$ su -
$ cd /src
$ wget ftp://ftp.mysql.com/pub/mysql/download/mysql-workbench-1.0.1.tar.gz
$ tar xvfz mysql-workbench-1.0.1.tar.gz
$ cd mysql-workbench-1.0.1
$ cd mysql-gui-common
$ ./configure --enable-grt --enable-canvas
$ make

No errors, a sound start.


$ cd ../mysql-workbench/
$ ./configure
$ make
../../../mysql-gui-common/library_gc/source/libgcanvas.a(myx_gc_gl_helper.o)(.text+0x1b5): In function `getProcAddress(char const*)':
/src/mysql-workbench-1.0.1/mysql-gui-common/library_gc/source/myx_gc_gl_helper.cpp:264: undefined reference to `glXGetProcAddress'
collect2: ld returned 1 exit status
make[3]: *** [mysql-workbench-bin] Error 1
make[3]: Leaving directory `/src/mysql-workbench-1.0.1/mysql-workbench/source/linux'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/src/mysql-workbench-1.0.1/mysql-workbench/source/linux'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/src/mysql-workbench-1.0.1/mysql-workbench/source'
make: *** [all-recursive] Error 1

Crash and burn. So try to reproduce with the more accurate libraries. Of course it’s a bit of trial and error, here is the end result in order, but it was much more difficult as previously to get this.


$ cd /src
$ wget ftp://ftp.gtk.org/pub/gtk/v2.8/pango-1.10.2.tar.gz
$ tar xvfz pango-1.10.2.tar.gz
$ cd pango-1.10.2
$ ./configure --prefix=/usr
$ make
$ make install
$ wget ftp://ftp.gtk.org/pub/gtk/v2.8/glib-2.8.6.tar.gz
$ tar xvfz glib-2.8.6.tar.gz
$ cd glib-2.8.6
$ ./configure --prefix=/usr
$ make
$ make lib
$ wget ftp://ftp.gtk.org/pub/gtk/v2.8/atk-1.10.3.tar.gz
$ tar xvfz atk-1.10.3.tar.gz
$ cd atk-1.10.3
$ ./configure --prefix=/usr
$ make
$ make install
# (sigc++-2.0 >= 2.0.0 glib-2.0 >= 2.8.0 gobject-2.0 >= 2.8.0 gmodule-2.0 >= 2.8.0)
# Latest is 2.8.4
$ wget http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.8/glibmm-2.8.1.tar.gz
$ tar xvfz glibmm-2.8.1.tar.gz
$ cd glibmm-2.8.1
$ ./configure --prefix=/usr
$ make
$ make install
# New Requirements for gtk 2.8.8
$ wget ftp://ftp.gtk.org/pub/gtk/v2.8/dependencies/cairo-1.0.2.tar.gz
$ tar xvfz cairo-1.0.2.tar.gz
$ cd cairo-1.0.2
$ ./configure --prefix=/usr
$ make
$ make install
# Pango not found. Pango built with Cairo support is required
$ cd /src/pango-1.10.2
$ ./configure --prefix=/usr --with-cairo=YES
$ make
$ make install
$wget ftp://ftp.gtk.org/pub/gtk/v2.8/gtk+-2.8.8.tar.gz
$tar xvfz gtk+-2.8.8.tar.gz
$cd gtk+-2.8.8
# Requirements (glib-2.0 >= 2.7.1 atk >= 1.0.1 pango >= 1.9.0 cairo >= 0.9.2)
$ ./configure --prefix=/usr
$ make
$ make install
# gtkmm Latest is 2.8.2
$ wget http://ftp.gnome.org/pub/GNOME/sources/gtkmm/2.8/gtkmm-2.8.2.tar.gz
tar xvfz gtkmm-2.8.2.tar.gz
cd gtkmm-2.8.2
./configure --prefix=/usr
# Note, this takes by far the longest to compile
make
make install

SideNote: This was a maze to get the right dependancies for the right products. It took many hours.

And around the merry-go-round we go again.


cd /src/mysql-workbench-1.0.1/mysql-gui-common
$ ./configure --enable-grt --enable-canvas
$ make
$ make install
$ cd ../mysql-workbench/
$ ./configure
$ make
/usr/lib/python2.3/config/libpython2.3.a(posixmodule.o)(.text+0x3c5a): In function `posix_tmpnam':
: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/usr/lib/python2.3/config/libpython2.3.a(posixmodule.o)(.text+0x3b94): In function `posix_tempnam':
: warning: the use of `tempnam' is dangerous, better use `mkstemp'
../../../mysql-gui-common/library_gc/source/libgcanvas.a(myx_gc_gl_helper.o)(.text+0x1b5): In function `getProcAddress(char const*)':
/src/mysql-workbench-1.0.1/mysql-gui-common/library_gc/source/myx_gc_gl_helper.cpp:264: undefined reference to `glXGetProcAddress'
collect2: ld returned 1 exit status
make[3]: *** [mysql-workbench-bin] Error 1
make[3]: Leaving directory `/src/mysql-workbench-1.0.1/mysql-workbench/source/linux'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/src/mysql-workbench-1.0.1/mysql-workbench/source/linux'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/src/mysql-workbench-1.0.1/mysql-workbench/source'
make: *** [all-recursive] Error 1

Same result, so after another 4 or 5 hours, I still have nothing.

Update
Some more research (I really should devote my time to other pursuits). An official comment from NVidia Corporation on their forums. View Thread

This is not a NVIDIA bug, glXGetProcAddress() is part of GLX 1.4, which the NVIDIA Linux/UNIX graphics driver doesn’t claim to support (nor do I think was GLX 1.4 ever finalized); you should always use glXGetProcAddressARB().

Downgrading a MySQL schema from 5 to 4 (Part 2)

As requested by Frank, here are the working parts of my earlier Downgrading a MySQL schema from 5 to 4 article.

The Problem

To recap, I received a MySQL Version 5.0 schema via a sql file, however I was unable to upgrade from MySQL 4.0 to MySQL 5.0 on my old RedHat 7.3 production server. As an interim solution, I still wanted the schema and data to allow for initial development (without the 5 specific features including Views,Triggers and Procedures/Functions). However the MySQL 5.0 SQL file would not run in MySQL 4.0.

Sample

Here is a small subset of the MySQL Sakila Sample Database schema to demonstrate the problem.

DROP SCHEMA IF EXISTS sakila;
CREATE SCHEMA sakila;
USE sakila;
--
-- Table structure for table `actor`
--
CREATE TABLE actor (
  actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  first_name VARCHAR(45) NOT NULL,
  last_name VARCHAR(45) NOT NULL,
  last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  active BOOLEAN NOT NULL DEFAULT TRUE,
  PRIMARY KEY  (actor_id),
  KEY idx_actor_last_name (last_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

Conversion

The following commands produced the output valid for a MySQL 4.0 database.


$ dos2unix sakila-schema-0.2.sql
$ cat sakila-schema-0.2.sql | sed -f mysql5to4.sed >sakila-schema-0.2.mysql4

NOTE: These commands are Linux Commands. There are probably Windows compatible commands however without Windows around to test this, I’m not going to offer any advice here. Anybody with any experience here please advise.
If you don’t have Linux, then get it. Sound to hard, well start with a Live CD, for example Knoppix or Ubuntu. These will allow you to boot of CD and it will never affect your Windows machine. If you don’t have broadband or a CD Burner, look at buying a computer magazine. You will find quite regularly options or Live CD’s. Of if you can’t afford that, Ubuntu – ShipIt will ship you the CD for free.
Even better then this, you can now use VMWare Player and have a working Linux environment running in parallel with your Windows at the same time, and it will not affect Windows in any way. You just need the VMWare Player, then a suitable Virtual machine. If there is a single person with an excuse why they can’t experiment with Linux, your not embracing Open Source. Start today, start right now, I’ve given you the links.

Results

DROP DATABASE IF EXISTS sakila;
CREATE DATABASE sakila;
USE sakila;
--
-- Table structure for table `actor`
--
CREATE TABLE actor (
  actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  first_name VARCHAR(45) NOT NULL,
  last_name VARCHAR(45) NOT NULL,
  last_update TIMESTAMP NOT NULL,
  active TINYINT NOT NULL DEFAULT TRUE,
  PRIMARY KEY  (actor_id),
  KEY idx_actor_last_name (last_name)
)TYPE=InnoDB;

The Code

Ops, almost forgot the important bit. Note, the syntax in this file is specific, characters and spaces are significant. My advice if you have no idea about ex regular expresssions and syntax, don’t touch.

The contents of mysql5to4.sed

s/CREATE SCHEMA/CREATE DATABASE/
s/DROP SCHEMA/DROP DATABASE/
s/ DEFAULT CHARSET=utf8;$/;/
s/ENGINE=/TYPE=/
s/ ON UPDATE CURRENT_TIMESTAMP//
s/ DEFAULT CURRENT_TIMESTAMP//
s/BOOL /TINYINT /
s/BOOLEAN /TINYINT /
/^DELIMITER/d

Further Work

  • These workarounds work on a generated mysqldump file. For example, I bank on implied standards of UPPERCASE in the syntax of commands.
  • I don’t cater for situations where DEFAULT CURRENT_TIMESTAMP is defined on a TIMESTAMP column which is not the first listed in the database table. This could be catered for with some more shell scripting with awk (More about awk 1, 2, 3)
  • I don’t cater for syntax situations not currently described in the Sakila Sample Database.
  • For now, I’ve manually removed the TRIGGERS, VIEWS, PROCEDURES and FUNCTIONS, however there would be good success via shell scripting to also archieve this.

MySQL Alternative

Morgan provided a suitable syntax for mysqldump in his Compatibility between MySQL Versions article, however I found this not to work completely successful. Here are my findings.

Syntax


mysqldump --compatible=name

Example

Using 5.1.4-alpha-max under Linux (not glib23)

$ mysqldump -P3307 -hlocalhost.localdomain -uroot -d --compatible=mysql40 sakila

The resultant file had the following lines, I’ve just cut and paste to show issues.
Using 4.0.13-standard.


mysql> DELIMITER ;;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 1

Using 4.1.10a-standard

mysql> DELIMITER ;
ERROR:
DELIMITER must be followed by a 'delimiter' character or string

This invalid handling of DELIMITER has a downstream affect when it gets to triggers.

mysql> /*!50003 CREATE TRIGGER `ins_film` AFTER INSERT ON `film` FOR EACH ROW BEGIN
-> INSERT INTO film_text (film_id, title, description)
-> VALUES (new.film_id, new.title, new.description);
Query OK, 0 rows affected (0.00 sec)
mysql> END */;;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'END */' at line 1

I Need to get around to checking the Bug Database to see if these need to be logged.

Win4LinPro Trial

In my continuing effort of finding a suitable complete Windows environment under Linux for those small occasions when you just can’t ditch it, I’ve tried Win4Lin. You can download 2 week evaluation copy from the website.


$ su -
$ wget http://www.win4lin.com/administrator/downloads/Win4LinPro-6.2.5-01.i386.rpm
#wget http://www.win4lin.com/index.php?option=com_remository&Itemid=76&func=download&filecatid=3
$ rpm -ivh Win4LinPro-6.2.5-01.i386.rpm


Preparing... ########################################### [100%]
1:Win4LinPro ########################################### [100%]
14 day(s) left in evaluation period.
Creating images... done.
ERROR: Module kqemu does not exist in /proc/modules
Host architecture: i686
KQEMU package: /opt/win4linpro/etc/kqemu.tar.gz
NOTE: KQEMU is Copyright 2005 by Fabrice Bellard.
Win4Lin, Inc. is an authorized distributor of this code.
Building KQEMU module in /tmp/.build_kqemu-24886
Please see the file /tmp/build-kqemu.log in case of error
Installing KQEMU module in /lib/modules/2.6.9-22.0.1.ELsmp/misc
Loading KQEMU module
Starting Win4Lin Pro: [ OK ]

Need to load a Windows XP CD. Note: It must have SP1 or SP2. An older XP CD did not work.


$ loadwinproCD
13 day(s) left in evaluation period.
You may use Win4Lin Pro without entering a license code
until the evaluation period ends. If you already have
a full license code, you may enter it now.
If you do not have a license code, you may enter it at
any time in the future by running (as root):
/opt/win4linpro/bin/ask_license.sh
Would you like to enter your license code now? (y/n) n
Checking CDROM...
Media found: Windows XP Professional (Service Pack 1)
Loading installation files... please wait...
.................................................
Loading CDROM... please wait...
..................................................
Windows CDROM load complete.
$ exit
# must not be be root to continue


$ installwinpro
Selected winxppro to install by default
installwinpro: installation details:
Target directory: /home/rbradfor/winpro
Windows version: winxppro
Guest image size: 4G
mergepro-gowimg: created /home/rbradfor/winpro/GUEST.IMG, size=4G
Enabled KQEMU acceleration
(mergepro-core)
Partitioning guest image...
Guest image partitioning complete.
Enabled KQEMU acceleration
(mergepro-core)
Formatting guest image...
QuickFormatting (only flushing metadata)
Format complete.
4,293,563,392 bytes total disk space
4,293,563,392 bytes available on disk
4,096 bytes in each allocation unit.
1,048,233 allocation units available on disk.
Volume Serial Number is 0D28-140E
Guest image format complete.
installwinpro: launching guest installation...
Enabled KQEMU acceleration
mergepro-gfx: LANG not found, defaulting to: en-us

This then provided the normal windows installation in a window, the only requirement was a serial number, so they have definitely streamlined the Windows installation. Then to run windows.


$ winpro

I did have an installation problem, where I got a CD error of not being able to access a file. Now given that Win4Lin precopied the entire CD, I’m not sure what to make of it, I had to skip the file, and it did not appear to affect the installation. I’ve got a screenshot to upload sometime.

So far, all I’ve really done is run it, I found that it was very slow. What was great, that on the very clean desktop the only icon was a mapping the Linux user home directory. I tried to install Photoshop CS, about the only thing I really want under Windows until I become better with Gimp. Problem was it promptly told me I needed 7GB of space, which I didn’t have. Not sure if I can easily add additional diskspace. Guess I’ll have to RTFM.

PAE Support

Well, learnt a new one today. After a recommendation from a collegue about trying Parellels as a VM tool to run on Linux enabling some more virtual OS’s. (a.k.a. Like VMWare), I eagerly downloaded the rpm and installed. Being caught a bit lately I took the liberty of reviewing the Parallels Workstation 2.0 Installation Guide For Linux as part of the process. Pre-reqs this, ok, run this ok, supports RHEL4 that’s good. Then run the following, accept licence and continue. Fine.


Parallels-config

So I flip to the next page of the manual (pg 13), and there in big letters is:


Troubleshooting
If you receive “Can not configure!” or “Can not compile!” message (note that you should have kernel sources installed), you can view log file and try to fix problem yourself. The log file is named /usr/lib/Parallels/comp.log.< log number>.error
If log contains the following sentence: “Your kernel is compiled with PAE (Physical Address Extension)”, it means that currently running kernel supports PAE. Unfortunately the current version of the Parallels Workstation does not support PAE. To fix the problem:

  • if you have another kernel configuration compiled without PAE support, boot in this kernel.
  • if not, recompile your current kernel to create another one that does not support PAE. Please note that recompiling kernel may lead to unstable work of your primary system. For instructions on how to do this please refer to your primary OS system administration guide or consult your system administrator.
  • run the Parallels Workstation configuration script again.

Well it only took 30 secs for the install to fail. Here I am thinking, given the nightmares I’ve had lately compiling and installing software do I even bother looking.


/usr/lib/Parallels/Drivers/drvMain/vmmodule.h:44:3: #error "Your kernel is compiled with PAE (Physical Address Extension)"
/usr/lib/Parallels/Drivers/drvMain/vmmodule.h:45:3: #error "The current version of the Parallels Workstation does not support PAE mode."
/usr/lib/Parallels/Drivers/drvMain/vmmodule.h:46:3: #error "(Processor type and features -> High Memory Support) - must be not more than 4GB"

Well, made a post on CentOS 4 forums, but I had mixed response with this site.

Anybody know how to recompile a kernel with PAE support? Doesn’t seem a great topic on google.

BTW, in case you missed it PAE is Physical Address Extension.

Playing .avi files under Linux

Got myself some .avi files but didn’t have a player under CenOS 4.2. MPlayer would appear to rate well as a media player for linux.


yum install mplayer
yum install lame


# Unfortunately mplayer while registered could not be downloaded, tried the hard way
wget http://rpm.greysector.net/yum/4/i386/mplayer-1.0pre7try2-2.i386.rpm
rpm -ivh mplayer-1.0pre7try2-2.i386.rpm
# lame wasn't needed via the manual process, but just in case
#wget http://rpm.greysector.net/yum/4/i386/libmp3lame-3.96.1-4.i386.rpm

Surprisingly, it’s not a GUI interface, but mplayer on the command line is more then adequate.

Support for Technology Stacks

As part of my next conference presentation Overcoming the Challenges of Establishing Service and Support Channels I’ve been struggling to find with my professional sources, any quality organisations that provide full support for a technology stack, for example a LAMP stack, or a Java Servlet stack.

Restricted to searching via online, I’ve been impressed by what I’ve found at Spike Source www.spikesource.com. An organisation with an experienced CEO, well known in the Java Industry. They certainly have all the buzz words covered in their product information.

Benefits of their SpikeSource Core Stack.

  • Fully tested and certified
  • Installs in minutes with integrated installer
  • Enterprise-class maintenance and support available
  • Vendor neutral
  • Horizontally and vertically scalable

SpikeSource offers three prebuilt configurations that can have you up and running in around ten minutes. These configurations comprise the following component choices:

  • LAMP Stack – for Websites with dynamic database-driven content written using Perl and PHP.
  • Servlet Stack – for dynamic Websites written using Java-based Web technologies such as servlets.
  • J2EE Stack – for Web applications that separate Web interface and application logic using Java Servlets and Enterprise JavaBeans.

Supported Platforms. What’s of interest here is RHEL, SuSE as well as Fedora Core 3. In line with for example Oracle software running under Linux.

What’s interesting, is they have MySQL 4.1.14 in their spikesource stack (1.6.2), so they are quite some months behind here. Especially now that MySQL 5 has been available 3 months now. Not only just stack technology, their infrastructure supports a large number of open source products and appears to provide infrastructure via a community to enhance the product offerings within this stack. The Spike Developer Zone Components List provides a long list of products.

Their release notes provide good instructions, in particular what configuration was used in the building of the software. For example, here is the MySQL Release Notes, MySQL Quick Start Guide, MySQL Troubleshooting Guide

They talk about testing, where Core Stack Testing provides more details here.

They also claim to provide VMWare Community Virtual Machine that can be run via the free VM Player on any system without having an effect on an existing system. This is indeed impressive, however it doesn’t seem available. There are many other installations available at the VMWare site.

I’m interested to see what else existing in the marketplace for a fully supported technology stack, rather then support of individual components (e.g. RedHat for Linux, MySQL AB for MySQL, JBoss for a servlet container)

In reading comparisions, there is reference also to Source Labs – www.sourcelabs.com. Anybody that can offer recommendations that I can research would be great.

Linux Format Reader Awards 2006

The Linux Format magazine is having it’s annual reader awards in a number of categories.

These include (I’ve include my picks after each category):

You can nominate at http://www.linuxformat.co.uk/nominate/. Nomimations close Friday 10 Feb 2006.

"JS Debugger Service is not installed" – Firefox debugger message

Attempting to run the Venkman JavaScript Debugger in FireFox 1.07 doesn’t work under CentOS 4.2.

It keeps launching an error window with “JS Debugger Service is not installed”. This does not appear to be an isolated issue from a Google search, however finding the solution proved a little harder to track down.

There is a thread at the Mozilla Bug Tracking site that sheds light on the problem.

1. You should first ensure you have the latest version of the debugger? (0.9.85, as far as I’m aware) (Available from http://hacksrus.com/~ginda/venkman/)

2. You need in the location bar on the browser enter about:buildconfig and see if –disable-jsd is specified?

Should you see that, you have your problem, the Linux distro has disabled this.
The solution is to download the tar directly from FireFox, however if your OS has previously installed by rpm, as in my case, you have to consider now running a different non rpm version.

Mount Window Share under Linux with Samba

First check what shares are available for your Windoze Box (in this case it is at 192:168.100.36 with a login of <username> and a password of <password>)

$ smbclient -L 192.168.100.36 -U <username>
$ mkdir /mnt/<sharedir>
$ mount -t smbfs -o username=<username>,password=<password> //192.168.100.36/<share> /mnt/<sharedir>
$ ls /mnt/<sharedir>

Installing Samba

Running on CentOS 4.1 the following steps were use to install Samba.

Install RPM’s
$ rpm -ivh samba-3.0.10-1.4E.i386.rpm
$ rpm -ivh samba-swat-3.0.10-1.4E.i386.rpm

Start Processes
$ /etc/rc.d/init.d/smb start


Check Processes
$ ps -ef | grep smb
root 21243 1 0 10:19 ? 00:00:00 smbd -D
root 21244 21243 0 10:19 ? 00:00:00 smbd -D
$ ps -ef | grep nmb
root 21248 1 0 10:19 ? 00:00:00 nmbd -D

Enable on System Reboot
$ chkconfig smb on
$ chkconfig –list smb

Configure SWAT (web interface to administer samba)
$ vi /etc/xinetd.d/swat

# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat 
#              to configure your Samba server. To use SWAT, 
#              connect to port 901 with your favorite web browser.
service swat
{
        port            = 901
        socket_type     = stream
        wait            = no
#       only_from       = 127.0.0.1
        user            = root
        server          = /usr/sbin/swat
        log_on_failure  += USERID
        disable         = no
}

$ killall -SIGHUP xinetd
$ tail /var/log/messages

Sep 13 10:17:18 omega xinetd[2160]: Starting reconfiguration
Sep 13 10:17:18 omega xinetd[2160]: Swapping defaults
Sep 13 10:17:18 omega xinetd[2160]: Reconfigured: new=1 old=0 dropped=0 (services)

Verify Settings

Using the installed SWAT, simply point the browser to http://111.111.111.111:901/

Htaccess is root and the system root password

Configuring Samba, well that’s another story.

Password protecting Apache Site for external users only

In order to make an intranet an extranet, you need to place the intranet on a server in the DMZ.
From here, configure a virtual server accordingly (e.g. intranet.site.com.au)

You will need to configure on an internal DNS (or smoothwall /etc/hosts when using a webproxy) a reference to intranet.site.com.au

Your global DNS for site.com.au should not have intranet specified. This should be invalid in some way. For example in my sites, I have a catch all domain that is an unknown.site.com.au and with wildcard DNS, any invalid domain URL’s in the *.site.com.au go here. For example, try http://intranet.ucb.com.au

Now, within your Apache Httpd conf VirtualHost directive you need to add the following.


<Directory "/home/intranet/www">
  Options Indexes

  Order deny,allow
  Deny from all
  Allow from 192.168.100
  Allow from 10.1.1
  Require valid-user
  Satisfy any

  AllowOverride AuthConfig
  AuthType Basic
  AuthName "Administration Access Only"
  AuthUserFile /home/intranet/.htaccess
</Directory>

You just need to create the appropiate .htaccess file, and restart Apache httpd. Access from the internal network is allowed via IP, and everything else must use the authentication model used.

To setup external access, I created a sepearate subdomain called extranet. To further restrict this past basic access, I configured to to connect to the firewall only on port 81, and then had a rule to redirect to port 80 on the DMZ machine.

So what I ended up with was:

http://intranet.site.com.au internally accesses the intranet.
http://intranet.site.com.au externally redirects to a custom invalid/unknown subdomain page
http://extranet.site.com.au throws a browser not error
http://extranet.site.com.au:81 prompts for a username/password to access intranet.

Moving from standard Apache httpd install to virtual hosts

1. First you need to create an appropiate directory for virtual host. (Using the example of creating an intranet)

$ su –
$ useradd intranet
$ chmod 755 /home/intranet # needed for apache nobody process
$ cd /home/intranet
$ mkdir www logs
$ cd www
$ echo “<html>
<head>
<title>intranet test index</title>
</head><body></body></html>
” > index.htm

2. Second, you need to reconfig Apache Httpd for virtual host management.

$ cd /opt/httpd/conf
echo “Include conf/httpd.include” >> httpd.conf
$ vi httpd.include

NameVirtualHost 111.111.111.111
<VirtualHost 111.111.111.111>
    ServerAdmin [email protected]
    DocumentRoot /home/intranet/www
    ServerName intranet.site.com.au
    ServerAlias intranet
    LogLevel info
    ErrorLog /home/intranet/logs/error.log
    CustomLog /home/intranet/logs/access.log combined
</VirtualHost>

3. Reboot Apache Httpd

$ apachectl graceful

Configuring SSH for automated rsync

In order to rsync files between two servers in an automated sense, you need to setup an appropiate SSH key between both the source and destination servers.

Destination Server

$ cd
$ mkdir .ssh
$ chmod 700 .ssh

Source Server

$ cd
$ mkdir .ssh
$ chmod 700 .ssh
$ ssh-keygen -t rsa
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/userch/.ssh/id_rsa.pub.
$ scp id_rsa.pub [email protected]:.ssh

Destination Server

$ cd .ssh
$ cat id_rsa.pub >> authorized_keys
$ chmod 600 authorized_keys

Source Server
$ ssh [email protected]

Should it not work, and you are prompted with password the ‘-v’ option may provide some more information to diagnose the problem.

Throttling the CPU on my laptop

Using CentOS 4.1 as the Operating System on my laptop for all my work, I’ve been able to throttle down my CPU when running on battery power to extend my battery life, much like the modes that Windoze provides.

$ echo 5 > /proc/acpi/processor/CPU0/throttling

If you want to go back up again:

$ echo 0 > /proc/acpi/processor/CPU0/throttling

Not to be thrown, the output of this file looks like:


[root@lamda ~]# cat /proc/acpi/processor/CPU0/throttling
state count:             8
active state:            T7
states:
    T0:                  00%
    T1:                  12%
    T2:                  25%
    T3:                  37%
    T4:                  50%
   *T5:                  62%
    T6:                  75%
    T7:                  87%

Dell 5150 Wireless under CentOS 4.0

1. Download ndiswrapper from http://ndiswrapper.sourceforge.net/

2. Install
make
make install
lspci
lspci -n

3. Identify and download Windows Driver.

http://ndiswrapper.sourceforge.net/phpwiki/index.php/List

# Laptop: Dell Inspiron 5100
Card: Wireless 1350 (802.11b/g) WLAN miniPCI Card
Chipset: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 02) notice this is revision 02, below is revision 03, Idon’t know if it matters or not
pciid: 14e4:4320
Driver: http://ftp.us.dell.com/network/R90501.EXE
Other: This card is in the miniPCI slot of the Inspiron 5100. The driver below (R83097.exe) did not work, but this one did. To install unzip (program “unzip” works on the .exe) the exe file and use bcmwl5.inf.

Dell 5150 64MB DDR nVidia Corporation GeForce FX Go 5200 under CentOS 4.0

ftp://download.nvidia.com/XFree86/Linux-x86/1.0-7174/README.txt

Directly following the Fedora Core 3 installation I had to get the video to
work. Therefore, at boot time, I went into the grub config file by pressing “e”
and added the following to the end of the kernel line.

linux single

sh NVIDIA-Linux-x86-1.0-7174-pkg1.run
vi etc/X11/xorg.conf

Driver “nv”
(or Driver “vesa”)

with

Driver “nvidia”

In the Module section, make sure you have:

Load “glx”

You should also remove the following lines:

Load “dri”
Load “GLcore”

Reference:

http://www.ccs.neu

Development Software Suite As At 26 June 2004

Java J2SDK 1.4.2_4 http://java.sun.com/j2se/1.4.2/download.html
Tomcat 5.0.25 http://jakarta.apache.org/site/binindex.cgi
JSTL 1.1 http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html
MySQL 5.0.20 http://dev.mysql.com/downloads/mysql/4.0.html

Apache HTTP 2.0.49 http://httpd.apache.org/download.cgi
PHP 4.3.7 http://www.php.net/downloads.php
PHPMyAdmin 2.5.7 http://www.phpmyadmin.net/

Eclipse 3.0 http://eclipse.org/downloads/index.php

Eclipse 3.0 was released today.
PHP 5.0 is in RC3
MySQL 4.1.2 is still in Alpha

Adding a second IP address to Linux Server

If say you want to run apache and tomcat both on port 80 (default), you can create a seperate IP address on an internal network.

For RedHat Distros

$ cd /etc/sysconfig/network-scripts/
$ more ifcfg-eth0:0

DEVICE=”eth0:0″
BOOTPROTO=”none”
ONBOOT=”yes”
IPADDR=”XXX.XXX.XXX.XXX”
NETMASK=”255.255.254.0″
BROADCAST=”XXX.XXX.XXX.255″

$ ifup-aliases eth0

Changing A Server's Timezone

For RedHat 9

$ redhat-config-date (except this requires X)

or

$ clock
$ rm /etc/localtime
$ ln -s /usr/share/zoneinfo/Australia/Brisbane /etc/localtime
$ /usr/bin/rdate -s time.nist.gov
$ /sbin/hwclock –systohc

The last two commands can be added to cron for regular syncing with running ntp

0,30 * * * * /usr/bin/rdate -s time.nist.gov >/dev/null 2>&1
1,31 * * * * /sbin/hwclock –systohc >/dev/null 2>&1