安装pure-ftpd

FreeBSD 7.0-RELEASE-i386

# cd /usr/ports/ftp/pure-ftpd && make install clean

如果用户多可以用MYSQL或者PGSQL管理。

# mkdir /home/ftp
# pw useradd ftp -g ftp -G www -c “PureFTPd user Management” -d /home/ftp -s /sbin/nologin
# pw usermod -n www -G ftp
# chown ftp:ftp /home/ftp
# cp /usr/local/etc/pure-ftpd.conf.sample /usr/local/etc/pure-ftpd.conf
# chmod 664 /usr/local/etc/pure-ftpd.conf
# ee /usr/local/etc/pure-ftpd.conf

77行:NoAnonymous yes
126行:PureDB /usr/local/etc/pureftpd.pdb
240行:MinUID 1000
311行:AltLog stats:/var/log/pureftpd.log

如果ftpname为wheel组,是不可以成为FTP用户的,要该为其他组
# pw usermod -n ftpname -g ftp
# pw usermod -n ftpname -G wheel

# /usr/local/bin/pure-pw useradd ftpu -u ftpname -d /home/ftpname/public

ftpu是FTP用户名,-u ftpname是实际FreeBSD用户,-d锁定起始目录,-D不锁定。如果需要不同权限,建立新的FreeBSD用户、组与之对应。

# /usr/local/bin/pure-pw mkdb /usr/local/etc/pureftpd.pdb
# pw usermod -n ftpname -g wheel

$ mkdir /home/ftpname/public
$ ln -s /usr/local/www/apache22/data /home/ftpname/public/www

# echo ‘pureftpd_enable=”YES”‘ >> /etc/rc.conf
# chown -R ftpname:wheel /usr/local/www/apache22/data

# /usr/local/etc/rc.d/pure-ftpd start

修改用户目录:
# /usr/local/bin/pure-pw usermod ftpu -d /home/ftpname/public

# /usr/local/bin/pure-pw mkdb /usr/local/etc/pureftpd.pdb
# /usr/local/etc/rc.d/pure-ftpd restart

修改用户密码
# /usr/local/bin/pure-pw passwd username -m

安装cacti监控

FreeBSD 7.0-RELEASE-i386

# cd /usr/ports/net-mgmt/net-snmp && make install clean
# cd /usr/ports/net-mgmt/cacti && make install clean

ucd-snmp不选

# make pretty-print-run-depends-list

This port requires package(s) “mysql-client-5.0.67_1” to run.

# cd /usr/ports/databases/mysql50-server && make install clean
# echo ‘mysql_enable=”YES”‘ >> /etc/rc.conf
# /usr/local/etc/rc.d/mysql-server start
# mysqladmin –user=root create cacti
# echo “GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactiuser’; FLUSH PRIVILEGES;” | mysql
# mysql cacti < /usr/local/share/cacti/cacti.sql

# echo ‘rocommunity public’ >> /usr/local/share/snmp/snmpd.conf
# /usr/local/etc/rc.d/snmpd start
# netstat -na | grep “LISTEN”
# sockstat

//199 161 port

# snmpwalk -v 1 -c public 127.0.0.1 system

# ee /etc/rc.conf

snmpd_enable=”YES”
snmpd_flags=”-a”
snmpd_pidfile=”/var/run/snmpd.pid”
snmptrapd_enable=”YES”
snmptrapd_flags=”-a -p /var/run/snmptrapd.pid”

# ee /usr/local/share/cacti/include/config.php
# ee /usr/local/etc/apache22/Includes/cacti.conf

Alias /cacti “/usr/local/share/cacti/”

<Directory “/usr/local/share/cacti/”>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# apachectl configtest
# apachectl restart

# cd /usr/ports/databases/phpmyadmin && make install clean
# cp /usr/local/www/phpMyAdmin/config.sample.inc.php /usr/local/www/phpMyAdmin/config.inc.php
# ee /usr/local/www/phpMyAdmin/config.inc.php

$cfg[‘blowfish_secret’] = ‘erw34’; //随便写什么

# ee /usr/local/etc/apache22/Includes/phpmyadmin.conf

Alias /phpmyadmin/ “/usr/local/www/phpMyAdmin/”

<Directory “/usr/local/www/phpMyAdmin/”>
Options none
AllowOverride Limit

Order Deny,Allow
Deny from all
Allow from 127.0.0.1 .example.com
</Directory>

# apachectl configtest
# apachectl restart

http://localhost/cacti/
next >> 完成
登录名:admin
密码:admin
配置完成后。

# /usr/local/bin/php /usr/local/share/cacti/poller.php
# crontab -u cacti -e

*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1

# cat /usr/local/share/cacti/log/cacti.log

参考:
CACTI Version 0.8.7a for FreeBSD 6.2 release 配置全攻略

FreeBSD下用cacti抓取内存信息的方法

安装awstats的过程

# mkdir /etc/awstats
# mkdir /var/lib
# mkdir -m 777 /var/lib/awstats
# cp /usr/local/www/awstats/cgi-bin/awstats.model.conf /etc/awstats/awstats.www.mysite.com.conf
# ee /etc/awstats/awstats.www.mysite.com.conf

第51行:LogFile=”/var/log/apache/www.mysite.com/%YYYY-24%MM-24/httpd-access_%YYYY-24%MM-24%DD-24.log”
第152行:SiteDomain=”www.mysite.com”
第167行:HostAliases=”mysite.com www.mysite.com 127.0.0.1 localhost 192.168.0.74″
第202行:DirData=”/var/lib/awstats”
第238行:AllowToUpdateStatsFromBrowser=1
第449行:DefaultFile=”index.php index.htm index.html”
第1515行:Include “awstats.www.mysite.com.conf”

# ee /usr/local/etc/apache22/Includes/awstats.conf

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses “/usr/local/www/awstats/classes/”
Alias /awstatscss “/usr/local/www/awstats/css/”
Alias /awstatsicons “/usr/local/www/awstats/icons/”
ScriptAlias /awstats/ “/usr/local/www/awstats/cgi-bin/”

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory “/usr/local/www/awstats/”>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# apachectl configtest
# apachectl restart

# ee /usr/local/www/awstats/update-logs.sh

/usr/local/www/awstats/cgi-bin/awstats.pl -config=www.mysite.com -update

# chmod 755 /usr/local/www/awstats/update-logs.sh
# setenv EDITOR ee
# crontab -e

10 1 * * * /bin/csh /usr/local/www/awstats/update-logs.sh

不统计指定IP的访问量
SkipHosts=”x.x.x.x.”

参考:安装Apache2.2


免费在线记账服务,个人理财好帮手,小型企业财务管理工具。
http://www.keepaccounts.com/

FREEBSD常用命令

FreeBSD 7.0-RELEASE-i386

删除Thumbs.db文件
find ./ -name “*.db” -delete

显示所有没有被注释的
# cat file | grep -v ‘^#’

搜索PORTS软件
# whereis XXXX

系统情况
top
vmstat -s
lmmon -i
mbmon
xmbmon

自定义pkg_add安装的服务器
setenv PACKAGEROOT ftp://ftp.cn.freebsd.org

Port 的相关命令

生成配置文件
make config
删除配置文件
make rmconfig
抓取源码包
make fetch
抓取所有源码包(包括需要到的所有包)
make fetch-recursive
校验源码包
make checksum
编译、安装并删除临时文件
make install clean
编译、安装、将所有需要的port打包、安装、并删除临时文件
make depends_target=package package clean
mkdir -p /usr/ports/packages/All/
生成的package会自动放到里面,否则放在port的当前目录
仅解开源码包
make extract
仅解开并打上patch
make patch
删除临时文件及源码包
make distclean
查询port的依赖关系
make all-depends-list #显示所有相关的套件
make pretty-print-build-depends-list
#显示编译期间所需要的套件
make pretty-print-run-depends-list
#显示此套件要执行时所需要的套件
删除已经安装的port
make deinstall
删除已经安装的port及其依赖
make deinstall-depends
重新安装port
make reinstall
搜索port
make search key=keyword
make search name=nameword
指定port安装目录
make PREFIX=path install
更新port MK
cd /usr/src/share/mk
make install
解决安装时的sed -i 错误
make -DUSE_REINPLACE install
更新port index对照表
cd /usr/ports/
make index
更新index html
cd /usr/ports/
make readmes

# pw groupadd 创建新组


免费在线记账服务,个人理财好帮手,小型企业财务管理工具。
http://www.keepaccounts.com/

FREEBSD安装中文桌面的过程

FreeBSD 7.0-RELEASE-i386

CD安装Xorg、KDE(速度快)

# sysinstall
Configuration->packages->选择cd->进入x11->找xorg->选中->install
Configuration->packages->选择cd->进入KDE->找kde->选中->install
(选择FTP也可以)

或者编译安装Xorg、KDE(速度慢)

# cd /usr/ports/x11/xorg && make OPTIONS=NO install clean
# cd /usr/ports/x11/kde3 && make OPTIONS=NO install clean
(约20—-30小时,期间可能有错误停止编译)

或者使用
# pkg_add -r xorg
# pkg_add -r kde3
(速度比较快)

不配置/etc/X11/xorg.conf,使用系统自动配置
要自己配置的话:

# Xorg -configure
# Xorg -config xorg.conf.new
# cp xorg.conf.new /etc/X11/xorg.conf

# startx
测试,Ctrl+Alt+Backspace退出X

安装中文环境
# cd /usr/ports/chinese/kcfonts && make install clean
# cd /usr/ports/chinese/arphicttf && make install clean
# cd /usr/ports/chinese/kde3-i18n-zh_CN && make install clean
# cd /usr/ports/chinese/koffice-i18n-zh_CN && make install clean
如果您想要有Windows的字体,可以到将Win上面的字体COPY到下面的目录
# cd /usr/X11R6/lib/X11/fonts/TrueType

安装FireFox:
# cd /usr/ports/www/firefox3 && make install clean
# cd /usr/ports/www/firefox3-i18n && make install clean
在地址栏输入about:config,搜索general.useragent.locale,改为zh-CN

出错处理:
# cd /usr/ports/devel/glib20 && make OPTIONS=NO FORCE_PKG_REGISTER=YES install clean
(http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2008-10/msg01701.html)
# cd /usr/ports/x11/pixman && make OPTIONS=NO FORCE_PKG_REGISTER=YES install clean
# cd /usr/ports/graphics/cairo && make OPTIONS=NO FORCE_PKG_REGISTER=YES install clean
(http://www.nabble.com/CALL-FOR-TEST:-Updates-to-pixmap,-cairo,-poppler,-and-firefox-3.0!-td17960163.html)

安装聊天工具 gaim
# cd /usr/ports/net-im/pidgin && make install clean

中文输入法安装:
# cd /usr/ports/chinese/scim-tables/ && make install clean #五笔
# cd /usr/ports/chinese/scim-pinyin/ && make install clean #拼音
# ee ~/.cshrc

setenv LANG zh_CN.eucCN
setenv LC_CTYPE zh_CN.eucCN
setenv XMODIFIERS @im=SCIM
setenv GTK_IM_MODULE scim

# echo “exec /usr/local/bin/scim &” >> ~/.xinitrc
# echo “exec /usr/local/bin/startkde” >> ~/.xinitrc
# startx

进入KDE。
找到Setting->Desktop Setting Wizard选择中文。
然后打开”控制中心”->外观和主题->字体,里面设置你所需要的中文字体和字体大小。强制字体DPI越大字越大。
打开FireFox,打开about:config,搜索layout.css.dpi,设置dpi为0,-1为FireFox默认的DPI,0为KDE系统DPI。

备注:安装过程如有软件版本冲突,安装命令加FORCE_PKG_REGISTER=YES强行安装

# cat /etc/X11/xorg.conf
Section “ServerLayout”
Identifier “X.org Configured”
Screen 0 “Screen0” 0 0
InputDevice “Mouse0” “CorePointer”
InputDevice “Keyboard0” “CoreKeyboard”
EndSection

Section “Files”
RgbPath “/usr/local/share/X11/rgb”
ModulePath “/usr/local/lib/xorg/modules”
FontPath “/usr/local/lib/X11/fonts/misc/”
FontPath “/usr/local/lib/X11/fonts/TTF/”
FontPath “/usr/local/lib/X11/fonts/OTF”
FontPath “/usr/local/lib/X11/fonts/Type1/”
FontPath “/usr/local/lib/X11/fonts/100dpi/”
FontPath “/usr/local/lib/X11/fonts/75dpi/”
EndSection

Section “Module”
Load “GLcore”
Load “dbe”
Load “dri”
Load “extmod”
Load “glx”
Load “record”
Load “xtrap”
Load “freetype”
Load “type1”
EndSection

Section “InputDevice”
Identifier “Keyboard0”
Driver “kbd”
EndSection

Section “InputDevice”
Identifier “Mouse0”
Driver “mouse”
Option “Protocol” “auto”
#Option “Device” “/dev/sysmouse”
Option “ZAxisMapping” “4 5 6 7”
EndSection

Section “Monitor”
Identifier “Monitor0”
VendorName “Monitor Vendor”
ModelName “Monitor Model”
EndSection

Section “Device”
Identifier “Card0”
Driver “vesa”
VendorName “Silicon Integrated Systems [SiS]”
BoardName “661/741/760 PCI/AGP or 662/761Gx PCIE VGA Display Adapter”
BusID “PCI:1:0:0”
EndSection

Section “Screen”
Identifier “Screen0”
Device “Card0”
Monitor “Monitor0”
DefaultDepth 24
SubSection “Display”
Viewport 0 0
Depth 24
Modes “1024×768” “800×600”
EndSubSection
EndSection


免费在线记账服务,个人理财好帮手,小型企业财务管理工具。
http://www.keepaccounts.com/