Fedora

Compile PHP on Fedora

Below is an outline on how to compile a feature rich, PHP Apache module on Fedora 9. First, compile Apache on the system using these instructions. This document assumes that Apache and the APache eXtenSion Tool are installed in the PREFIX: /opt/apache2.

Once you have Apache prepared, download the PHP source from php.net. As of August, 2008 the latest version is PHP 5.2.6. So, the following examples will use the php-5.2.6.tar.gz source tarball. Use your browser to download the latest and greatest. Then, untar the source.

tar -xzvf php-5.2.6.tar.gz
cd php-5.2.6

Next, configure the source for compile. Use the configure command. You can provide --help to see the large list of options.

./configure --help

For every option you enable, make sure you have the necessary RPMs installed to build PHP. For example, if you run configure with --with-snmp, you will need the net-snmp-devel RPM installed to complete the build. To ensure that you can build PHP with a full suite of options, install the following RPMs. Trim the list to suit your needs.

yum install aspell-devel curl-devel cyrus-sasl-devel e2fsprogs-devel freetype-devel glibc-devel keyutils-libs-devel krb5-devel libgcc libidn-devel libjpeg-devel libpng-devel libselinux-devel libsepol-devel libstdc++-devel libX11-devel libXau-devel libXdmcp-devel libxml2-devel libXpm-devel mysql-devel net-snmp-devel openldap-devel openssl-devel tcp_wrappers zlib-devel

Then, configure with the following settings. Change the configure --prefix to adjust your install PREFIX. Again, trim the list to suit your needs.

./configure --prefix=/opt/php5 --with-apxs2=/opt/apache2/apxs --with-mysql=/usr/bin/mysql_config --with-mysqli=/usr/bin/mysql_config --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --enable-safe-mode --enable-magic-quotes --with-pspell --with-gettext --with-jpeg-dir=/usr --with-zlib --with-curl --enable-soap --with-ldap=/usr --enable-sockets --with-openssl --with-snmp --enable-mbstring --with-freetype-dir=/usr --with-xpm-dir=/usr --with-libdir=lib64

Please note that if you are on a 32bit system, remove:

--with-libdir=lib64

Finally, build PHP and test it.

make
make test

If you are comfortable with the results (a few errors are OK in make test), then install PHP.

sudo make install

The install will place the PHP module in /opt/apache2/modules and prepare /opt/apache2/conf/httpd.conf with these settings:

LoadModule php5_module modules/libphp5.so

Then, place a php.ini in /opt/php5/lib (or your PREFIX/lib).

cp -a php.init-recommended /opt/php5/lib/php.ini

Finally, prepare your Apache Virtual Host to support index.php with the following code:

AddType application/x-httpd-php .php .inc .class
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.php

Refer to PHP.net and Apache.org for reference.

Fedora Apache Quickstart

If you are running Fedora and need Apache's HTTP web server, you have a couple of options. One, you can install Fedora's pre-built RPMs. Two, you can compile Apache to meet your specific needs.

Compiling Apache can improve performance and security. But, if you are starting out or need to get up and running quickly, use Fedora's RPMs.

Quick Install

To quickly install Fedora's Apache packages, install the 'Web Server' Yum group. This will install HTTPD with support for PHP, mod_perl, mod_ssl, and mod_python. The Web Server group also contains squid and weblizer.

yum groupinstall "Web Server"

If you want more control over the packages you need, install them one at a time. First, install HTTPD and then add on the modules you need.

yum install httpd
yum install mod_ssl mod_python

Apache Configuration

If you are feeling lazy and want to use a GUI, Fedora provides a graphical interface for configuring Apache. Install system-config-httpd:

yum install system-config-httpd

Then, run the tool as root:

/usr/bin/system-config-httpd

You can also configure the httpd.conf file manually. See the Apache documentation for details on how to configure your web server.

vim /etc/httpd/conf/httpd.conf
vim /etc/httpd/conf.d/README

Start Apache

You can set Apache to start at boot using chkconfig:

chkconfig httpd on

Finally, start Apache with the service command:

service httpd start

For more information, see Fedora's official documentation or the Fedora Documentation Project's Wiki.

Fedora 9 Perlcc

As of version 5.10.0-RC2, Perlcc is no longer distributed with Perl. This means that Fedora 9 does not include perlcc. Here is the official statement regarding perlcc from CPAN.org:

Removal of the bytecode compiler and of perlcc

perlcc, the byteloader and the supporting modules (B::C, B::CC, B::Bytecode, etc.) are no longer distributed with the perl sources. Those experimental tools have never worked reliably, and, due to the lack of volunteers to keep them in line with the perl interpreter developments, it was decided to remove them instead of shipping a broken version of those. The last version of those modules can be found with perl 5.9.4.

However the B compiler framework stays supported in the perl core, as with the more useful modules it has permitted (among others, B::Deparse and B::Concise).

Sources
CPAN.org: perldelta - what is new for perl 5.10.0

Fedora 9 Nvidia

Fedora 9 comes with two drivers that can be used in /etc/X11/xorg.conf to support your Nvidia card.

  1. NV: http://xorg.freedesktop.org/wiki/nv
  2. Nouveau: http://nouveau.freedesktop.org/wiki/

Although these two drivers work, they have their limitations. It is best to install the Nvidia driver from Nvidia.com. You can either build the source from Nvidia's Driver Website, or use Livna.org to install a binary kernel module.

Livna's Binary Nvidia Driver

To use Livna.org's binary driver, install Livna's release package for Fedora 9. This will provide you with access to Livna.org's Fedora 9 YUM repository using /etc/yum.repos.d/livna.repo.

rpm -ivh http://rpm.livna.org/livna-release-9.rpm

Next, install the Nvidia kernel module and all of it's dependencies:

sudo yum install kmod-nvidia

Then, use the nvidia-xconfig script to configure /etc/X11/xorg.conf. This will configure /etc/X11/xorg.conf with the 'nvidia' driver and it's options.

sudo /usr/sbin/nvidia-xconfig

Finally, reboot your system. You should see the Nvidia driver loading during boot. If you have any X errors, check /var/log/Xorg.log. If you want to tweak your driver, OpenGL or display settings, use nvidia-settings.

sudo /usr/bin/nvidia-settings

Fedora Source RPM

So, you want to rebuild a Fedora package from source using a src.rpm file? Maybe make some tweaks along the way? This is how.

Quick Prerequisites Check

First, make sure you have yum-utils and rpmdevtools installed

sudo yum -y install yum-utils rpmdevtools

Next, configure your user's .rpmmacros file. Use your username, not root! Edit ~/.rpmmacros and add these lines:

%_topdir %(echo $HOME)/rpmbuild
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot

The first line, indicates the rpm build top directory. Then, we add some some post install commands. Systems with SMP enabled should also add the following to enable parallel compiles during builds. Adjust the job number to be the number of CPU cores available. In my example, two.

%_smp_mflags -j2

I also like to format my rpm query string so that architecture is part of the name:

%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

To review, here is my .rpmmacros file:

%_topdir %(echo $HOME)/rpmbuild
%_smp_mflags -j2
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

Get the Source

Build the rpmbuild folder and it's subfolders using rpmdev-setuptree from the rpmdevtools package. Note that you can also wipe ~/rpmbuild clean with /usr/bin/rpmdev-wipetree.

/usr/bin/rpmdev-setuptree

Then, cd into ~/rpmbuild/SRPMS and use yumdownloader (part of yum-utils) to download the source code. In the following example, I am downloading httpd.

cd ~/rpmbuild/SRPMS/
yumdownloader --source httpd

Build the Source

Use yum-builddep as root to install all packages needed to build the source RPM. The yum-builddep tool is part of the yum-utils package.

sudo yum-builddep httpd-2.2.8-3.src.rpm

You have two options when compiling the RPM from source. One, you just rebuild the src.rpm as-is. This will drop a binary RPM in ~/rpmbuild/RPMS/$(arch):

rpmbuild --rebuild httpd-2.2.8-3.src.rpm

Otherwise, if you want to make changes to the source RPM's spec file, first install the source RPM:

rpm -ivh httpd-2.2.8-3.src.rpm

Now you can edit the spec file in ~/rpmbuild/SPECS and build a binary package using the edited spec file:

cd ~/rpmbuild
vim SPECS/httpd.spec
rpmbuild -bb SPECS/httpd.spec

To also build a new source RPM from your edited SPEC, use rpmbuild -bs

rpmbuild -bs SPECS/httpd.spec

Again, binary RPMs are produced in ~/rpmbuild/RPMS/$(arch).

Sources

FedoraProject.org: Docs/CustomKernel
HowToForge.com: How To Compile A Kernel - The Fedora Way

Fedora MP3 Support

Fedora 9 does not release native support for MP3, so you need to get the right bits from another source like rpm.livna.org. First, install Livna's release package for Fedora 9. This will provide you with access to Livna.org's Fedora 9 YUM repository using /etc/yum.repos.d/livna.repo.

rpm -ivh http://rpm.livna.org/livna-release-9.rpm

Now, for XMMS MP3 support, install xmms and xmms-mp3

yum install xmms xmms-mp3

For Amarok MP3 support, install amarok and amarok-extras-nonfree.

yum install amarok amarok-extras-nonfree

For xine with MP3 support, install xine and xine-lib-extras-nonfree

yum install xine xine-lib-extras-nonfree

To create MP3s with LAME, install lame and lame-mp3x

yum install lame lame-mp3x

Fedora Codec Installation

If you just need MP3 support, you might want to start here. Otherwise, I recommend using Livna.org's MPLayer package with the codecs found at http://www.mplayerhq.hu.

Install Livna's release package for Fedora 9. This will provide you with access to Livna.org's Fedora 9 YUM repository using /etc/yum.repos.d/livna.repo.

rpm -ivh http://rpm.livna.org/livna-release-9.rpm

Install mplayer from Livna.org.

sudo yum -y install mplayer

Now, visit the MPlayer Codecs Directory and download the latest 'All' tarball.

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2

Next, prepare the codecs folder. MPlayer from Livna.org will use /usr/lib/codecs.

sudo mkdir -p /usr/lib/codecs

Other media players like Xine and avifile might use /usr/lib/win32, so create a symlink.

sudo ln -s /usr/lib/codecs /usr/lib/win32
ls -l /usr/lib/win32
lrwxrwxrwx 1 root root 15 2008-05-24 08:02 /usr/lib/win32 -> /usr/lib/codecs

Finally, extract the contents of the tarball and copy all files to /usr/lib/codecs.

tar -xjvf all-20071007.tar.bz2
sudo cp -a all-20071007/* /usr/lib/codecs/

See the MPlayer(1) man page for /usr/bin/mplayer usage.

man 1 mplayer

Firefox i386 on FC9 x86_64

Fedora 9 does not provide the i386 Firefox package in the x86_64 YUM repositories. So, if you need a 32-bit browser on your 64-bit Fedora 9 installation, you will need to add new YUM repositories. Start by creating /etc/yum.repos.d/fedora-i386.repo with the following contents:

[fedora-i386]
name=Fedora $releasever - i386
failovermethod=priority
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/i386/os/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=i386
enabled=1
gpgcheck=1
includepkgs=firefox
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
#
[updates-i386]
name=Fedora $releasever - i386 - Updates
failovermethod=priority
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/i386/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=i386
enabled=1
gpgcheck=1
includepkgs=firefox
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

This will provide you with access to the Fedora 9 i386 Yum repositories for Firefox only (note includepkgs=firefox). Now, remove your 64-bit Firefox RPM.
sudo rpm -e firefox.x86_64

Finally, install the 32-bit Firefox RPM with the new Yum repository.
sudo yum install firefox.i386

Now, run Firefox as normal. You will be running a 32-bit Firefox on an x86_64 system.

MP3 on Fedora 9

Fedora 9 does not release native support for MP3, so you need to get the right bits from another source like rpm.livna.org. First, install Livna's release package for Fedora 9. This will provide you with access to Livna.org's Fedora 9 YUM repository using /etc/yum.repos.d/livna.repo.

rpm -ivh http://rpm.livna.org/livna-release-9.rpm

Now, for XMMS MP3 support, install xmms and xmms-mp3

yum install xmms xmms-mp3

For Amarok MP3 support, install amarok and amarok-extras-nonfree.

yum install amarok amarok-extras-nonfree

For xine with MP3 support, install xine and xine-lib-extras-nonfree

yum install xine xine-lib-extras-nonfree

To create MP3s with LAME, install lame and lame-mp3x

yum install lame lame-mp3x

Flash Plugin on Fedora 9

OpenSource Flash Plugins

Fedora 9 features the Open Source Flash player, Swfdec. You can install the Swfdec plugin for Firefox using Yum.
sudo yum install swfdec-mozilla

Fedora 9 also provides Gnash.
sudo yum install gnash-plugin

Install Adobe Flash Using Yum

Alternatively, you can use Adobe's Flash plugin. To install the Adobe Flash plugin on Fedora 9 visit http://www.adobe.com/products/flashplayer/ and click Download Now. Then select YUM for Linux and download the provided RPM (adobe-release-i386-1.0-1.noarch.rpm).

Install the downloaded RPM which installs /etc/yum.repos.d/adobe-linux-i386.repo.
sudo rpm -i adobe-release-i386-1.0-1.noarch.rpm

Check that you can access the Adobe Yum repository.
yum --disablerepo=* --enablerepo=adobe* list

Next, remove the Fedora Swfdec and Gnash plugin to avoid conflicts.
sudo yum remove swfdec-mozilla gnash-plugin

Now, install the Adobe Flash Plugin
sudo yum install flash-plugin

Finally, add the Adobe plugin is in your $HOME/.mozilla/plugins folder.
mkdir -p $HOME/.mozilla/plugins
cd $HOME/.mozilla/plugins
ln -s /usr/lib/flash-plugin/libflashplayer.so .

For Fedora 9 i386, you should be done. If you are running x86_64, read on.

Firefox x86_64 with 32-bit Adobe Flash

The Adobe Flash plugin is not available as an x86_64 package. If you need to run a 64-bit browser, but need Adobe Flash, you can use ndiswrapper to run the 32-bit Adobe Flash plugin on the 64-bit Firefox browser.

First, install Livna's release package for Fedora 9. This will provide you with access to Livna.org's Fedora 9 YUM repository using /etc/yum.repos.d/livna.repo.

rpm -ivh http://rpm.livna.org/livna-release-9.rpm

Next, install ndiswrapper from Livna.org.

sudo yum -y install ndiswrapper

Now, install both the i386 and x86_64 packages for nspluginwrapper from Fedora's YUM repositories

sudo yum -y install nspluginwrapper.{i386,x86_64}

Finally, install the i386 version of libflashsupport and the i386 version of pulseaudio-libs (for flash sound support).

sudo yum -y install pulseaudio-libs.i386 libflashsupport.i386

Sources

fedorasolved.org: Adding the Flash Player Plugin
adobe.com: Adobe - Flash Player: Installation instructions

Syndicate content