install mysql5, apache2, and php5 from source on freebsd 7.1

.: what is :.
please take a look this, this and this.

.:: installing mysql5 ::.

. preparing .
[root]# adduser
--------------------

Username: mysql
Full name:
Uid (Leave empty for default):
Login group [mysql]:
Login group is mysql. Invite bsd into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/mysql]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password: yourmysqlpassword
Enter password again: yourmysqlpassword
Lock out the account after creation? [no]:
Username : mysql
Password : ********
Full Name :
Uid : 1003
Class :
Groups : mysql
Home : /home/mysql
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (mysql) to the user database.
Add another user? (yes/no): no
Goodbye!
-----------------------------------------------

. create MySQL work directory.
[root]# mkdir /usr/local/mysql
[root]# mkdir /usr/local/mysql/var
[root]# mkdir /usr/local/mysql/data
[root]# mkdir /usr/local/mysql/tmp
[root]# pkg_add -r wget

. download package .

[root]# mkdir /root/download
[root]# cd /root/download
[root]# wget ftp://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.1/mysql-5.1.34.tar.gz
[root]# tar -xzf mysql-5.1.34.tar.gz

. compiling and configuring mysql5 .
[root]# cd mysql-5.1.34
[root]# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-pthread
[root]# make && make install
[root]# chown -R mysql /usr/local/mysql/var/
[root]# chgrp -R mysql /usr/local/mysql/
[root]# chmod 755 /usr/local/mysql/tmp/
[root]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root]# /usr/local/mysql/bin/mysqld_safe --user=mysql
[root]# /usr/local/mysql/bin/mysqladmin -u root password 'new-password'

. testing .
[root]# /usr/local/mysql/bin/mysql -u root -p
Enter password: yourpassword
---------------------------

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.34 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

---------------------------

if you want mysqld started after your system reboot, do this:
[root]# echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" >> /etc/rc.local 

or if /etc/rc.local not exist, do this:
[root]# echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" > /etc/rc.local 

.:: installing apache2 ::.

. download package.
[root]# cd /root/download/
[root]# wget http://apache.pesat.net.id/httpd/httpd-2.2.11.tar.gz
[root]# tar -xzf httpd-2.2.11.tar.gz

. compiling apache2 .
[root]# cd httpd-2.2.11
[root]# ./configure --prefix=/usr/local/apache2 --enable-mods-shared=most --enable-module=most --enable-so --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache
[root]# make && make install

. configuring apache2 .
[root]# chmod 644 /boot/defaults/loader.conf
[root]# vi /boot/defaults/loader.conf
--------[ change this option ]----------

accf_http_load="YES"

---------------------
[root]# kldload accf_http
[root]# chmod 444 /boot/defaults/loader.conf
[root]# cd /usr/local/apache2/
[root]# chgrp -R daemon .
[root]# chown -R daemon logs/
[root]# /usr/local/apache2/bin/apachectl start

if you want httpd started after your system reboot, you can do this:
[root]# echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.local

. testing .
open your browser client and go to url :
http://yourip
or
htpp://yourdomain


.:: installing php5 ::.

. download package .
[root]# cd /root/download/
[root]# wget http://id.php.net/distributions/php-5.2.9.tar.bz2
[root]# tar -xjf php-5.2.9.tar.bz2

. installing dependency .
[root]# pkg_add -r -v gd libiconv libxml2 libxslt perl png libmcrypt mhast 

. compiling package php5 .
[root]# cd php-5.2.9
[root]# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/apache2/conf --disable-debug --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib --with-mcrypt --with-openssl --with-curl --enable-ftp --with-bz2 --with-mhash --enable-zip --with-pear --enable-libxml --enable-wddx --enable-sockets --enable-mbstring --enable-pcntl=20 --enable-bcmath --disable-ipv6 --with-mysqli=/usr/local/mysql/bin/mysql_config
[root]# make && make install

. configuration php5 .
[root]# cp php.ini-recommended /usr/local/php5/lib/php.ini
[root]# vi /usr/local/php5/lib/php.ini
--------[ change this option ]---------------

include_path = ".:/usr/local/php5/include"

-----------------------

. configuration apache2 for support php5 .
[root]# vi /usr/local/apache2/conf/httpd.conf
-------[change on this option]---------------------------
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

-------------------------------------------------

. restart apache2 daemon .
[root]# /usr/local/apache2/bin/apachectl stop
[root]# /usr/local/apache2/bin/apachectl start

. testing php5 on apache2 .
make file .php for testing
[root]# vi /usr/local/apache2/htdocs/info.php
--------[ add this line ]---------

<?
phpinfo();
?>

--------------

open your web browser client and go to url :
http://youripnumber/info.php
or
http://yourdomain/info.php


.:: links ::.
. http://www.google.com/linux
. http://httpd.apache.org/download.cgi
. http://dev.mysql.com/downloads/
. http://www.php.net/downloads.php
. http://www.unixcities.com/mysql/index.html
. http://www.mydigitallife.info/2006/04/23/freebsd-apache-http-accept-filter-error/
. http://hanadi.wordpress.com/2008/10/13/compiling-apache-2-from-source-on-freebsd-7/
. http://pvpgn.imigi.ro/index.php/Install_apache_httpd_with_php_support

0 komentar:

Post a Comment

:: Cheap Web Hosting :: ~ only from Rp. 900/mo; 250Mb/mo of Bandwidth ~ :: Web Hosting Murah Meriah :: ~ mulai dari Rp. 900/bln; Bandwidth 250Mb/bln ~