FAMP (FreeBsd Apache MySql Apache)
From The Wiki Guide
Contents |
Introduction
This guide will enable you to setup a basic FAMP installation, similiar to the standard LAMP configurations found on modern Web Servers. You will be able to run PHP based forums, Wiki's,PHP Based Gallerys, and Programs which require a MySql backend, with this basic configuration. This guide is in no way a definitive guide, it is just a get you up and running type of guide. You should be aware of any program or port you install, and be familiar with its bugs, vulnerabilities, dependencies, etc.
FreeBSD Install
- Install FreeBSD off the CD..
- Choose All binaries, and X win system
- Choose to install ports
- Add username to Wheel GRP:
- ee /etc/group
- then next to "wheel:*root" type ",username"
- Compile CVSup
- cd /usr/ports/net/cvsup
- then "make install" and "rehash"and"sync"
- Copy ports-supfile
- cp /usr/share/examples/cvsup/ports-supfile /usr/local/bin/
- ee /usr/local/bin/ports-supfile
- (Add the following)
- "*default base=/usr"
- "*default prefix=/usr"
- "*default release=cvs"
- "*default delete"
- "*default use-rel-suffix"
- "*default tag=."
- "*default compress"
- "*default base=/usr"
- "src-all"
- "ports-all"
- "doc-all"
- "src-all"
- Save and exit
- Run "cvsup -g -L 2 ports-supfile"
- To get locate working:
- /usr/libexec/locate.updatedb
- Add a default route/gateway
- route add default x.x.x.x
- Add a DNS server
- echo "nameserver x.x.x.x" >/etc/resolv.conf
- Optional KDE Install
- pkg_add -r kde
- echo "exec startkde" ~/.xinitrc
- Type "startx" to get into KDE
- Port Install Procedure:
- locate package (will list the directory and available packages)
- cd /usr/ports/portdirectory
- make install (will go through the 3 step install process)
- pkg_add -r package (no compiling, faster install)
- After every install:
- rehash (updates the hash tables to add the newly installed port directory)
- sync (writes any files in the buffer to the system, updates inodes)
Apache Install
- locate apache2
- cd /usr/ports/www/apache2x
- make install
- Defaults:
- DataLocation- /usr/local/www/data-dist
- Httpd.conf- /usr/local/etc/apache2/
- Tip: Make a symbolic link to the Web Dir, so its easier to access the web shared folder.
- ex. ln -s /usr/local/etc/apache2x /webdir
- Edit your Httpd.conf accordingly and test apache.
- Edit Hosts file
- ee /etc/hosts (change localhost to name of computer)
- Edit rc.conf: ee /etc/rc.conf
- ADD apache_enable="YES"
- Quick and Dirty
- Place your email next to ServerAdmin
- Place the ip of your machine next to ServerName(x.x.x.x:80)
- Start Apache
- Commands:
- apachectl start
- apachectl stop
- apachectl restart
MySql Install
- locate mysql (get an idea of where the ports are)
- Client:
- cd /usr/ports/databases/mysql3x-client
- make install
- rehash
- sync
- Server:
- cd /usr/ports/databases/mysql3x-server
- make install
- rehash
- sync
- Configure Startup Script:
- ee /usr/local/etc/rc.d/mysql-server.sh
- FIND ${mysql_enable= and set it to ${mysql_enable="YES"}
- Run the script /usr/local/etc/rc.d/mysql-server.sh
- Since the script is placed in rc.d, it will start Mysql on boot
- Check that MySql is running "ps aux | grep mysql"
- Location of the Database files: /var/db/mysql
- Changing the root password: mysqladmin -u root password newpassword
- After that when logging in use mysqladmin -u root -p (it will prompt for pass which is more secure)
- After that when logging in use mysqladmin -u root -p (it will prompt for pass which is more secure)
- Creating a DB
- login to mysql mysql -u root -p
- mysql> create database testdb;
- Creating a User, and giving them perms:
- login to mysql mysql -u root -p
- mysql> grant usage on testdb.* to pingu@localhost; (creates user pingu, who can use testdb database)
- mysql> grant select, insert,delete on testdb.* to pingu@localhost;(Lets pingu select insert and delete)
- There are tons and tons of more options, this is just a basic, Q&D....
PHP Install
- Install the Main PHP Port
- cd /usr/ports/lang/php4/
- make install
- rehash
- sync
- Install PHP Extensions
- /usr/ports/lang/php4-extensions
- make install
- rehash
- sync
If all went well you should now have a Full FAMP installation, and a fully functional Web Server, CONGRATULATIONS!
Tutorial Author: RaMzi
RBPC@bellsouth.net
Special Thanks:
Gerbil & bWattel(gave me the FreeBSD fever,and tons of help)
Ookami (L337 Linux Skillz,kick ass forum, and Wiki)
