在FreeBSD上打开SSHD服务
1. 配置/etc/inetd.conf, 确保取消SSH的注释
2. 配置/etc/ssh/sshd_config, 确保PermitRootLogin yes
3. 配置/etc/rc.conf, 确保sshd_enable=”YES” (该步骤可选,但可在开机时自启动sshd服务)
4. 重启SSHD服务:/etc/rc.d/sshd restart
————————————————————————————–
Mysql的安装
shell> tar -zxvf mysql-5.0.28.tar.gz //解压mysql安装包
shell> cd mysql-5.0.28 //进入目录
shell> ./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/data //配置configure
shell> make //编译
shell> make install //安装
shell> pw group add mysql //建立mysql组
shell> pw user add -n mysql -d /usr/local/mysql -s /usr/sbin/nologin //建立用户
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql/ //进入mysql目录
shell> mkdir data //创建data文件夹
shell> bin/mysql_install_db –user=mysql //初始化表,并设置mysql访问权限
shell> chown -R root . //初始化root能访问 当前文件夹
shell> chown -R mysql data // 设定mysql用户能访问/usr/local/mysql/data ,里面存的是mysql的数据库文件
shell> chgrp -R mysql . // 设定mysql用户能访问/usr/local/mysql/data下的所有文件
shell> /usr/local/mysql/bin/mysqld_safe –user=mysql & // 运行mysql
shell> echo “/usr/local/mysql/bin/mysqld_safe &” >> /etc/rc.local // 让系统启动时自动运行mysql进程
shell> /usr/local/mysql/bin/mysqladmin -u root -p password 123456 // 修改mysql密码 freebsd ipfw
enter password: // 修改root口令时提示输入当前密码,因root初始密码为空,所以直接回车就可以了
shell> netstat -a // 查看mysql端口是否已经开启(3306)
安装完毕
————————————————————————————–
Apache的安装
shell> tar -zxvf httpd-2.2.17.tar.gz
shell> cd httpd-2.2.17
shell> ./configure –prefix=/usr/local/apache –enable-so –enable-mods-shared=all –enable-rewrite=shared –enable-speling=shared
shell> make
shell> make install
shell> /usr/local/apache/bin/apachectl -k start
————————————————————————————–
安装zlib
shell> tar -zxvf zlib-1.2.5.tar.gz
shell> cd zlib-1.2.5
shell> ./configure
shell> make
shell> make install
—————————————————————————————
安装libpng
shell> tar -zxvf libpng-1.4.4.tar.gz
shell> cd libpng-1.4.4
shell> ./configure
shell> make
shell> make install
—————————————————————————————-
安装gd
shell> tar -zxvf gd-2.0.35.tar.gz
shell> cd gd-2.0.35
shell> cp /usr/local/include/png.h .
shell> cp /usr/local/include/pngconf.h .
shell> ./configure
shell> make
shell> make install
—————————————————————————————–
安装libxml
shell> tar -zxvf libxml2-2.7.8.tar.gz
shell> cd libxml2-2.7.8
shell> ./configure
shell> make
shell> make install
—————————————————————————————–
安装libiconv
shell> tar -zxvf libiconv-1.13.1.tar.gz
shell> cd libiconv-1.13.1
shell> ./configure && make && make install
——————————————————————————————
安装perl
shell> tar -zxvf perl-5.12.2.tar.gz
shell> cd perl-5.12.2
shell> ./configure.gnu
shell> make
shell> make test
shell> make install
——————————————————————————————
安装PHP
shell> tar -zxvf php-5.2.14.tar.gz
shell> cd php-5.2.14
shell> head -1 /usr/local/apache/bin/apxs
shell> ee /usr/local/apache/bin/apxs // 把#!/replace/with/path/to/perl/interpreter -w 更改为”#!/usr/bin/perl -w”. 再运行php的configure, 一切正常!
shell> ./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-apxs2=/usr/local/apache/bin/apxs –with-libxml-dir=/usr/local/include/libxml2/libxml –with-xml –with-png-dir=/usr/local –with-gd –with-zlib –with-iconv –with-config-file-path=/usr/local/php/lib –enable-short-tags –enable-sockets –enable-mbstring –enable-dba –enable-soap –enable-wddx –enable-calendar –enable-bcmath –enable-ftp –enable-exif –disable-posix –with-expat
shell> make
shell> make test
shell> make install
shell> cp php.ini-dist /usr/local/php/lib/php.ini //把php.ini文件拷贝到config配置目录
shell> make clean
配置http.conf ( /usr/local/apache/conf/httpd.conf )
1、找到ServerName , 将 替换为本机的域名
ServerName www.example.com:80
2 找到”DirectoryIndex index.html”, 在”index.html”后面加入”index.php”
DirectoryIndex index.html index.php
3 找到, 在AddType application/x-gzip .gz .tgz下面加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
启动/停止apache
=====================
/usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl stop
——————————————————————————————
安装PDO_MYSQL
shell> tar -zxvf PDO_MYSQL-1.0.2.tgz
shell> cd PDO_MYSQL-1.0.2
shell> /usr/local/php/bin/phpize
shell> ./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-mysql=/usr/local/mysql
shell> make
shell> make test
shell> make install
完成后修改php.ini文件
extension_dir = “/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/”
extension = “pdo_mysql.so”
重启apache
—————————————————————————————-
重启apache时提示如下警告:No such file or directory: Failed to enable the ‘httpready’ Accept Filter
解决方法:kldload accf_http
并将以下加入到/boot/defaults/loader.conf文件,以便下次启动自动装载此模块
accf_data_load=”YES”
accf_http_load=”YES”
原因:不能启动FreeBSD自带的一个基于http端口过滤的模块。这个模块检查HTTP请求是否完整,即符合accpt规则的一个Http进程,否则就扔掉。
—————————————————————————————–
安装phpmyadmin
shell> tar -zxvf phpmyadmin.tar.bz
shell> mv phpmyadmin/ /usr/local/apache/htdocs