一、最小化安装FreeBSD略之。二、设置ROOT用户密码,设置IP,并设置时区,系统时间2.1 设置ROOT用户密码sysinstall->Configure->Root Password[我设置了一个十四位的密码]2.2 设置IP地址sysinstall->Configure->Networking->Interface[选中后单击空格键],一般情况下选择第一个,例如:VM中为le0。按空格键继续。此时会出现一系列的对话框:(1)是否使用IPv6地址 现在选择“No”;(2)是否配置DHCP,如果你的电脑为自动被分派IP的就Y,否就N。一般选择N。(3)开始配置IP::Host:ftp.shenzhi.com Domain:shenzhi.comIPv4 Address:192.168.0.205选择OK,其余项有系统自动填充有不用填的。之后有一个对话框,问是否现在激活网卡。选Y。重启生效。2.3 设置时区sysinstall->Configure->Time Zone->No[对话框]->5 Asia->9 China->1 east China...->Yes2.4 设置系统时间比如现在时间为:14:06 2009-10-12,则在命令行中输入:date 0910121406[年月日时分,均占用2位数字]三、开通SSH服务3.1 修改/etc/inetd.conf文件,把SSH服务打开,保存退出编辑/etc/rc.conf 最后加入:sshd_enable="yes"即可激活sshd服务。记得修改完配置文件后,重新启动sshd服务器(/etc/rc.d/sshd restart)即可。3.2 备份将要修改的文件#cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak3.3 编辑sshd_config文件#vi /etc/ssh/sshd_config,":set number"对应行分别更改为:42行:“#PermitRootLogin no” 改为:“PermitRootLogin yes” #允许root登录43行:“#StrictModes yes” 改为:“StrictModes yes”46行:“#RSAAuthentication yes” 改为:“RSAAuthentication yes”56行:“#IgnoreUserKnownHosts no” 改为:“IgnoreUserKnownHosts yes”58行:“#IgnoreRhosts yes” 改为:“IgnoreRhosts yes”61行:“#PasswordAuthentication no” 改为:“PasswordAuthentication yes” # 设置是否使用口令验证。62行:“#PermitEmptyPasswords no” 改为:“PermitEmptyPasswords no” #不允许空密码登录93行:“#PrintMotd yes” 改为:“PrintMotd yes”下面是我的配置文件:(/etc/ssh/sshd_config)#/etc/rc.d/sshd start四、LAMP服务环境安装以famp4.0.2中所提供的软件和脚本为基础。4.1 通过SSH工具将famp4.0.2.tar上传到/usr目录,因为此目录所在的分区较大。4.2 解压缩:#tar zxvf famp4.0.24.3 安装perlcd perl./configure.gnu -de --prefix=/usr/local/perl -Dusedevelmakemake install cleanln -s /usr/local/perl/bin/perl5.9.5 /usr/bin/perl4.4 安装make->...->MySQLcd ../make./configure --prefix=/usr/local/makemake; make install cleancd ../jpeg-6b./configure --prefix=/usr/local/jpeg CFLAGS=' -O2 -I$(srcdir) -fPIC'makemkdir -p /usr/local/jpeg/libmkdir -p /usr/local/jpeg/binmkdir -p /usr/local/jpeg/includemkdir -p /usr/local/jpeg/man/man1make installmake install-libmake cleancd ../libpng./configure --prefix=/usr/local/libpngmakemake install cleancd ../libxml./configure --prefix=/usr/local/libxmlmakemake install cleancd ../freetype./configure --prefix=/usr/local/freetype/usr/local/make/bin/make/usr/local/make/bin/make install cleancd ../gd./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype/usr/local/make/bin/make/usr/local/make/bin/make install cleancd ../mysql./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charsets=all --enable-thread-safe-client --without-debug --with-mysqld-ldflags=-all-staticmakemake install cleanpw useradd mysql/usr/local/mysql/bin/mysql_install_db --user=mysqlchown -R root /usr/local/mysql/.chown -R mysql /usr/local/mysql/varchgrp -R mysql /usr/local/mysql/.cp ../my-huge.cnf /etc/my.cnf/usr/local/mysql/bin/mysqld_safe --user=mysql &ln -s /usr/local/mysql/lib/mysql/libmysqlclient* /usr/lib/cp ../mysql.sh /etc/rc.d/mysql.shln -s /etc/rc.d/mysql.sh /mysql-startcp ../mysql-stop /usr/local/mysql/ln -s /usr/local/mysql/mysql-stop /mysql-stopln -s /usr/local/mysql/bin/mysql /bin/mysqlreboot4.5 安装apache没有使用原有的文件,而是下载了一个新版本的文件。因为原有的文件安装两次都是失败的,当我试图将网页的根目录由/root/wwwroot更改为/usr/local/www时,怀疑可以在编译时加入选项“--with-config-file-path=/usr/local/apache/conf”指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在这个目录中。tar zxvf httpd-2.2.14.tar.gzcd httpd-2.2.14./configure --prefix=/usr/local/apache --enable-so --with-mpm=worker --enable-rewrite --enable-alias --enable-mods-shared=allmakemake install cleanmkdir -p /usr/local/wwwchown -R root "/usr/local/www"配置Apache:修改/usr/local/apache/conf/httpd.conf4.5.1#ServerName www.example.com:80ServerName 192.168.0.205:804.5.2ServerRoot "/usr/local/apache"[此处一般不修改]4.5.3Listen 80[此处一般不修改]4.5.4#ServerAdmin you@example.comServerAdmin yunhuizheng2002@163.com4.5.5#DocumentRoot "/usr/local/apache/htdocs"DocumentRoot "/usr/local/www"4.5.6AddDefaultCharset utf8保存退出。添加虚拟目录[此处常用于phpMyAdmin的指向,当然也可用于其他,不过上述已经将phpMyAdmin放置于目录/usr/local/www中故不再设置]如果你的phpMyAdmin位于/usr/local/下则设置:找到# Alias /webpath/full/filesystem/path并在其下增添代码注:以下代码是指向/usr/local/phpMyAdmin目录的,意思是在浏览器地址栏中输入:http://localhost/phpMyAdmin即可访问服务器/usr/local/phpMyAdmin目录中的网页文件。 Alias /phpMyAdmin "/usr/local/phpMyAdmin" <Directory "/usr/local/phpMyAdmin"> AllowOverride None Options None Order allow,deny Allow from all </Directory>问题1:Apache启动时出现的:问题解决:Starting httpd: (98)Address already in use: make_sock: could not bindto address 0.0.0.0:80 no listening sockets available, shutting down 为什么apache不能重启netstat -natup |grep 80 看看80端口是那个进程占用了由于httpd 占有了80端口kill设置成开机自启动在/etc/rc.d/rc.local文件中加入一行/usr/local/apache/bin/apachectl start这样每次重新启动系统以后,apache也会随系统一起启动最后的手动修补操作:#kldload accf_http并将/boot/defaults/loader.conf中,以便下次启动自动装载模块accf_data_load="YES"accf_http_load="YES" 改了这一个就可以启动了。否则在启动apache时会出现如下错误:[上述修补操作就是针对此的]ftp# /usr/local/apache/bin/apachectl startWarning: DocumentRoot [/home/wwwroot] does not existhttpd not running, trying to start[Mon Oct 12 09:08:25 2009] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter4.6 安装PHP./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --disable-debug --with-libxml-dir=/usr/local/libxml --enable-mbstring --with-gd=/usr/local/gd --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-zlib --with-ttf --enable-gd-native-ttf --enable-ftp --without-iconvmakemake install cleancp php.ini-recommended /usr/local/php/lib/php.ini/usr/local/apache/bin/apachectl startcd ..cp -R phpmyadmin tz.php phpinfo.php /usr/local/www/更改apache设置实现其对PHP的支持# vi /usr/local/apache/conf/httpd.conf找到 DirectoryIndex index.html改为 DirectoryIndex index.html index.html.var index.htm index.php找到 AddType application/x-gzip .gz .tgz加 AddType application/x-httpd-php .php (注意空格) AddType application/x-httpd-php-source .phps[未操作]添加 AddDefaultCharset utf8 使apache默认支持utf8字符集保存配置文件就重启apache 的守护进程。/usr/local/apache/bin/apachectl restart(start/stop)=================================================重启apache# /usr/local/apache/bin/apachectl restart4.7 安装pure-ftpdcd pure-ftpd./configure --prefix=/usr/local/pureftpd --with-mysql --with-quotas --with-cookie --with-virtualhosts --with-virtualroot --with-diraliases --with-sysquotas --with-ratios --with-ftpwho --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=simplified-chinesemakemake install cleanpw groupadd ftpusers -g 2001pw useradd ftp -u 2001 -g ftpusers -s /sbin/nologinmkdir -p /usr/local/ftpchown ftp /usr/local/ftpchown -R root "/usr/local/ftp"/usr/local/mysql/bin/mysql < ../pureftpd.sqlcp ../pureftpd.sh /etc/rc.d/cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/chmod 744 /usr/local/pureftpd/sbin/pure-config.plcp ../pureftpd-mysql.conf /usr/local/pureftpd/cp ../pure-ftpd.conf /usr/local/pureftpd/chmod 4711 /usr/local/pureftpd/sbin/pure-ftpwhocp ../pureftpd.sh /usr/local/pureftpd/pureftpd-startcp ../pureftpd-stop /usr/local/pureftpd/cp ../pureftpd-restart /usr/local/pureftpd/cp -R ../pureftpd_php_manager /usr/local/www//etc/rc.d/pureftpd.shln -s /etc/rc.d/pureftpd.sh /pureftpd-startln -s /usr/local/pureftpd/pureftpd-stop /pureftpd-stopln -s /usr/local/pureftpd/pureftpd-restart /pureftpd-restart更改:/usr/local/www/pureftpd_php_manager/pureftp.config.php改$DefaultDir = "/home/ftp/";为$DefaultDir = "/usr/local/ftp/";4.8 在进入pureftpd_php_manager时出现以下错误:Can't establish DB connection.Access denied for user 'pureftpd'@'localhost' (using password: YES)使用root用户,及MySQL密码登录到phpmyadmin后,Import ->选择pureftpd.sql导入数据库[不对]更改一:ftp# cp /usr/local/pureftpd/pureftpd-mysql.conf /usr/local/pureftpd/pureftpd-mysql.conf.bakftp# ee /usr/local/pureftpd/pureftpd-mysql.conf改MYSQLPassword loveworking为MYSQLPassword 850429[不对]更改二:/usr/local/www/pureftpd_php_manager/pureftp.config.phpftp# ee /usr/local/www/pureftpd_php_manager/pureftp.config.php 改$DefaultUser = "";为$DefaultUser = "pureftpd"; 改$DefaultPass = "";为$DefaultPass = "850429";改$DefaultDir = "/home/ftp/";为$DefaultDir = "/usr/local/ftp/";4.9 zend安装编写脚本如下,设置成可执行属性,并放到famp4.0.2所在目录######################################################################cd FAMPfamp_hardware=`uname -m`famp_version=`uname -r`if [ $famp_hardware = "amd64" -a `echo $famp_version|cut -c1-1` = "6" ];thencp -R ./zend_64 /usr/local/Zendelif [ $famp_hardware = "amd64" -a `echo $famp_version|cut -c1-1` != "6" ];thencp -R ./zend_64 /usr/local/Zend cp -R ./famp_lib_files_64/* /lib/echo 'compat6x_enable="YES"' >> /etc/rc.confelif [ $famp_hardware = "i386" -a `echo $famp_version|cut -c1-1` = "6" ];thencp -R ./zend_32 /usr/local/Zendelse cp -R ./zend_32 /usr/local/Zend cp -R ./famp_lib_files_32/* /lib/echo 'compat6x_enable="YES"' >> /etc/rc.conffi######################################################################ftp# ./installThe FAMP install completed, Thank you for use it!
本文转自tiancong 51CTO博客,原文链接:http://blog.51cto.com/tiancong/656848