Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

April 18, 2006

Apache + PHP + MySQL on Gentoo

Filed under: GNU/Linux, Gentoo, Web — tabrez @ 12:47 pm

Most of the today's web applications need the combo of Apache, PHP and MySQL packages to be first installed on the system. Installing these software on a Gentoo system should be a straightforward process. Below is the complete procedure.

First add apache2 and mysql to the USE flag in the /etc/make.conf file:

sh# emacs -nw /etc/make.conf

USE="gtk gnome qt kde dvd alsa cdr hal howl imap maildir mysql apache2"

emerge the apache package:

sh# emerge apache
sh# /etc/init.d/apache2 start
sh# rc-update add apache2 default

Test the installation by accessing the url http://localhost/ from a web browser. If you get a welcome message from apache, the installation is complete. More info here.

Now emerge PHP4 and the mod_php module for apache:

sh# emerge dev-php/php mod_php

Add the configuration directive(-D PHP4) to /etc/conf.d/apache2 file and restart the apache web server:

APACHE2_OPTS="-D DEFAULT_HOST -D PHP4"

sh# /etc/init.d/apache2 restart

Create a sample php script in the directory /var/www/localhost/htdocs with the following contents and access it from the web browser to test the php installation:

PHP:
  1. <?php
  2.     phpinfo();
  3. ?>

If you see a lot of information displayed about the version of PHP and other related things then PHP is installed and properly configured with the apache web server. Installation of PHP5 is also similar but be warned that still a lot of software runs only on PHP4(Eg: phpBB Bulletin Software). With a little bit of effort you can also run both PHP4 and PHP5 on the same system side by side.

Install MySQL and all the related tools:

Add the following lines to the /etc/portage/package.keywords file:

>=dev-db/mysql-administrator-1.1.5 ~x86
>=dev-db/mysql-query-browser-1.1.17 ~x86
>=dev-cpp/gtkmm-2.8 ~x86
>=dev-cpp glibmm-2.7 ~x86

sh# emerge mysql mysql-administrator mysql-query-browser
sh# emerge –config mysql-4.1.14
sh# /etc/init.d/mysql start

Set a root password for mysql server when prompted by the 'emerge –config' command. You can administer the mysql server by using either the command line tools or using the graphical tool mysql-adminstrator. Similarly, the command line client mysql can be used to create and view the database schemas or the graphical tool mysql-query-browser can be used. I recommed you give these two graphical applications a try.

Other databases, like PostgreSQL, can be used instead of MySQL whenever the applications support it, but a majority of the applications support only the MySQL database. Wordpress for example doesn't support PostgreSQL.


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Two Applications For Easy Management Of ‘USE’ Flags In Gentoo
  • Installing Complete LAMP Stack on Ubuntu 6.10(Edgy Eft)
  • How to Speed up Booting Into GNOME - A Gentoo Wiki Tip
  • Linux Bible 2007 Edition: Install/Run 10+ GNU/Linux Distributions(Ubuntu, Fedora, Gentoo etc)
  • Setting Up Rails Development Environment on Fedora GNU/Linux
  • Setting Up Rails Development Environment on Windows Vista/XP
  • How I Upgraded to Wordpress 2.3 on Live Blog With Zero Downtime

  • Readers who viewed this page, also viewed:


    April 13, 2006

    A NFS Story on Gentoo

    Filed under: GNU/Linux, Gentoo — tabrez @ 9:09 am

    I still carry the habit of storing all the large files in my Windows partitions from my bad old Windows days. That allows me to plug any kind of device into the computer and copy the files to/from it. Gnu/Linux supports all kinds of DVD writers and Pen drives too, but my friends sometimes carry such wierd devices(and mp3 players) that they can be connected only to a computer using the Windows operating system. Accessing files in the Windows OS from a GNU/Linux partition is a time consuming and inefficient process - I do it using the excellent tool called Explore2FS, but its not an ideal tool for copying large amounts of files and directories. So it suits me well: store the files on the Windows partitions and access them easily from both Windows and GNU/Linux(by using a simple mount command).

    When I discovered that my old Debian Sarge installation was not detecting the USB port for some reason and that its DVD-ROM has also died upon me, my only way to transfer some files to it was through the LAN. The files were contained in an ISO file on a Windows NTFS partition on a different machine. Below is the description of what I had to do to make the ISO file contents available to my USB-less, DVD-less Debian system.

    I use Gentoo as my primary operating system on my personal desktop. The first job for me was to mount the local Windows partition(hda7) that contained the needed ISO file in the Gentoo filesystem.

    sh# mkdir /mnt/win_d
    sh# mount /dev/hda7 /mnt/win_d
    sh# ls /mnt/win_d/*.iso

    The ISO file was visible. I tried to export the /mnt/win_d directory using NFS and then tried to mount the ISO file on the Debian system, but it didn't work out that way for me. Not in a mood to loose too much time over it, I mounted the ISO file on my Gentoo System itself and then exported this mounted directory:

    sh# mkdir /mnt/myiso
    sh# mount -o loop /mnt/win_d/myiso.iso /mnt/myiso
    sh# ls /mnt/myiso

    All the files contained in the ISO file were visible. The next job is to install the NFS server and the related tools if they are already not available, and then export the /mnt/myiso directory using it.

    sh# emerge nfs-utils

    Put the following line /etc/exports:

    /mnt/myiso 192.168.0.0/255.255.255.0(async, no_subtree_check, ro, no_squash_root)

    I have specified a range of IP addresses to export the directory to all the machines within the subnet. Only one IP address or a different IP address range can also specified there. Note that there should be NO space between the IP address/IP address range and the opening paranthesis that follows it. To learn more about the different options and their meanings that can be specified in the line, head on to this.

    Start the nfs and portmap daemons and add them to the default runlevel(so that they start automatically at the boot time).

    sh# /etc/init.d/nfs start
    sh# rc-update add nfs default
    sh# /etc/init.d/portmap start
    sh# rc-update add portmap default

    If you ever make changes to the /etc/exportfs file, then export all your changes using:

    sh# exportfs -ra
    sh# /etc/init.d/nfs reload
    sh# exportfs

    The last command shows you all the directories that are currently exported.

    Now go to the other machine(Debian in my case) and use a simple mount command to access the exported directory.

    sh# mkdir /mnt/remote
    sh# mount 192.168.0.7:/mnt/myiso /mnt/remote
    sh# ls /mnt/remote

    You should see all the files from the exported directory. The IP address above is of the host system(Gentoo in my case) which is running the nfs daemon. Now you can use the /mnt/remote directory as any other directory on the local gnu/linux system. If the exported directory were a linux partition or a Windows FAT partition, then the write options could also have been ebabled by using the "rw" option in the /etc/exportfs file in place of the "ro" option. The following line can be added to the /etc/fstab file to mount this directory automatically at the boot time:

    192.168.0.7:/mnt/myiso /mnt/remote nfs ro 0 0

    The IP address, as above, is of the host system. You may be interested in this: NFS in Gentoo


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • Linux Bible 2007 Edition: Install/Run 10+ GNU/Linux Distributions(Ubuntu, Fedora, Gentoo etc)
  • Another system rescue story, using Ubuntu LiveCD
  • How to Speed up Booting Into GNOME - A Gentoo Wiki Tip
  • Java on Gentoo
  • Two Applications For Easy Management Of ‘USE’ Flags In Gentoo
  • Moving A GNU/Linux Installation To A Different Partition
  • C# & MonoDevelop (.NET) on Gentoo and Ubuntu

  • Readers who viewed this page, also viewed:


    April 9, 2006

    Direct Server to Server Copy using FXP

    Filed under: GNU/Linux, General, Gentoo — tabrez @ 9:00 am

    FTP is still the best way to upload or download the files/folders from a website. I use gFTP to upload the files to my web space and its quite efficient at the job. Even if the connection gets interrupted in the middle of a transfer, it automatically reconnects and completes the job. It has many other useful features too. One feature that I thought was lacking in it is the ability to move a folder from one location to the other within the same server. Other people had complained for its lack of ability to move a file from one server to another server without involving the local machine in the process. Though many FTP clients do support such a feature(including gFTP, as I discovered later), I started searching for a dedicated FXP client. But what is FXP? From Wikipedia:

    File eXchange Protocol (FXP) is a method of data transfer which uses the FTP protocol to transfer data from one remote server to another without routing this data through the client's connection.

    Note that FXP transfers need relevant support on the server side too(they must support PASV mode and PORT commands) - otherwise the FXP client can't do anything about it. To install a FXP client on Gentoo:

    1. Add the following line to the file /etc/portage/package.keywords :
      >=net-ftp/gtkfxp-0.5 ~x86
    2. Emerge the package and run it:

      sh# emerge gtkfxp
      sh# gtkfxp &

    Click the Connect button on the left side and fill the settings of the first server in the popped up dialog box, then click the Connect button on the right side and fill out the settings of the second server. You can now start transferring the files in between these two servers without involving your local machine. You can enter the information about the same server in both the dialog boxes if you want to transfer the files within the same server. Note that this software is buggy and very crash prone. gFTP too supports FXP transfers but it is seriously lacking in the documentation. I recently got an email from Chris explaining how to do FXP transfers in gFTP. The procedure described was like this:

    Here's how to use FXP wit gFTP: First, FXP requires you to connect to both sites
    using the normal client. To do so please use Menu "FTP" -> "Window 1" and then
    select one of your bookmarked sites, and wait till it has properly connected.
    You will see the file listing appear in window 1, which is the left panel.
    Switch to "Window 2" using "FTP" -> "Window 2" and then connect via bookmark
    to another (different!) site. That's it. You can now transfer between them.

    Thanks Chris for the great tip!


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • Create ASP.NET 1.0 & 2.0 Applications On GNU/Linux and Windows Using Mono XSP
  • Maemo SDK VMWare Appliance 0.4 Released With Lot of Goodies
  • Setting Up Rails Development Environment on Windows Vista/XP
  • Setting Up Rails Development Environment on Fedora GNU/Linux
  • Installing Complete LAMP Stack on Ubuntu 6.10(Edgy Eft)
  • Setting Up Rails Development Environment on Ubuntu GNU/Linux
  • Which is my favourite OS?

  • Readers who viewed this page, also viewed:


    April 5, 2006

    Installing C++ Boost on SuSE and Fedora

    Filed under: C++ Boost, GNU/Linux — tabrez @ 2:56 pm

    C++ Boost on SuSE:

    Its simple to install C++ Boost on a SuSE system by using its YaST package manager.

    1. Run YaST and select "Software" from the left pane. Now select "Software Management" from the right pane and search for "boost" using the Search box.
    2. Select the boost packages that you want to install from the right pane(you atleast need boost - 1.33.0-3) and press the "Accept" button.

    You can now test the boost installation by compiling the two programs I had mentioned in my earlier post, using the following commands:

    sh# g++ -o first first.cpp
    sh# g++-o second second.cpp -lboost_filesystem

    C++ Boost on Fedora:

    Installing C++ Boost on RedHat Fedora systems is also along the same lines. First download the boost-1.33.1-5.i386.rpm RPM file from the internet. you can search for a different version of the file if you are not using the Fedora Core 5 system. Install it using the following command(you can directly click on the file):

    sh# rpm -ivh boost-1.33.1-5.i386.rpm

    You can also install it using the yum package manager of Fedora. Test the installation just as mentioned in the case of SuSE.


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • C++ Boost Filesystem Library(Part III): Example Programs
  • C++ Boost Filesystem Library(Part II): Example Programs
  • Boost Filesystem Library: Writing Portable C++ Programs to Acess The Filesystem
  • Setting the Stage for C++ Boost
  • How to Test C++ Boost Installation
  • Installing C++ Boost on Slackware/Zenwalk
  • Installing C++ Boost 1.34.1 on Slackware/Zenwalk

  • Readers who viewed this page, also viewed:


    April 1, 2006

    Java 1.5 and Eclipse in Gentoo - Part II

    Filed under: GNU/Linux, Gentoo, Java — tabrez @ 12:48 pm

    My previous post discussed the installation of Java on a Gentoo system. Its all well as long as you want to run the default supported version of java on the Gentoo system - you install blackdown-jdk 1.4, Eclipse 3.0, and maybe Eclipse CDT too and get on with development. But if you want to install java 1.5(Tiger) then you need to unmask the package before you can install it and also remember to make blackdown(or sun) jdk 1.4 as the default JVM for the system. You can keep sun jdk 1.5 as the default JVM for the user. The procedure is like this:

    sh# java-config -L

    [sun-jdk-1.5.0.06] “Sun JDK 1.5.0.06″ (/etc/env.d/java/20sun-jdk-1.5.0.06) *
    [blackdown-jdk-1.4.2.03] “Blackdown JDK 1.4.2.03″ (/etc/env.d/java/20blackdown-jdk-1.4.2.03)

    This shows you all the installed jdks on your system. Use the name as given under the brackets to set that particular jvm as your system default:

    sh# java-config -S blackdown-jdk-1.4.2.03
    sh# /usr/sbin/env-update && source /etc/profile

    This sets the blackdown jdk 1.4 as the system jvm, which is the recommended option. You can set the sun jdk 5.0 as the user default jvm though:

    sh# java-config -s sun-jdk-1.5.0.06
    sh# echo source ~/.gentoo/java-env >> ~./bash_profile
    sh# source ~/.gentoo/java-env

    This sets the sun jdk 1.5 as the user jvm and it is safe this way. But don’t make 1.5 version as the default jvm for the system unless you are ready to break a lot of java applications.

    Best way to install Java on Gentoo OS:

    But this still is not an ideal setup from my point of view; the installed Eclipse version doesn’t support the Java 1.5 version. If you want to use the latest versions of all the java software without going through all of these hassles, you need to install everything related to java manaully in the user home directory. This won’t affect your normal portage structure in any way(but you still need a system jdk to run java applications from the browser).

    First download the latest versions of Java SDK and the Eclipse IDE from the Internet and copy them into the home directory.

    Download sun jdk 1.5.0 update 6 from here and copy it into the home directory. You will have to accept the license to be able to download this. Be sure to download the .bin version of the file and not the RPM version.

    Download the latest version of the Eclipse IDE from here and copy it in the home directory. The latest build available currently is Eclipse 3.2M5a. If you plan to use Eclipse CDT plugin to create C++ applications, then you have to be content with the Eclipse 3.1.2 version.

    (All the above links are for the gnu/linux, 32-bit operating system. Finding similar package files for 64-bit systems shouldn’t be too difficult)

    Install jdk as a normal user:

    sh# chmod +x jdk_1_5_0_06-linux-i586.bin
    sh# ./jdk_1_5_0_06-linux-i586.bin
    sh# tar xvzf eclipse-sdk-3,1,2-linux-gtk.tar.gz

    Rename the directory to which the above files are extracted to something simple, like “eclipse”.

    Now add the following lines to your user profile( eg ~/.bash_profile ):

    JDK_HOME=~/jdk1.5.0_06
    JAVAC=~/jdk1.5.0_06/bin/javac
    PATH=~/jdk1.5.0_06/bin:~/jdk1.5.0_06/jre/bin:~/eclipse:$PATH
    MANPATH=$MANPATH:~/~/jdk1.5.0_06/man
    JAVA_HOME=~/jdk1.5.0_06

    source the profile once and start the Eclipse IDE:

    sh# source ~./bash_profile
    sh# eclipse

    Go to Windows menu and select Preferences from it. Select Java -> Installed JREs from the left pane and click on the “Add” button on the right pane.

    Adding a New JRE

    Browse to and select jdk1.5.0_06/jre directory from your home directory. Enter “JDK1.5.0_06″ in “JRE Name:” field. Click on Java -> Compiler item from the left pane and select “5.0″ from the “Compiler Compliance Settings:” selection list.

    Selecting the default JDK version

    Click OK button to dismiss the dialog box.

    Now you can create java 1.5 applications on your Gentoo system using the Eclipse IDE.
    Just extract the Eclipse CDT tar file in the eclipse folder to get the C++ support in Eclipse. (contents of ‘features’ directory from downloaded package should go into the ‘features’ directory in eclipse, and contents of ‘plugins’ directory should go into the ‘plugins’ directory in eclipse).


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • Java on Gentoo
  • EasyEclipse is the Best Packaged Distribution of Eclipse Platform
  • Two Applications For Easy Management Of ‘USE’ Flags In Gentoo
  • How to Speed up Booting Into GNOME - A Gentoo Wiki Tip
  • C++ Development Environment on Windows using Eclipse Ganymede and Nuwen MinGW
  • Develop Ruby Applications Using Eclipse IDE
  • Should I Be Developing Ajax Applications using Google Web Toolkit(GWT)?

  • Readers who viewed this page, also viewed:



    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost