FAMP – Installing Apache2.4, MySQL, PHP on FreeBSD 10
ON RASPBERRY PI
Here is a procedure to install a FAMP(FreeBSD with Apache, MySQL and PHP) server. The following setup runs Apache 2.4, MySQL 5.6, and PHP 5.5 on FreeBSD 10. If any version of the packages needs to be changed, replace the versions in the commands accordingly.
If you want to install FAMP using ‘pkg’, have a look at this post.
Pre-Installation Tasks
Before installation of the components, Download the compressed snapshot of the ports collection, using the following command
# portsnap fetch
Now extract the snapshot into /usr/ports using the following command
# portsnap extract
Apache 2.4 – Installation and Configuration
# cd /usr/ports/www/apache24 # make install
(While running “make install” the installer asks to check the boxes to install various libraries and support packages. Check the appropriate boxes as per requirements.
# make clean
Edit the apache configuration file i.e. /usr/local/etc/apache24/httpd.conf and make the following changes
ServerRoot "/usr/local"
ServerAdmin you@your.address
ServerName www.example.com:80
DocumentRoot "/usr/local/www/apache24/data"
Listen :80
Edit the /etc/hosts file and add the following line:
<ip-address> <hostname>.<domain>
eg:
192.168.1.1 hostname.example.org
Create a file named /boot/loader.conf or edit it if it is already present and add the following line:
accf_http_load="YES"
Add the following line to /etc/rc.conf
apache24_enable="YES"
Test the apache server installation using the following command:
# /usr/local/sbin/apachectl start
MySQL – Installation and Configuration
# cd /usr/ports/databases/mysql56-server/ # make install # make clean
Start MySQL
# /usr/local/etc/rc.d/mysql-server onestart
Add the following line to the file /etc/rc.conf
mysql_enable="YES"
Set password for my sql using the following command
# rehash # mysqladmin -uroot password ''
Configuring mysql
Use the following command
# cp /usr/local/share/mysql/my-default.cnf /etc/my.cnf
Restart mysql using the following commands
# /usr/local/etc/rc.d/mysql-server restart
PHP – Installation and Configuration
You can install pick any one of PHP versions from the following.
PHP-5.5
Use the following commands to install PHP-5.5 and other supporting packages
# cd /usr/ports/lang/php55 # make install # make clean # cd /usr/ports/www/mod_php55 # make install # make clean
PHP-5.6
Alternatively if you want PHP-5.6, use the following commands to install PHP5.6 and other supporting packages
# cd /usr/ports/lang/php56 # make install # make clean # cd /usr/ports/www/mod_php56 # make install # make clean
Edit /usr/local/etc/apache24/httpd.conf file and add the following lines under /AddType
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
And add the following line under LoadModule section if you have installed PHP-5.5
LoadModule php5_module libexec/apache24/libphp5.so
Modify the line ‘DirectoryIndex index.html’ to the following
DirectoryIndex index.php index.html
Now restart the apache server by using the following command
# /usr/local/sbin/apachectl restart
Once the Apache service is restarted, create a file /usr/local/www/apache24/data/info.php and add the following lines to it
<?php phpinfo(); phpinfo(INFO_MODULES); ?>
Now load the following URL to check the details of installed PHP and its modules
http://<ip-address>/info.php
No comments:
Post a Comment