freebsd设置交换swap分区

dd if=/dev/zero of=/usr/swap0 bs=1m count=128

chmod 0600 /usr/swap0

echo ‘md99 none swap sw,file=/usr/swap0 0 0’ >> /etc/fstab

swapon -aq

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd" rel="tag">FreeBSD</a>、<a href="http://www.shaogroup.com/tag/%e8%ae%be%e7%bd%aeswap%e5%88%86%e5%8c%ba" rel="tag">设置swap分区</a> 发表回复

freebsd挂载ntfs格式硬盘

cd /usr/ports/sysutils/fusefs-ntfs && make BATCH=yes install clean
or
pkg install fusefs-ntfs
Then add to /boot/loader.conf

fuse_load=”YES”
Now run it:

/usr/local/etc/rc.d/fusefs start

Now – make dir for NTFS partition, for example:

mkdir /mnt/ntfs

Now – you can mount your NTFS in rw mode:

ntfs-3g -o rw,locale=zh_CN.UTF-8 /dev/ada0s3 /mnt/ntfs

After all – add to /etc/fstab:

/dev/ada0s1 /mnt/ntfs ntfs-3g rw,locale=zh_CN.UTF-8, mountprog=/usr/local/bin/ntfs-3g,uid=1001,gid=1001,late 0 0

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd" rel="tag">FreeBSD</a>、<a href="http://www.shaogroup.com/tag/mount-ntfs" rel="tag">mount ntfs</a> 发表回复

FreeBSD pkg仓库台湾的镜像

http://pkg.freebsd.org/ 在这个页面上可以看到:

pkg0.bme.freebsd.org
pkg0.nyi.freebsd.org
pkg0.twn.freebsd.org
pkg0.ydx.freebsd.org

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd" rel="tag">FreeBSD</a>、<a href="http://www.shaogroup.com/tag/pkg%e5%8f%b0%e6%b9%be%e9%95%9c%e5%83%8f" rel="tag">pkg台湾镜像</a> 发表回复

freebsd安装及安全使用SSMTP

第一步:ee /ec/rc.conf中加入

sendmail_enable=”NO”

sendmail_submit_enable=”NO”

sendmail_outbound_enable=”NO”

sendmail_msp_queue_enable=”NO”
killall sendmail

第二步:安装ssmtp:

pkg install ssmtp

ee /etc/mail/mailer.conf

sendmail /usr/libexec/sendmail/sendmail
send-mail /usr/libexec/sendmail/sendmail
mailq /usr/libexec/sendmail/sendmail
newaliases /usr/libexec/sendmail/sendmail
hoststat /usr/libexec/sendmail/sendmail
purgestat /usr/libexec/sendmail/sendmail
to

sendmail /usr/local/sbin/ssmtp
send-mail /usr/local/sbin/ssmtp
mailq /usr/libexec/sendmail/sendmail
newaliases /usr/libexec/sendmail/sendmail
hoststat /usr/libexec/sendmail/sendmail
purgestat /usr/libexec/sendmail/sendmail
第三步:创建ssmtp用户

pw useradd ssmtp -g nogroup -h – -s /sbin/nologin -d /nonexistent -c “sSMTP pseudo-user”

第四步:

cd /usr/local/etc/ssmtp

chown ssmtp:wheel .

chmod 4750 .

第五步:

cp ssmtp.conf.sample ssmtp.conf

chown ssmtp:wheel . ssmtp.conf

chmod 640 ssmtp.conf

第六步:编辑ssmtp.conf文件

mailhub=smtp.exmail.qq.com:465
UseTLS=YES
AuthUser=from@mydomain.com
AuthPass=123456
FromLineOverride=YES
Hostname=serverkvm
RewriteDomain=exmail.qq.com
Root=postmaster
cp revaliases.sample revaliases

root:from@mydomain.com:smtp.exmail.qq.com:465
from:from@mydomain.com:smtp.exmail.qq.com:465
chown ssmtp:nogroup /usr/local/sbin/ssmtp
chmod 4555 /usr/local/sbin/ssmtp

测试:echo “test” | mail -v -s “test mail” your_mail@domain.com

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd" rel="tag">FreeBSD</a>、<a href="http://www.shaogroup.com/tag/ssmtp" rel="tag">SSMTP</a> 发表回复

FreeBSD 10: Installing Apache 2.4, MySQL 5.5, and PHP5.5 — 找不到 libphp5.so

今天装freebsd 10,然后装apache,再装php和php扩展.没有问题.

然后重启apache,发现打不开php页面,提示下载.

刚开始以为php5安装错误了,于是又重新安装一次,发现安装php5时里面没有apache选项了,整了半天也没有发现原因,以前用freebsd8配置apache+php+mysql从来没出现过这种问题,就再试一下php53目录,make config-recursive看看里面是有apache选项的,郁闷,于是又出墙google,终于找到答案了,ls /usr/local/libexec/apache22/ 没找到libphp5.so

然后/usr/ports/www/mod_php5

make install clean;rehash安装,可是又遇到问题了,提示“Error from bsd.apache.mk. apache22 is installed (or APACHE_PORT is defined) and port requires apache”,郁闷之极,只能再google,呵呵,又被我找到答案了,万能的google啊,谢谢!关于“Error from bsd.apache.mk. apache22 is installed (or APACHE_PORT is defined) and port requires apache”请参考这篇文章

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd10" rel="tag">freebsd10</a>、<a href="http://www.shaogroup.com/tag/installing-apache-2-4" rel="tag">Installing Apache 2.4</a>、<a href="http://www.shaogroup.com/tag/libphp5-so" rel="tag">libphp5.so</a>、<a href="http://www.shaogroup.com/tag/mysql-5-5" rel="tag">MySQL 5.5</a>、<a href="http://www.shaogroup.com/tag/php5-5" rel="tag">PHP5.5</a> 发表回复

FreeBSD 11 on Raspberry Pi

Install FreeBSD 11 on a Raspberry Pi

 

It seems a nice project to try out FreeBSD on a Raspberry Pi.

There are ready made images available from FreeBSD.org, so this is not very hard to accomplish. Both for FreeBSD 10 as well as for FreeBSD 11. Feeling wild, I choose for FreeBSD 11 🙂

The image can be downloaded from the FreeBSD ftp-servers.

Bunzip your image and dd it to a SD-card

 

I got the FreeBSD-11.0-CURRENT-arm-armv6-RPI-B-20140811-r269824.img.bz2 but perhaps when you read this there are allready newer images available.

On a Debian GNU/Linux laptop I ran the command:

bunzip2 FreeBSD-11.0-CURRENT-arm-armv6-RPI-B-20140811-r269824.img.bz2

Followed by:

dd if=FreeBSD-11.0-CURRENT-arm-armv6-RPI-B-20140811-r269824.img of=/dev/mmcblk0 bs=1M

Be carefull when you issue this last command, when you got the of= part wrong, you might inreversable destroy things!

Now you have a 1Gb big image on your SD card.

Put the SD card in the Raspberry Pi and power up.

The very first time you boot FreeBSD on your Raspberry Pi it seems to take ages before you get a prompt. This is because FreeBSD is expanding the partion to fill your whole SD card. In my case it was a 8 Gb SD card. I rebooted the thing and now it did not take that long to give you a prompt.

When you have a prompt, press enter and log on as root, with an empty password (just hit Enter on the password prompt).

Now you first need to add a user, make that part of the group “wheel” and give this user a password. This is needed in order to log on to your FreeBSD Raspberry Pi over ssh.

Set fixed address

Default your FreeBSD Raspberry Pi will get its network configuration over DHCP. This is great if you want that, but I like my servers to have fixed addresses.

In /etc/rc.conf you can set the fixed address of the board and add a line with the default router:

ifconfig_ue0=”inet 192.168.0.123 netmask 255.255.255.0″

defaultrouter=”192.168.0.1″

Do not forget to check /etc/resolv.conf to see if this has the right nameserver(s).

Set timezone

Become root.

Make a symbolic link for your timezone to /etc:

ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime

Update the time on your board;

ntpdate -v -b in.pool.ntp.org

And edit /etc/rc.conf, add the following line:

ntpdate_enable=”YES”

ntpd_enable=”YES”

Configure sshd

 

When your Raspberry Pi is connected to the internet, it is important to harden your sshd_config. The best is to disable password login, only allow public key authentication and only for restricted users. Something like “Match Group wheel” is a good start.

No pkg install

 

Unfortunately, installing pre-compiled binary packages with the new pkg will not work on your Raspberry Pi.

Hardware stability is an issue

 

I own several Raspberry Pies and not all of them are stable. Also the Raspberry Pi is notorious picky about the powersupply cable (USB cable) as well as the powersupply. Problems with the powersupply cable and the powersupply are hard to diagnose.

If you run into problems, the USB cable and the powersupply are the first things to check. I have seen Raspberries that, when powered on, only show a single, red, LED burning, with all the other LEDs are off. This often is the result of a USB-cable or power supply not playing nice with the Rapsberry – even if the same combination have run wihout problems for weeks.

On the other hand, there are also a couple Raspberries running in my network with high uptimes and never have shown any problem …

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd-11" rel="tag">FreeBSD 11</a>、<a href="http://www.shaogroup.com/tag/raspberry-pi" rel="tag">Raspberry Pi</a> 发表回复

FreeBSD install shadowsocks-libev

cd /usr/ports/net/shadowsocks-libev

make install clean;rehash

ee /etc/rc.conf 加入

shadowsocks_libev_enable=”YES”
shadowsocks_libev_flags=”-c /usr/local/etc/shadowsocks-libev/config.json”

在/usr/local/etc/shadowsocks-libev/config.json中加入

{
“server”:”136.0.16.99″,
“server_port”:1234,             //服务端端口
“local_address”: “127.0.0.1”,
“local_port”:4321,                 //客户端端口
“password”:”password”,      //客户端连接密码
“timeout”:300,
“method”:”aes-256-cfb”     //加密方式
}

然后客户端,在本地,用config.json文件内容对shadowsocks-gui进行相应配置并运行客户端,

shadowsocks-gui下载地址:http://sourceforge.net/projects/shadowsocksgui/files/dist/

最后设置浏览器代理。Chrome 推荐使用 SwitchySharp 切换代理设置。把浏览器代理设为下列参数即可:

协议: socks5

地址: 127.0.0.1

端口: 你填的 local_port

service shadowsocks-libev restart

ok应该可以科学上网了

张贴在<a href="http://www.shaogroup.com/category/freebsd-openbsd-unix" rel="category tag">*BSD</a> 标签:<a href="http://www.shaogroup.com/tag/freebsd" rel="tag">FreeBSD</a>、<a href="http://www.shaogroup.com/tag/shadowsocks-libev" rel="tag">shadowsocks-libev</a> 发表回复