Friday, October 03, 2003
Compiling Ximian Evolution

I downloaded following source tarrballs (17396 KB) (1909 KB)

$ tar -xvzf evolution-1.4.5.tar.gz
$ tar -xvzf db-3.1.17.tar.gz
$ cd db-3.1.17/build-unix
I've red db-3.1.17/docs/ref/build_unix/intro.html :)
$ mkdir /home/andrej/4Install/evolution/berkleydb
$ ../dist/configure --prefix=/home/andrej/4Install/evolution/berkleydb
... lots of output
According to evolution-1.4.5/README I'll need berkleydb instalation only temporary because evolution will static link db3 libs.
$ make
.... lots of output
$ make install
Installing DB include files: /home/andrej/4Install/evolution/berkleydb/include ...
Installing DB library: /home/andrej/4Install/evolution/berkleydb/lib ...
Installing DB utilities: /home/andrej/4Install/evolution/berkleydb/bin ...
Installing documentation: /home/andrej/4Install/evolution/berkleydb/docs ...
$ cd ../../

lot's of stuff have to be done before this, it's much easier to download and install rpm provided by ximian
by typing
# wget -q -O - |sh
logged as root (see

$ ./configure --with-db3-includes=/home/andrej/4Install/evolution/berkleydb/include --with-db3-libs=/home/andrej/4Install/evolution/berkleydb/lib

Wednesday, October 01, 2003
Owning MySQL

After a short adventure with PostgreSQL I decided to download and install MySQL binary distribution. Binary tarball is called mysql-standard-4.0.15-pc-linux-i686.tar.gz which extracts (tar -xvzf mysql-standard-4.0.15-pc-linux-i686.tar.gz) directory called (what a coincidence!) mysql-standard-4.0.15-pc-linux-i686.
I found for install instructions in file INSTALL-BINARY. After short reading I did exactly what it says and that is (copy-pasted with output and my comments);
shell> groupadd mysql
shell> useradd -g mysql mysql
I already have that group and user so I didn't type those two entries ...
check this by typing:
# grep mysql /etc/passwd
mysql:x:76:76:MySQL server:/var/lib/mysql:/bin/bash
# grep mysql /etc/group
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
I did $ mv /home/andrej/4Install/mysql/mysql-standard-4.0.15-pc-linux-i686 .
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
031001 18:33:37 ./bin/mysqld: Shutdown Complete

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

This is done with:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h andrej password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at

shell> chown -R root .
...changed owner of /usr/local/mysql directory to root
shell> chown -R mysql data
...changed owner of /usr/local/mysql/data directory to mysql. Obviously here will be placed data files.
shell> chgrp -R mysql .
....changed group of /usr/local/mysql directory to mysql
shell> bin/mysqld_safe --user=mysql &
shell> bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x
!??? What's the difference? :)
Instead of typing last two entries I'm going to examine support-files/mysql.server mentioned in scripts/mysql_install_db output. I think I have to copy this script in /etc/init.d directory and link it into /etc/rc5.d/ for a boot time.
Yes! I was right. It says:
Usually this is put in /etc/init.d (at least on machines SYSV R4 based
systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
/etc/rc3.d is a good choice if I want to boot my box in text mode. I'll try to do it trough runlevel editor provided by distribution. So I just have to type:
# cp support-files/mysql.server /etc/init.d
And run runlevel editor which will make the links. I it fails just type:
# ln -s /etc/init.d/mysql.server /etc/rc3.d/S99mysql
# ln -s /etc/init.d/mysql.server /etc/rc0.d/K01mysql
Explanation about this can be found in INIT.D - The S.u.S.E. boot concept man page with a small change where directory /sbin/init.d becomes /etc/init.d. First red it in SuSE 8.0 manual (ah good old times).
I don't want to reboot so I type:
# /etc/init.d/mysql.server start
Starting mysqld daemon with databases from /usr/local/mysql/data
... and check is it really running
# ps -ax |grep mysql
12328 pts/2 S 0:00 /bin/sh ./bin/mysqld_safe --datadir=/usr/local/mysql/
12347 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12348 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12349 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12350 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12351 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12352 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12353 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12354 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12355 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12356 pts/2 S 0:00 /usr/local/mysql/bin/mysqld --defaults-extra-file=/us
12366 pts/2 R 0:00 grep mysql
... and test can it stop
# /etc/init.d/mysql.server stop
Killing mysqld with pid 12356
Wait for mysqld to exit\c
031002 09:55:15 mysqld ended

# ps -ax |grep mysql
12388 pts/2 S 0:00 grep mysql
It works so i typed again first line (# /etc/init.d/mysql.server start) to make it running

I decide not to bother with server and install MySQL Control center source tarball to make all settings in GUI :)
This file (mysqlcc-0.9.3-src.tar.gz) is standard source tarball and they are always installable by this set of shell commands
$ cd /my/install/dir/mysqlcc
$ tar -xvzf mysqlcc-0.9.3-src.tar.gz
$ cd mysqlcc-0.9.3-src
$ vi INSTALL.txt
INSTALL.txt at line 171 says:
$ ./configure
checking build system type... i686-pc-linux-g++
checking host system type... i686-pc-linux-g++
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for compress in -lz... yes
checking for libmysqlclient...
checking for "/usr/lib/libmysqlclient.a"... no
checking for "/usr/lib/mysql/libmysqlclient.a"... no
checking for "/usr/local/lib/libmysqlclient.a"... no
checking for "/usr/local/lib/mysql/libmysqlclient.a"... no
checking for "/usr/local/mysql/lib/libmysqlclient.a"... yes
checking for mysql_real_connect in -lmysqlclient... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for mysql.h...
checking /usr/include/mysql.h usability... no
checking /usr/include/mysql.h presence... no
checking for /usr/include/mysql.h... no
checking /usr/include/mysql/mysql.h usability... no
checking /usr/include/mysql/mysql.h presence... no
checking for /usr/include/mysql/mysql.h... no
checking /usr/local/include/mysql.h usability... no
checking /usr/local/include/mysql.h presence... no
checking for /usr/local/include/mysql.h... no
checking /usr/local/include/mysql/mysql.h usability... no
checking /usr/local/include/mysql/mysql.h presence... no
checking for /usr/local/include/mysql/mysql.h... no
checking /usr/local/mysql/include/mysql.h usability... yes
checking /usr/local/mysql/include/mysql.h presence... yes
checking for /usr/local/mysql/include/mysql.h... yes
checking "if MySQL Version /usr/local/mysql/include is >= 4.0.0"... yes
checking "if Qt Version in /home/andrej/kde3.1 is >= 3.0.5"... yes
configure: creating ./config.status
config.status: creating
Creating Makefile with qmake
Makefile created, now run make
$ make
g++ -c -pipe -Wall -W -O2 -pipe -D_REENTRANT -DQT_DLL -DHAVE_MYSQLCC_CONFIG -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I/home/andrej/kde3.1/mkspecs/linux-g++ -I. -Iinc ....
... blah blah blah
This output is important only if there is a ***ERROR***
The best way to fix it is to paste the error in Google and search for solution
But, there is no error, and no instruction how to run it, so I try to find executable:
ls -lR |grep '\-rwx'
-rwxr-xr-x 1 andrej andrej 31365 Ruj 3 22:20 config.guess*
-rwxr-xr-x 1 andrej andrej 23485 Lis 2 10:11 config.status*
-rwxr-xr-x 1 andrej andrej 27083 Ruj 3 22:20 config.sub*
-rwxr-xr-x 1 andrej andrej 121072 Ruj 3 22:20 configure*
-rwxr-xr-x 1 andrej andrej 2221211 Lis 2 10:24 mysqlcc*
Oh here is mysqlcc binary!
$ mysqlcc
GUI...Cool! ... UPS!
Segmentation fault
After a while I figure that mysql server is not started. What a debug message!
$ sudo /etc/init.d/mysql.server start
$ mysqlcc
Now everything works!
In GUI I said:
Name: local
Host: localhost
User name: root
Password: (I leave it blank (!!!!) )

From now on I refer to /usr/local/mysql/docs/manual.html and quite easy mysqlcc GUI (I have not found any free documentation for mysqlcc)


PS & VERY IMPORTANT: For jdbc connectivity you have to type in mysqlcc SQL window following command
GRANT ALL PRIVILEGES ON *.* to 'root'@'localhost.localdomain' identified by '[password]'
Or create user root on localhost.localdomain host by mysqlcc GUI
"Mastering" Postmaster

This blog describes my attempt to make postgresql server work with JDBC driven app on Linux.
There is nothing about install because I install it using distro control center (RPM packages). If I like it I'll install it from tarball provided by and describe the way I did it. For now, first README I was pointed to is README.mdk:

HOWTO use the PostgreSQL server in few steps
by Christian Belisle

This file is included with the Mandrake PostgreSQL's packages.

After you installed the packages, here is the procedure to
start quickly but nicely.

1- Become root user on your machine. (su)
2- Become postgres user. (su postgres)
3- Create a user (createuser)
4- Be sure that the postmaster is running (service postgresql status)
5- Logout from the postgres and the root account.
6- Test it. (psql -U [username])

As I expect, installation doesn't start the server so I have to look in /etc/init.d/ and find postgresql shell script which attempts to start it using the line:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p /usr/bin/postmaster -o '-i' start > /dev/null 2>&1" < /dev/null
Where su -l postgres -s /bin/sh -c means: Run following command logged as user postgres with /bin/sh shell (man su(1)), and the following command is
"/usr/bin/pg_ctl -D $PGDATA -p /usr/bin/postmaster -o '-i' start > /dev/null 2>&1" where pg_ctl is a utility for starting, stopping, or restarting postmas-
ter(1), the PostgreSQL backend server, or displaying the status of a running postmaster (man pg_ctl(1)) called with parameters:
-D $PGDATA (earlier in the postgresql shell script PGDATA=/var/lib/pgsql/data)
Specifies the file system location of the database files. If this is omitted, the environment variable PGDATA is used. (man pg_ctl(1))
-p /usr/bin/postmaster
Specifies the location of the postmaster executable
-o '-i' (I added postmaster parameter -i because I want postmaster to be TCP/IP aware)
Specifies options to be passed directly to postmaster.
start - command to tell pg_ctl to start postmaster

So... first thing before applying README.mdk I started postgresql:
# /etc/init.d//postgresql start
And do the
# su postgres
$ createuser andrej
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
$ ^D
# ^D
(now I become andrej user)
$ createdb swingset (!!! this is not in README.mdk !!!)
$ psql swingset
Welcome to psql, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

(Cool! I succeed!)
swingset=# create table supplier_data (supplier_id numeric, supplier_name char(50), city char(50), status numeric);
I need a table for testing JDBC driver, and SwingSet package locally, and of course Sun's rowset implementation, and postgresql jdbc driver .

Now Java part:
I altered line describing the connection in source file downloaded from
conn = DriverManager.getConnection("jdbc:postgresql://","swingset","test");
conn = DriverManager.getConnection("jdbc:postgresql://localhost/swingset","andrej","");
and later in the source I changed:
navigator.setModification(false) to navigator.setModification(true);

After compiling and running (I did it trough NetBeans IDE) driver complains:
No pg_hba.conf entry for host, user andrej, database swingset

I found pg_hba.conf in PGDATA directory (/var/lib/pgsql/data, remember startup script), and, after reading documentation provided in this file, added entry:
host all trust
This directory also contains postgresql.conf file where I can put line:
tcpip_socket = true
and delete -o '-i' option from /etc/init.d/postgresql script, because this is recommended by man postmaster(1).

Documentation (in order of appearance):
* /usr/share/doc/postgresql-server-7.2.2/README.mdk
* man su(1)
* man pg_ctl(1)
* man postmaster(1)
* ( swingset-src_0.5.0_alpha.jar:SwingSet-src_0.5.0_alpha/readme.txt


Powered by Blogger