Jump to navigation

You are currently browsing all posts tagged with 'freebsd'

freebsd下查看cpu信息

  • Posted on April 23, 2010 at 3:53 pm

freebsd下没有 /proc 文件系统,就更加没有 /proc/cpuinfo 了。
据说国内某公司申请了 /proc 文件系统的专利?

[root@super ~]# sysctl -a | egrep -i ‘hw.machine|hw.model|hw.ncpu’
hw.machine: i386
hw.model: Intel(R) Xeon(R) CPU 5110 @ 1.60GHz
hw.ncpu: 2
hw.machine_arch: i386

[root@super ~]# grep -i cpu /var/run/dmesg.boot
CPU: Intel(R) Xeon(R) CPU 5110 @ 1.60GHz (1595.94-MHz 686-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
cpu0: on acpi0
ACPI Error (psparse-0626): Method parse/execution failed [\\_PR_.CPU1._PDC] (Node 0xc63172a0), AE_BAD_SIGNATURE
p4tcc0: on cpu0
cpu1: on acpi0
ACPI Error (psparse-0626): Method parse/execution failed [\\_PR_.CPU2._PDC] (Node 0xc63171a0), AE_BAD_SIGNATURE
p4tcc1: on cpu1
SMP: AP CPU #1 Launched!

#sysctl -a | grep -i cpu | less

在freebsd平台上安装并配置vim,lftp,rsyncd

  • Posted on January 21, 2010 at 9:02 am

安装vim:

cd /usr/ports/editors/vim
make install clean

在经过漫长的版本搜索后会安装一个vim 7.x
采用符号链接的形式,把原来的vi,换成现在的vim
rm /usr/bin/vi
ln -s /usr/local/bin/vim /usr/bin/vi

设置vim:

[root@super /data/tmp]# cat /root/.vimrc
set nu
syntax on
set nocompatible

打开一个文件,如果还是没有语法高亮,那么 logout之后,再重新登录试一下。

安装lftp:
cd  /usr/ports/ftp/lftp

make install clean

lftp 有一个 -f的选项,可以执行一个文件里面的FTP指令,然后退出。

如:  xxx.ftp内容如下:

open -u 用户名,密码 -p 端口 IP
lcd /data/tmp
cd  /data/bak/mysql
put mysql_bk.tar.gz
bye

然后在命令行或者脚本里面用 /usr/local/bin/lftp -f  xxx.ftp 来运行。

为了使lftp正常工作,防火墙 /etc/ipf.rules 需要做如下的配置:

# Allow out LAN PC client FTP to public Internet
# Active and passive modes
pass out quick on rl0 proto tcp from any to any port = 21 flags S keep state
# Allow out passive mode data channel high order port numbers
pass out quick on rl0 proto tcp from any to any port > 1024 flags S keep state
# Active mode let data channel in from FTP server
pass in quick on rl0 proto tcp from any to any port = 20 flags S keep state

安装rsyncd和rsync:
cd /usr/ports/net/rsync
make install clean
编辑配置文件:

vi /usr/local/etc/rsyncd.conf

[bak]
path = /data/tmp
comment = backup of mysql and apache
uid = nobody
gid = nobody
auth users = huarong_rsync
secrets file = /usr/local/etc/rsyncd.secrets

修改文件权限:
chmod 600 /usr/local/etc/rsyncd.secrets
设置密码:

vi /usr/local/etc/rsyncd.secrets
huarong_rsync:密码

设置为开机启动:
vi /etc/rc.conf
rsyncd_enable=”YES”

启动:
/usr/local/etc/rc.d/rsyncd start

查看rsyncd是否正常启动:
[root@super /usr/ports/net/rsync]# ps aux|grep rsync
root      2132  0.0  0.0  3140  1156  ??  Is    3:23PM   0:00.00 /usr/local/bin/rsync –daemon
root      2246  0.0  0.0  3344   980  p1  S+    3:25PM   0:00.00 grep rsync
[root@super /usr/ports/net/rsync]# sockstat | grep rsync
root     rsync      2132  3  dgram  -> /var/run/logpriv
root     rsync      2132  4  tcp6   *:873                 *:*
root     rsync      2132  5  tcp4   *:873                 *:*

防火墙需要做如下配置:
[root@super /data/tmp]# cat /etc/ipf.rules | grep 873
pass in quick on em0 proto tcp from rsync客户端IP to any port = 873 flags S keep state
pass out quick on em0 proto tcp from any port = 873 to rsync客户端IP  flags S keep state

RSYNC客户端配置
1、配置rsyncd.secrets
vi  /etc/rsyncd.secrets //加入以下内容

RXHOEqat6Dhon4HRsM31 //Rsync Server上的认证密码,不用输入用户名

chmod 600 /etc/rsyncd.secrets

2、进行第一次同步
rsync -avzP –delete –password-file=/etc/rsyncd.secrets    huarong_rsync@远程服务器IP::bak  /data/bak

Top