انجمن کاربران لینوکس ایران - تکنوتاکس سابق

نسخه ي کامل: پکیج پرتابل بین نسخه های لینوکس
شما در حال مشاهده نسخه ي متني اين صفحه هستيد. مشاهده نسخه کامل تر با قالب بندي صحيح
ساختن پکیج پرتابل بین نسخه های لینوکس :
شامل چندین روش میباشد
1-بااستفاده از دستورات
2-با استفاده از نرم افزار
البته پیرامون این موضوع مطالب گسسته فراوانی هست ولی از دوستانی که دراین مورد فعالیت داشته اند دعوت به همکاری جهت تکمیل این تاپیک مینمایم
ممنون
Manually compiling Apache and PHP on Linux for OpenAdmin Tool
cheetahblog | June 5 2013 | Tags: compile openadmin informix apache oat php linux ‎ | 15,875 Views



This article provides step-by-step instructions for manually compiling Apache and PHP on Linux for OpenAdmin Tool for Informix.
Note that there is an automated installation option for OpenAdmin Tool (OAT) that installs and configures Apache and PHP for you. To use the automated installation, install OAT as part of the IBM Informix Client SDK installer or the IBM Informix bundle installer. OAT is available as part of the Client SDK and bundle installers for Linux 32, Linux 64, Windows 32, and Mac OS 64 for Informix version 11.70 and higher.
By contrast, this article is intended for advanced users who would prefer to compile their own Apache and PHP on Linux.
In this article, I will be using Apache HTTP Server version 2.4.2, Apache Portable Runtime version 1.4.6, Apache Portable Runtime Utility version 1.4.1, PHP version 5.4.4, and PDO_INFORMIX version 1.2.7. These are the versions that are currently shipped with the OAT that is part of the automated installer. Feel free to try with more recent versions of these software components if you like.
1. Install the Informix Client SDK
The Informix Client SDK is required to run OAT. It will also be required to compile the PDO_INFORMIX driver with PHP in step 3.
(a) Install the Informix Client SDK
(b) Set the INFORMIXDIR environment variable to point the directory where the Client SDK was installed.
2. Compile and Configure the Apache HTTP Server
(a) Download the UNIX source for the Apache HTTP Server from https://httpd.apache.org/
(b) Download the UNIX source for the Apache Portable Runtime (APR) and Apache Portable Runtime Utility (APR-util) from https://apr.apache.org/
© Extract the Apache HTTP Server source code.
tar xvfz httpd-2.4.2.tar.gz
(d) Extract the APR and APR-util packages into the Apache srclib directory. Rename the directories to apr and apr-util respectively.
cd httpd-2.4.2/srclib/
tar xvfz apr-1.4.6.tar.gz
mv apr-1.4.6/ apr
tar xvfz apr-util-1.4.1.tar.gz
mv apr-util-1.4.1/ apr-util
cd ..

(e) Set the APACHE_PREFIX environment variable to the directory where you want the Apache HTTP Sever to be installed. For example, /work/oat/apache_2.4.2
(f) Run the following commands to build and install Apache HTTP Server.
./configure --prefix=$APACHE_PREFIX --enable-so --without-pgsql --with-included-apr
make clean
make
make install

Note #1: to build Apache HTTP Server with the mod_ssl module which is required for HTTPS, add "--enable-ssl --with-ssl=/usr/bin" as an additional argument to the configure command above. You will need OpenSSL installed to build the mod_ssl module. If OpenSSL is installed to a different directory from /usr/bin, substitute the appropriate directory name.
Note #2: If libpcre is not installed on your system, you will also have to compile PCRE and add "--with-pcre=/opt/pcre" as an additional argument to the Apache configure command.
(g) Edit the Apache httpd.conf file in the $APACHE_PREFIX/conf directory.
• Uncomment the line with the ServerName directive and specify the host name and port number for your web server. For example: ServerName myhostname.ibm.com:8080
• Locate the Listen directive and ensure that it is set to the same port number you specified in the ServerName directive.
• Change the DirectoryIndex directive to DirectoryIndex index.html index.php
• Change all instances of AllowOverride none to AllowOverride All
(h) Edit the $APACHE_PREFIX/bin/envvars file to include the following lines, where everything in angle brackets (<< >>) is replaced by the actual path.
INFORMIXDIR=<<$INFORMIXDIR>>
export INFORMIXDIR
PATH=$INFORMIXDIR/bin:$PATH
export PATH
LD_LIBRARY_PATH=<<$APACHE_PREFIX>>/lib:<<$PHP_PREFIX>>/lib:$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$INFORMIXDIR/incl:$INFORMIXDIR/incl/cli:$INFORMIXDIR/incl/esql:/lib/:/usr/lib/:/usr/local/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
(i) Start the web server by running the following command:
$APACHE_PREFIX/bin/apachectl start
(j) Verify that the web server is running by using your web browser to visit the URL specified in the ServerName directive of the httpd.conf file.
3. Compile and Configure PHP
(a) Download the PHP source code from http://us.php.net/downloads.php
(b) Download the PDO_INFORMIX source code from http://pecl.php.net/package/PDO_INFORMIX
© Extract the PHP source code.
tar xvfz php-5.4.4.tar.gz
(d) Extract the PDO_INFORMIX source code into the PHP ext directory. Rename the PDO_INFORMIX directory to pdo_informix.
cd php-5.4.4/ext
tar xvfz PDO_INFORMIX-1.2.7.tgz
mv PDO_INFORMIX-1.2.7 pdo_informix
cd ..
(e) Set the following environment variables:
$PHP_SOURCE_DIR - the directory where you extracted PHP
$PHP_PREFIX - the directory when you want PHP to be installed
(f) Run the following commands to build and install PHP and PDO_INFORMIX
./buildconf --force --add-modules-dir=$PHP_SOURCE_DIR/ext/pdo_informix
./configure --prefix=$PHP_PREFIX --disable-all --with-sqlite3 --enable-soap --enable-pdo --with-pdo-sqlite --with-openssl --enable-libxml --with-pcre-regex --enable-session --enable-sockets --enable-xml --enable-xmlwriter --enable-xmlreader --enable-simplexml --enable-zip --with-apxs2=$APACHE_PREFIX/bin/apxs --enable-dom --with-gd
make clean
make
make install
cd ext/pdo_informix
$PHP_PREFIX/bin/phpize --clean
$PHP_PREFIX/bin/phpize
./configure --with-pdo-informix=$INFORMIXDIR --with-php-config=$PHP_PREFIX/bin/php-config
make clean
make
mkdir $PHP_PREFIX/lib/php/extensions
cp ./modules/pdo_informix.so $PHP_PREFIX/lib/php/extensions/pdo_informix.so
cd ../..

Note: If libxml2 is not installed on your system, you will also have to compile libxml2 (e.g. version 2.8.0) and add "--with-libxml-dir=/opt/libxml2" as an additional argument to the PHP configure command.
(g) Copy the php.ini configuration file and the libphp5 module to your PHP installation directory
cp php.ini-production $PHP_PREFIX/lib/php.ini
cp libs/libphp5.so $PHP_PREFIX/libphp5.so
(h) Edit the php.ini configuration file
• Set doc_root to the htdocs directory of your Apache installation ($APACHE_PREFIX/htdocs).
• Set extension_dir to the lib/php/exensions directory of your PHP installation ($PHP_PREFIX/lib/php/extensions)
• Add the line "extension=pdo_informix.so" to load the PDO_INFORMIX driver
• Set max_execution_time to the number of seconds you want the web server to wait before timing out and set memory_limit to at least 256 M
(i) Edit the Apache httpd.conf file ($APACHE_PREFIX/conf/httpd.conf)
• Comment the existing LoadModule php5_module modules/libphp5.so directive
• Add the following lines, where everything in angle brackets (<< >>) is replaced by the actual path:
LoadModule php5_module <<$PHP_PREFIX>>/libphp5.so
AddType application/x-httpd-php .php
PhpIniDir <<$PHP_PREFIX>>/lib
setenv INFORMIXDIR <<$INFORMIXDIR>>
(j) Restart the Apache web server
$APACHE_PREFIX/bin/apachectl start
$APACHE_PREFIX/bin/apachectl stop
4. Extract and install the OpenAdmin Tool Community Edition
(a) Download the OpenAdmin Tool Community Edition from the IBM Informix free product downloads page. The OAT Community Edition is available as a zip or tar file.
(b) Create an openadmin directory under the Apache htdocs directory ($APACHE_PREFIX/htdocs) and extract the OAT Community Edition zip or tar file.
© Use your web browser to navigate to the URL http://<ServerName>:<PortNumber>/openadmin/install/index.php .
(d) Follow the on-screen instructions to install OpenAdmin Tool, which involves reading and accepting the license term, verifying your configuration, building the connections database, and installing plug-ins.
(e) The Adobe Flash Player is required to use OAT after it is installed, so make sure to install the Flash Player plug-in into your web browser if you do not already have it. For example, to install the Flash Player plugin in Firefox on Linux, untar the Flash Player into the Firefox plugin directory (e.g. /usr/lib/mozilla/plugins/).
Compiling a Portable Apache for Linux

There are several projects that offer precompiled and portable distributions of the Apache webserver for use on a USB stick. But I couldn't find any that would work on a Linux system.

Today I spent some time to figure out how to compile a relocatable Apache with PHP support. Yes, this might result in a Linux version of the DokuWiki on a Stick project. Read on for detailed instructions.
Downloading and Patching

I assume all of the following steps are done in your home directory, adjust paths if needed.

First download and unpack Apache and PHP.

$> wget http://de2.php.net/get/php-5.2.5.tar.bz2...his/mirror
$> tar -xjvf php-5.2.5.tar.bz2
$> wget http://apache.eu.lucid.dk/httpd/httpd-2.0.63.tar.bz2
$> tar -xjvf httpd-2.0.63.tar.bz2

To avoid any fixed paths in Apache, two files have to be slightly modified1). This will make Apache look for its config in a directory relative to the main binary. Here is patch: apache-2.0.63.patch

$> cd $HOME/httpd-2.0.63
$> patch < $HOME/apache-2.0.63.patch

Compiling

Time to compile Apache and PHP. Apache goes first:

$> cd $HOME/httpd-2.0.63
$> ./configure --prefix=$HOME/apache --exec-prefix=$HOME/apache \\
--enable-mods-shared=all --enable-so
$> make
$> make install

Next is PHP:

$> cd $HOME/php-5.2.5
$> ./configure --prefix=$HOME/php --with-apxs2=$HOME/apache/bin/apxs
$> make
$> make install

Prepare Portable Distribution

The first part is pretty straight forward. Just create a dir and copy the files we're interested in.

$> mkdir $HOME/portable
$> cd $HOME/portable
$> mkdir conf
$> mkdir htdocs
$> mkdir logs
$> cp $HOME/apache/bin/httpd .
$> cp $HOME/apache/lib/libapr-0.so.0 .
$> cp $HOME/apache/lib/libaprutil-0.so.0 .
$> cp -r $HOME/apache/modules/ .
$> cp $HOME/conf/mime.types conf/
$> cp $HOME/php-5.2.5/php.ini-recommended conf/php.ini

The next thing took me a lot of time to figure out. The httpd binary makes use of some shared libraries. The location (rpath) of these libraries is compiled into the binary. That's bad of course for a portable environment. Luckily the dynamic loader of Linux supports a macro called $ORIGIN to reference a path relative to the binary itself. However I wasn't able to pass $ORIGIN correctly to the LDFLAGS environment to be used correctly by the Apache build process2).

The only way to fix this problem I found, was to change the rpath afterwards. This can be done by a tool called chrpath:

$> sudo apt-get install chrpath
$> chrpath -r '$ORIGIN' $HOME/portable/httpd

Finally a simple config file for Apache is needed, here is a very minimal version of $HOME/portable/conf/httpd.conf:

ServerName portableapache
Listen 8080
DocumentRoot htdocs
ServerAdmin [email protected]

LoadModule access_module modules/mod_access.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule mime_module modules/mod_mime.so

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .php3
PHPIniDir conf

AccessFileName .htaccess
IndexIgnore readme .htaccess
KeepAlive on
KeepAliveTimeout 15
TimeOut 30

DirectoryIndex index.html index.htm index.php

Running

You now can start and stop your Apache with

$> cd $HOME/portable
$> ./httpd -k start
$> ./httpd -k stop

Of course you might want to move the $HOME/portable dir to your USB stick. The webserver will be available at http://localhost:8080.
دو نمونه از پرتابل آپاچی با دستورات
Build cross-distro Linux binaries
http://phusion.github.io/holy-build-box/
نمونه ای از نرم افزارهای پرتابل برای لینوکس
لطفا مطالعه نمایید