freebsd 初始化

1、建立wheel组的用户

useradd           #group 选wheel

2、启动sshd

ee /etc/inetd.conf          去掉ssh前的#

ee /etc/rc.conf               增加:sshd_enable="YES"

ee etc/ssh/sshd_config            PermitRootLogin no

/etc/rc.d/sshd start

3、pkg 换源 升级系统

su

mkdir -p /usr/local/etc/pkg/repos

ee /usr/local/etc/pkg/repos/mirrors.conf                    #pkg 源

内容: 

ustc: {
    url: "http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/latest",
    enabled: yes
}
FreeBSD: { enabled: no } #取消默认源

建立kmods源配置文件:

mv /etc/pkg/FreeBSD.conf /etc/pkg/FreeBSD.conf.back    #取消默认源

ee /usr/local/etc/pkg/repos/FreeBSD-kmods.conf    #内核模块源

内容:

FreeBSD-kmods {
	url: "https://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/kmods_quarterly_2",
	enabled: yes
}

pkg update -f         #更新源缓存

pkg version -vL=          #列出所有已安装的过时软件

pkg audit -F                 #审计已安装软件是否有漏洞

#升级系统软件

freebsd-update -s 'mirror.bjtu.edu.cn' fetch                   #使用北交大源升级系统 ,用q结束

freebsd-update -s 'mirror.bjtu.edu.cn' install

#freebsd-update -s 'freebsd-updates.mirrors.163.com' fetch        #备用

#freebsd-update -s 'freebsd-updates.mirrors.163.com' install

4、安装sudo

pkg install sudo

ee /usr/local/etc/sudoers

取消 %wheel ALL= (ALL:ALL) ALL前面的#                  #允许wheel组用户使用sudo

5、初始化 locate

/etc/periodic/weekly/310.locate                #建立查询datadb数据库

/usr/libexec/locate.updatedb                    #更新查询datadb

6、安装配置zsh

pkg install zsh zsh-autosuggestions zsh-fast-syntax-highlighting

chsh -s /usr/local/bin/zsh            #修改默认shell

ee ~/.zshrc 

内容:

# Set up the prompt

autoload -Uz promptinit
promptinit
prompt adam1

setopt histignorealldups sharehistory

# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e

# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history

# Use modern completion system
autoload -Uz compinit
compinit

zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
#eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true

zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

setopt nonomatch

export CLICOLOR=1
export LSCOLORS="ExGxFxdaCxDaDahbadeche"

alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

alias ll='ls -alhFG'
alias la='ls -A'
alias l='ls -CF'

source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/local/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh

#alias updatedb="sudo /usr/libexec/locate.updatedb"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值