Ports offer more flexibility than package in general but when dealing with size I prefer using package 🙂
My common question when see this on freebsd ports page :
to get mysql support on php, I must install mysql-client-5.0.41 thats means I must install mysql5 server too if I decide to install mysql in my server, I prefer to install mysql4. Is it possible?
I’m luckly, freebsd ports offer flexible options, simple trick to use mysql 4.0.27 with php4 is installing mysql4 server first.
after installing mysql server version 4 then php4-mysql will use mysql4-client automatically.
with this option some options for favorit mysql version available, depend on you.
-bash-2.05b$ cd /usr/ports/databases/
-bash-2.05b$ ls | grep mysql
aolserver-nsmysql
courier-authlib-mysql
dbf2mysql
erlang-mysql
fpc-mysql
gmysql
kmysqladmin
mrtg-mysql-load
mysql++
mysql++1
mysql-connector-java
mysql-connector-odbc
mysql-editor
mysql-navigator
mysql-query-browser
mysql2odbc
mysql2pgsql
mysql323-client
mysql323-scripts
mysql323-server
mysql40-client
mysql40-scripts
mysql40-server
mysql41-client
mysql41-scripts
mysql41-server
mysql50-client
mysql50-scripts
mysql50-server
mysql51-client
mysql51-scripts
mysql51-server
mysql_last_value
mysqlard
mysqlcc
mysqlcppapi
mysqlman
mysqlreport
mysqlsla
mysqltcl
p5-Class-DBI-mysql
p5-DBD-mysql
p5-DBD-mysql40
p5-DBD-mysql41
p5-DBD-mysql50
p5-DBD-mysql51
pear-MDB2_Driver_mysql
pear-MDB2_Driver_mysqli
php4-mysql
php5-mysql
php5-mysqli
php5-pdo_mysql
qt-mysql-plugin
qt4-mysql-plugin
ruby-dbd_mysql
ruby-mysql
xmysqladmin
wow, large
I need only server
-bash-2.05b$ ls | grep mysql.*-server
mysql323-server
mysql40-server
mysql41-server
mysql50-server
mysql51-server
Lets try it out :
1. Check installed ports
proxy# pkg_info
autoconf-2.59_2 Automatically configure source code on many Un*x platforms
cvsup-without-gui-16.1h_2 General network file distribution system optimized for CVS
daemontools-0.76_12 Service monitoring and logging utilities by djb
db41-4.1.25_3 The Berkeley DB package, revision 4.1
djbdns-1.05_10 A collection of secure and reliable DNS tools
fusefs-kmod-0.3.0_4 Kernel module for fuse
fusefs-libs-2.6.2 FUSE allows filesystem implementation in userspace
fusefs-sshfs-1.7 Mount remote directories over ssh
gettext-0.16.1 GNU gettext package
glib-2.12.11 Some useful routines of C programming (current stable versi
gmake-3.81_1 GNU version of ‘make’ utility
help2man-1.36.4_1 Automatically generating simple manual pages from program o
libiconv-1.9.2_2 A character set conversion library
libtool-1.5.22_4 Generic shared library support script
linux_base-fc-4_9 Base set of packages needed in Linux mode (for i386/amd64)
lynx-2.8.5_2 A non-graphical, text-based World-Wide Web client
m4-1.4.8_1 GNU m4
p5-gettext-1.05_1 Message handling functions
perl-5.8.8 Practical Extraction and Report Language
pkg-config-0.21 A utility to retrieve information about installed libraries
portupgrade-2.1.3.3_1,2 FreeBSD ports/packages administration and management too l s
rdate-1.1 Sets the clock of the local host to the time of another hos
ruby-1.8.5_3,1 An object-oriented interpreted scripting language
ruby18-bdb-0.5.9_2 Ruby interface to Sleepycat’s Berkeley DB revision 2 or lat
squid-2.6.12 HTTP Caching Proxy
ucspi-tcp-0.88_2 Command-line tools for building TCP client-server applicati
proxy# pkg_info
autoconf-2.59_2 Automatically configure source code on many Un*x platforms
cvsup-without-gui-16.1h_2 General network file distribution system optimized for CVS
daemontools-0.76_12 Service monitoring and logging utilities by djb
db41-4.1.25_3 The Berkeley DB package, revision 4.1
djbdns-1.05_10 A collection of secure and reliable DNS tools
fusefs-kmod-0.3.0_4 Kernel module for fuse
fusefs-libs-2.6.2 FUSE allows filesystem implementation in userspace
fusefs-sshfs-1.7 Mount remote directories over ssh
gettext-0.16.1 GNU gettext package
glib-2.12.11 Some useful routines of C programming (current stable versi
gmake-3.81_1 GNU version of ‘make’ utility
help2man-1.36.4_1 Automatically generating simple manual pages from program o
libiconv-1.9.2_2 A character set conversion library
libtool-1.5.22_4 Generic shared library support script
linux_base-fc-4_9 Base set of packages needed in Linux mode (for i386/amd64)
lynx-2.8.5_2 A non-graphical, text-based World-Wide Web client
m4-1.4.8_1 GNU m4
p5-gettext-1.05_1 Message handling functions
perl-5.8.8 Practical Extraction and Report Language
pkg-config-0.21 A utility to retrieve information about installed libraries
portupgrade-2.1.3.3_1,2 FreeBSD ports/packages administration and management tool s
rdate-1.1 Sets the clock of the local host to the time of another hos
ruby-1.8.5_3,1 An object-oriented interpreted scripting language
ruby18-bdb-0.5.9_2 Ruby interface to Sleepycat’s Berkeley DB revision 2 or lat
squid-2.6.12 HTTP Caching Proxy
ucspi-tcp-0.88_2 Command-line tools for building TCP client-server applicati
proxy#
2. Update ports to latest
proxy# csup -g -L2 ports-supfile -h cvsup12.freebsd.org
Parsing supfile "ports-supfile"
Connecting to cvsup12.freebsd.org
Cannot connect to 2001:468:902:201:209:3dff:fe11:442c: No route to host
Connected to 128.205.32.21
Server software version: SNAP_16_1h
Negotiating file attribute support
Exchanging collection information
Establishing multiplexed-mode data connection
Running
…………………………………………….
……………………………………………………………..
3. Update index
Edit ports/x11-wm/twm/pkg-plist
Add delta 1.2 2007.05.30.23.59.32 lesi
Shutting down connection to server
Finished successfully
proxy# cd /usr/ports/ && make fetchindex
/usr/ports/INDEX-6.bz2 100% of 1104 kB 8572 Bps 00m00s
4. Try install php4-mysql first
proxy# whereis php4-mysql
php4-mysql: /usr/ports/databases/php4-mysql
proxy# cd /usr/ports/databases/php4-mysql/ && make fetch
5. Ups, forgot avoid X-11
proxy# echo ‘WITHOUT_X11=yes’ >> /etc/make.conf
6. Continue to build
===> Vulnerability check disabled, database not found
===> Found saved configuration for php4-4.4.7
=> suhosin-patch-4.4.7-0.9.6.patch.gz doesn’t seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://www.hardened-php.net/suhosin/_media/.
suhosin-patch-4.4.7-0.9.6.patch.gz 100% of 21 kB 20 kBps
===> Extracting for php4-4.4.7
=> MD5 Checksum OK for php-4.4.7.tar.bz2.
=> SHA256 Checksum OK for php-4.4.7.tar.bz2.
=> MD5 Checksum OK for suhosin-patch-4.4.7-0.9.6.patch.gz.
=> SHA256 Checksum OK for suhosin-patch-4.4.7-0.9.6.patch.gz.
===> Patching for php4-4.4.7
===> Applying distribution patches for php4-4.4.7
===> Applying FreeBSD patches for php4-4.4.7
===> php4-4.4.7 depends on file: /usr/local/sbin/apxs – not found
===> Verifying install for /usr/local/sbin/apxs in /usr/ports/www/apache13
===> Vulnerability check disabled, database not found
=> apache_1.3.37.tar.gz doesn’t seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://www.apache.org/dist/httpd/.
apache_1.3.37.tar.gz 23% of 2602 kB 86 kBps
………………………………………………………………………
===> Returning to build of php4-mysql-4.4.7
===> php4-mysql-4.4.7 depends on file: /usr/local/bin/autoconf259 – found
===> php4-mysql-4.4.7 depends on shared library: mysqlclient.15 – not found
===> Verifying install for mysqlclient.15 in /usr/ports/databases/mysql50-client
===> Vulnerability check disabled, database not found
=> mysql-5.0.41.tar.gz doesn’t seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from ftp://ftp.easynet.be/mysql/Downloads/MySQL-5.0/.
mysql-5.0.41.tar.gz 3% of 22 MB 67 kBps 05m37s
fetch: transfer interrupted
Ups, I dont want mysql 5, I want mysql 4
Press CTRL +C
7. Build & install mysql40-server first
proxy# cd /usr/ports/databases/mysql40-server/ && make install
===> Vulnerability check disabled, database not found
You may use the following build options:
WITH_CHARSET=charset Define the primary built-in charset (latin1).
WITH_XCHARSET=list Define other built-in charsets (may be ‘all’).
WITH_OPENSSL=yes Enable secure connections.
WITH_LINUXTHREADS=yes Use the linuxthreads pthread library.
WITH_PROC_SCOPE_PTH=yes Use process scope threads
(try it if you use libpthread).
BUILD_OPTIMIZED=yes Enable compiler optimizations
(use it if you need speed).
BUILD_STATIC=yes Build a static version of mysqld.
(use it if you need even more speed).
WITHOUT_INNODB=yes Disable support for InnoDB table handler.
===> Extracting for mysql-server-4.0.27
=> MD5 Checksum OK for mysql-4.0.27.tar.gz.
=> SHA256 Checksum OK for mysql-4.0.27.tar.gz.
……………………………………………….
…………………………………………………………
Added group "mysql".
Added user "mysql".
install-info –quiet /usr/local/info/mysql.info /usr/local/info/dir
===> Installing rc.d startup script(s)
===> Compressing manual pages for mysql-server-4.0.27
===> Registering installation for mysql-server-4.0.27
===> SECURITY REPORT:
This port has installed the following files, which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld
This port has installed the following startup scripts, which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type ‘make deinstall’
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.mysql.com/
8. Check in pkg_info
proxy# pkg_info | grep mysql
mysql-client-4.0.27 Multithreaded SQL database (client)
mysql-server-4.0.27 Multithreaded SQL database (server)
9. Try again, install php4-mysql
proxy# cd /usr/ports/databases/php4-mysql/ && make install
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
===> Installing for php4-mysql-4.4.7
===> php4-mysql-4.4.7 depends on file: /usr/local/include/php/main/php.h – found
===> Generating temporary packing list
===> Checking if databases/php4-mysql already installed
===> Registering installation for php4-mysql-4.4.7
****************************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini
configuration file to automatically load the installed extension:
extension=mysql.so
10. php4-mysql installed ?
proxy# pkg_info | grep mysql
mysql-client-4.0.27 Multithreaded SQL database (client)
mysql-server-4.0.27 Multithreaded SQL database (server)
php4-mysql-4.4.7 The mysql shared extension for php
Great, I can use my favorite mysql version (4.0.27) instead 5.0 version.
I think I can use mysql323-server, mysql40-server,mysql41-server,mysql50-server and mysql51-server with spesific options like linuxthreads etc.
after install one of these server then follow by install php4-mysql or other ports that require mysql as dependency.
I still figured out this option in ubuntu, since apt-get only offer mysql41 or mysql5 not mysql40
doing it in source tar.gz way no more fancy for me for upgrading and maintenance reason.
why mysql40? I still confident using mysql4.0.27 as google too 🙂 when they offer patch for mysql4.0.26
FreeBSD rocks 🙂