Trashguy/FAMP
From FBSD_tips
A quick guide to setting up an AMP server in FreeBSD.
I typically start from a custom install of just base, kern, src and man. After brining the system up to the current patch level I begin to install Apache MySQL and PHP.
Contents |
[edit] Updating Ports
Get the latest ports : *Note: Go here to find the closest server.
vi /usr/share/examples/cvsup/ports-supfile change this line: *default host=CHANGE_THIS.FreeBSD.org to: *default host=*.FreeBSD.org
This will start the ports tree update :
csup -L 2 /usr/share/examples/cvsup/ports-supfile
[edit] MySQL
Install MySQL :
cd /usr/ports/databases/mysql50-server make install clean
This will create the MySQL Database in /var/db/mysql as well as restrict the owner and group to the mysql user :
/usr/local/bin/mysql_install_db chown -R mysql /var/db/mysql/ chgrp -R mysql /var/db/mysql/
Start the daemon with the mysql user :
/usr/local/bin/mysqld_safe -user=mysql &
Add mysql to start when the server is rebooted :
echo ‘mysql_enable=”YES”‘ >> /etc/rc.conf
By default mysql root user has no password use this to change the mysql root password :
/usr/local/bin/mysqladmin -u root password newpassword
[edit] Apache22
Install Apache :
cd /usr/ports/www/apache22 make install clean
During the build you will be prompted to install options for “gettext” do not select any and accept
Add apache to start when server is rebooted :
echo ‘apache22_enable=”YES”‘ >> /etc/rc.conf
Start apache :
/usr/local/etc/rc.d/apache22 start
[edit] PHP
Install PHP :
cd /usr/ports/lang/php5 make install clean
Select the options you wish to use.
Edit httpd.conf :
vi /usr/local/etc/apache22/httpd.conf
Ensure that this line is there :
LoadModule php5_module libexec/apache22/libphp5.so
Change this:
<IfModule dir_module> DirectoryIndex index.html </IfModule>
to this
<IfModule dir_module> DirectoryIndex index.html index.php </IfModule>
Add this to the AddType portion of the httpd.conf
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Install PHP Extentions :
cd /usr/ports/lang/php5-extensions make config
Select the PHP extensions you wish to install make install clean
During the install you will be prompted to select options for some of the php extensions you selected options for.
You should now have a functioning AMP server.
Trashguy 12/18/2007
