freebsd常用配置文件

本文档详细展示了FreeBSD系统的配置文件,包括/boot/loader.conf、/etc/rc.conf、/etc/ttys、/etc/make.conf、/etc/fstab、/etc/sysctl.conf等,涵盖了网络设置、启动选项、终端配置、编译选项、文件系统和内核参数等方面,为FreeBSD服务器管理和优化提供参考。

>cat /boot.config  
-mnq    #减少启动时的输出


>cat /boot/loader.conf 

autoboot_delay="2"
beastie_disable="YES"
#hint.acpi.0.disabled="1"
#geom_label_load="YES"

nvidia_load="YES"

vboxdrv_load="YES"


>cat /etc/rc.conf 
# -- sysinstall generated deltas -- # Sat Jan 23 03:39:04 2010
# Created: Sat Jan 23 03:39:04 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
defaultrouter="192.168.1.1"
hostname="mybsd.zsoft.com"
ifconfig_nfe0="inet 192.168.1.2 netmask 255.255.255.0"
keymap="us.iso"
#linux_enable="YES"
apm_enable="YES"
dbus_enable="YES"
hald_enable="YES"
background_fsck="NO"
#moused_port="/dev/psm0"
#moused_type="auto"
#moused_flags="-F 200 -A 1.5.2.0 -a 0.7 -r high -V"
#moused_enable="YES"

sendmail_enable="NONE"
sendmail_msp_queue_enable="NO"
sendmail_outbound_enable="NO"
sendmail_submit_enable="NO"

#ntpdate_enable="YES" # Run ntpdate to sync time on boot (or NO).
#ntpdate_flags="210.72.145.44" # cn.pool.ntp.org

clear_tmp_enable="YES"
clear_tmp_X="YES"


>cat /etc/ttys

# name getty type status comments
#
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none unknown off insecure
#
ttyv0 "/usr/libexec/getty Pc" xterm on  secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" xterm off secure
ttyv2 "/usr/libexec/getty Pc" xterm off secure
ttyv3 "/usr/libexec/getty Pc" xterm off secure
ttyv4 "/usr/libexec/getty Pc" xterm off secure
ttyv5 "/usr/libexec/getty Pc" xterm off secure
ttyv6 "/usr/libexec/getty Pc" xterm off secure
ttyv7 "/usr/libexec/getty Pc" xterm off secure
ttyv8 "/usr/local/bin/slim"   xterm on  secure
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure

...


>cat /etc/make.conf
#SUP= /usr/bin/csup
#SUPFLAGS= -g -L 2
#SUPHOST= cvsup.freebsdchina.org
#SUPFILE= /usr/share/examples/cvsup/standard-supfile
#PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile
#DOCSUPFILE= /usr/share/examples/cvsup/doc-supfile

#ACPI_DEBUG=1

#FETCH_CMD=wget -c -t 1
#FETCH_CMD=proz -s -k 10 -r --no-curses
FETCH_CMD=axel -a
#FETCH_BEFORE_ARGS= -n 5 -a
#FETCH_AFTER_ARGS=

DISABLE_SIZE=yes

#FETCH_ENV=http_proxy=http://proxy2.zsu.edu.cn:3128
#FETCH_ENV=ftp_proxy=http://proxy2.zsu.edu.cn:3128
#FETCH_CMD=proxychains wget or runsocks wget

# ports compilation flag
CPUTYPE=athlon64
#CFLAGS=-O2 -fno-strict-aliasing -pipe
#CXXFLAGS+=-fconserve-space 

# kernle compilation flag
COPTFLAGS=-O2 -pipe

MASTER_SITE_BACKUP?= \
http://mirrors.163.com/FreeBSD/distfiles/${DIST_SUBDIR}/ \
http://mirrors.ustc.edu.cn/freebsd/ports/distfiles/${DIST_SUBDIR} \
http://ports.hshh.org/${DIST_SUBDIR}/ \
ftp://ftp.cn.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR} \
ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/

MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}

#FIREFOX_I18N+= zh-CN
#OVERRIDE_LINUX_BASE_PORT=fc6
#MODULES_OVERRIDE = linux acpi sound/sound sound/driver/ds1 ntfs
#WITHOUT_MODULES = linux acpi sound/sound sound/driver/ds1 ntfs
# Begin portconf settings
# Do not touch these lines
.if !empty(.CURDIR:M/media/G/usr/ports*) && exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/|/ /g}
${i:S/%/ /g}
.endfor
.endif
# End portconf settings
WITH_VIM_OPTIONS=yes
# added by use.perl 2012-04-16 11:10:59
PERL_VERSION=5.12.4


>cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ad4s3b none swap sw 0 0
/dev/ad4s3a / ufs rw,noatime 1 1
/dev/ad4s3e /tmp ufs rw 2 2
/dev/ad4s3f /usr ufs rw 2 2
/dev/ad4s3d /var ufs rw 2 2
/dev/acd0 /cdrom cd9660 ro,noauto 0 0
/dev/ad4s7 /media/F msdosfs rw 0 0
/dev/ad4s8 /media/G ext2fs rw 0 0
#proc /proc procfs rw 0 0
#none /tmp tmpfs rw 2 2


>cat /etc/sysctl.conf
# $FreeBSD: src/etc/sysctl.conf,v 1.8.34.1.2.1 2009/10/25 01:10:29 kensmith Exp $
#
# This file is read when going to multi-user and its contents piped thru
# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0


vfs.usermount=1

#编译内核的时候加了options TCP_DROP_SYNFIN才可以用,可以阻止某些OS探测
net.inet.tcp.drop_synfin=1

net.inet.ip.portrange.reservedhigh=0

kern.coredump=0


>cat /etc/portsnap.conf
# $FreeBSD: src/etc/portsnap.conf,v 1.5.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $

# Default directory where compressed snapshots are stored.
# WORKDIR=/var/db/portsnap

# Default location of the ports tree (target for "update" and "extract").
# PORTSDIR=/usr/ports

# Server or server pool from which to fetch updates. You can change
# this to point at a specific server if you want, but in most cases
# using a "nearby" server won't provide a measurable improvement in
# performance.
#SERVERNAME=portsnap.FreeBSD.org
SERVERNAME=portsnap.hshh.org
#SERVERNAME=portsnap.cn.freebsd.org

# Trusted keyprint. Changing this is a Bad Idea unless you've received
# a PGP-signed email from <security-officer@FreeBSD.org> telling you to
# change it and explaining why.
KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddbd64f13f978f2f3aede40c98633216c330

# Example of ignoring parts of the ports tree. If you know that you
# absolutely will not need certain parts of the tree, this will save
# some bandwidth and disk space. See the manual page for more details.
#
# WARNING: Working with an incomplete ports tree is not supported and
# can cause problems due to missing dependencies. If you have REFUSE
# directives and experience problems, remove them and update your tree
# before asking for help on the mailing lists.
#
# REFUSE arabic chinese french german hebrew hungarian japanese
# REFUSE korean polish portuguese russian ukrainian vietnamese

# List of INDEX files to build and the DESCRIBE file to use for each
INDEX INDEX-6 DESCRIBE.6
INDEX INDEX-7 DESCRIBE.7
INDEX INDEX-8 DESCRIBE.8


>cat /etc/mergemaster.rc
# Install the new file if it differs only by VCS Id (-F)
FREEBSD_ID=yes
#
# Automatically upgrade files that have not been user modified (-U)
AUTO_UPGRADE=yes
#
# Automatically install files not on the system already (-i)
AUTO_INSTALL=yes
#
# Preserve files that you replace
PRESERVE_FILES=yes
PRESERVE_FILES_DIR=/var/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
#
# Delete stale files in /etc/rc.d without prompting
DELETE_STALE_RC_FILES=yes
#
# Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C)
COMP_CONFS=yes
#
######################################################
# The following options have no command line overrides
######################################################
#
# Files to always avoid comparing
IGNORE_FILES='/etc/motd /etc/printcap'
#
# Additional options for diff. This will get unset when using -s.
DIFF_OPTIONS='-Bb' # Ignore changes in whitespace


>cat ~/.cshrc
# $FreeBSD: src/share/skel/dot.cshrc,v 1.14.6.1 2008/11/25 02:59:29 kensmith Exp $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).


#set prompt="[%Y-%W-%D %P]%n@%~%#"
set prompt="[%P]%n@%~%#"
set nobeep
set autolist

alias ls ls -GF

alias playcd mplayer -cdrom-device /dev/cd0
alias playdvd mplayer -autosync 30 -dvd-device /dev/cd0
alias ejectcd cdcontrol eject

alias vi vim


#set autolist=ambiguous

setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-stable/Latest/
#ssetenv PACKAGESITE http://mirrors.163.com/FreeBSD/releases/i386/9.0-RELEASE/packages/Latest/


# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin $HOME/.cabal/bin/)


setenv EDITOR vim
setenv PAGER more
setenv BLOCKSIZE K
setenv LANG zh_CN.UTF-8
setenv LC_LANG zh_CN.UTF-8
setenv LC_TYPE zh_CN.UTF-8
setenv XMODIFIERS '@im=fcitx'
setenv PYTHONSTARTUP /media/G/www/qachina/db/doc/python/python_ini.py
setenv CCACHE_DIR /usr/ccache

bindkey "\e[3~" delete-char
bindkey "\e[1~" beginning-of-line

if ($?prompt) then
# An interactive shell -- set some stuff up
set filec
set history = 100
set savehist = 100
set mail = (/var/mail/$USER)
if ( $?tcsh ) then
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
endif
endif


>cat ~/.xinitrc

#!/bin/sh
#
# ~~/.xinitrc
#
# Executed by startx (run your window manager from here)

xset -dpms
xset s 2400 600
xset m 1/1 1 #disable X's own mouse acceleration
xset fp+ /usr/local/lib/X11/fonts/myfont
xset fp rehash

xsetroot -cursor_name left_ptr
#setxkbmap -option terminate:ctrl_alt_bksp

export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

xmodmap ~/.Xmodmap
#mixer vol 95 pcm 95

case $1 in
stumpwm)
    /usr/local/etc/rc.d/musicpd onestart
    exec ~/bin/stumpwm
    ;;
jwm)
    export XIM_PROGRAM=/usr/local/bin/fcitx
    export XMODIFIERS=@im=fcitx
    export GTK_IM_MODULE=fcitx
    export QT_IM_MODULE=fcitx
    fcitx &
    exec /usr/local/bin/jwm
    ;;
*)
    #xterm -geometry 159x25+0+438 -e "tmux -q has-session && exec tmux attach-session -d || exec tmux new-session -n$USER -s$USER@$HOSTNAME" &

    xterm -geometry 159x25+0+438 -e ~/bin/tmuxz &
    exec /usr/local/bin/dwm
    ;;
esac


>cat ~/bin/tmuxz

#!/bin/sh
 
cmd=$(which tmux)
session=$USER@$HOSTNAME
 
if [ -z $cmd ]; then
  echo "You need to install tmux."
  exit 1
fi
 
$cmd has -t $session
 
if [ $? != 0 ]; then
  $cmd new -d -n vim -s $session "csh"
  $cmd splitw -h -p 35 -t $session "csh"
  $cmd select-pane -t 0
fi 

$cmd att -t $session
 
exit 0

 


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值