MySQL 5 differences

Just a note, while MySQL provide a list of Version 5 Features (Official Data Sheet), I’ve so far found a few small things.

mysql> DESC [table], the Null column now shows NO when it was blank

When you grant ALL to a user, it’s gets CREATE VIEW privilege, but when upgrading, you have to manually specify the privilege for previous users that had grant ALL>

Some OUTER JOINS no longer work

MySQL 5 Production Release

MySQL has offically released Version 5 (5.0.15).

Just installed over the RC (5.0.13) and restarted had my development machine working fine, however now I need to more closely investigate 2 complicated queries with Outer Joins that no longer work between 4 and 5, and 2 update queries that have crashed my 5.0.13 install.

The following steps were used to upgrade from 4 to 5.0.13

MYSQL=mysql-standard-5.0.13-rc-linux-i686
cp $MYSQL.tar.gz /opt
cd /opt
tar xvfz $MYSQL.tar.gz
/etc/rc.d/init.d/mysql stop
ps -ef | grep mysql
rm -f mysql
ln -s $MYSQL mysql
cp -r $OLD/data/ mysql

du mysql/data

chown -R root /opt/mysql
chown -R mysql /opt/mysql/data
chgrp -R mysql /opt/mysql
chown -R root /opt/mysql/bin
/etc/rc.d/init.d/mysql start
ps -ef | grep mysql

/opt/mysql/bin/mysql_fix_privilege_tables –basedir=/opt/mysql –password=******

mysql -uroot -p mysql
show tables;

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.

Brisbane MySQL Users Group

By accident I came across a MySQL Users Group in Brisbane .http://mysql.meetup.com/84/. I guess I should have thought about it sooner, I go to the QLD Java Users Group, I spent a long time going to the Oracle Users Group, and have been involved in an XP Users group.

Anyway, it was great to meet with other MySQL users, meet some local MySQL staff, get some inside news of events and products.
There was also a presentation on Ruby, yet another scripting language. The software creator had however introduced some nice features including build-in Unit Tests with the release, easy inspection of class methods, easy extensibility of system classes. The langauge architecture was very inteperative, based in C, however all system functions are provided and run from Ruby source.

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