我爱linux

我是一个linux运维从业者,这个网站记录一些平时调试linux相关文档及生活随笔

Archive for the ‘debian’ Category

3分钟在Debian 6(Squeeze)上制作seedbox

without comments

本例以transmissionseedbox的软件
以前在debian 5安装transmission,apt-get安装版本还是很低,Debian 6(Squeeze)后,版本升级到2.03,已经接近主流版本,所以非常适合大家使用,而且安装配置非常简单

1:安装
apt-get install transmission-daemon

2:配置
注意:配置之前一定要停止transmission,否则修改配置文件保存后是不生效的
/etc/init.d/transmission-daemon stop

然后修改配置文件

vi /var/lib/transmission-daemon/info/settings.json

配置文件大家应该很熟悉,我个人觉得主要重点改下面几项就行

“dht-enabled”: false,
玩pt的,DHT肯定是关闭的,这也是主流PT的要求

“download-dir”: “/pt”,
自己定义一个下载路径,注意设置下载路径的权限

“rpc-password”: “password”,
“rpc-username”: “download”,
定义web访问的用户名和密码

“rpc-port”: 3333,
定义web访问的端口,建议改一个,安全点

“rpc-whitelist-enabled”: false,
如果你的访问ip不是很固定,建议这项取消,否则web访问会受限制

“peer-port”: 51515,
这项可选,主要是针对你的网络是否对pt软件有限制端口的行为,如果有限制可以改个端口

ok 保存后重启transmission服务

/etc/init.d/transmission-daemon start

访问 http://您的ip地址:3333(您定义的端口),就可以享受seedbox的乐趣

transmission除了制作新种目前我还不知道是否可以,其它下载,挂钟,辅种都是很方便的,但是web控制功能有限,特别是不能自定义下载子目录,所以我用的是Transmission Remote GUI 功能还是挺强大的。

Written by zhangweibo

四月 18th, 2011 at 8:18 上午

Posted in debian,Seedbox

Tagged with , ,

Debian 6(Squeeze)上安装openvpn

without comments

ramhost的vps因为是openvz,所以不能做pptp的vpn,但可以做tun的openvpn,安装使用很简单并且很实用,需要翻墙的同学必看哦

1:安装
apt-get install openvpn iptables

2:配置服务端

cp -R /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn
cd /etc/openvpn/easy-rsa/2.0
chmod +x vars
source ./vars
./clean-all

./build-ca
这一步,您一直回车就行,不要填密码,如果要求你回答Y还是N,选Y回车

./build-key-server server

./build-key client1
这2步也跟上面一样,一路回车和选择Y回车

./build-dh

3:配置转发
vi /etc/rc.local
添加以下语句,您只要替换“208.110.73.134”为您自己的ip就行
# add iptables rule for openvpn
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j SNAT --to 208.110.73.134

4:增加服务器端conf文件
vi /etc/openvpn/openvpn.conf
增加如下内容
dev tun
proto tcp
port 1194

ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem

user nobody
group nogroup
server 10.8.0.0 255.255.255.0

persist-key
persist-tun

#status openvpn-status.log
#verb 3
client-to-client

push “redirect-gateway def1″
push “dhcp-option DNS 69.197.153.253″
push “dhcp-option DNS 69.30.192.15″

comp-lzo

 

 

ok,启动openvpn服务
/etc/init.d/openvpn start
nohup /etc/rc.local &

5:客户端安装配置
到 http://openvpn.net/index.php/open-source/downloads.html 下载winodws客户端
安装后,然后从服务器把以下3个文件拷贝到windows安装路径下的config目录
这3个文件分别是
/etc/openvpn/easy-rsa/2.0/keys/ca.crt
/etc/openvpn/easy-rsa/2.0/keys/client1.crt
/etc/openvpn/easy-rsa/2.0/keys/client1.key

6:增加客户端配置文件
在config增加一个配置文件,文件名为client.ovpn
内容如下:
client
dev tun
proto tcp

# The hostname/IP and port of the server.
# CHANGE THIS TO YOUR VPS IP ADDRESS
remote 208.110.73.134 1194

resolv-retry infinite
nobind

persist-key
persist-tun

ca ca.crt
cert client1.crt
key client1.key

 

comp-lzo
verb 3

好了,点击windows程序图标,就可以享受翻墙的乐趣了

Written by zhangweibo

四月 16th, 2011 at 7:31 上午

Posted in debian,openvpn

Tagged with ,

debian下为PHP安装eAccelerator及配置

without comments

1:安装编译环境和php的 dev包

apt-get install build-essential php5-dev bzip2

2:下载并编译eAccelerator

cd /tmp
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip
unzip eaccelerator-0.9.6.1.zip
cd eaccelerator-0.9.6.1
phpize
./configure
make
make install

安装完毕

3:修改配置文件,有时候可能这个配置文件没有,那就直接创建1个

vi /etc/php5/conf.d/eaccelerator.ini
这里的配置文件路径,可能大家的服务器路径会有所不同,请大家选择自己的php的conf目录

extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

这里针对小内存vps提几个注意点:
默认配置文件有2个参数要重点注意
eaccelerator.shm_ttl="0"
当共享内存已满时,超过“shm_ttl”秒没有被访问过的脚本将被删除,默认值是“0”秒,表示从来不会删除。

eaccelerator.shm_prune_period="0"
当共享内存已满时,如果有一个新的脚本文件要加入共享内存,但此时共享内存已经用完,这样就会删除在“shm_prune_period”秒之前的未被访问过的脚本缓存,但有个前提就是这个新的脚本文件在“shm_prune_period” 秒之前被执行过。默认值为“0”,意思是不删除任何脚本缓存。

由于vps内存很有限,所以为了最大让缓存利用率提高,大家可以对这2个参数进行调整
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”1800″

以上单位都是秒

4:创建cache目录
mkdir -p /var/cache/eaccelerator
chmod 0777 /var/cache/eaccelerator

ok。重启php-fpm和nginx eAccelerator就生效了

FAQ:
1:如果在编译过程中提示没有phpize这个命令?
解决办法:apti-get install php5-dev

至于eAccelerator的管理,请参考我的另外一篇文章
http://www.5ilinux.com/programming/php/15.html

Written by zhangweibo

四月 15th, 2011 at 1:21 下午

Posted in debian,Php

Tagged with , ,

ramhost debian 6 初始化工作

with 2 comments

研究vps好久了,最终选择了ramhost,256M内存,10G硬盘,200G流量,每月才3.99$,合人民币每月27元,多便宜。如果你是联通用户建议选择亚特兰大主机,如果你是电信用户,建议选择堪萨斯城的。

据说老板是技术狂,我就看中这个,相信这些服务器会相当稳定,这几天测试下来,确实也表现可以,虽然偶尔网络慢点,但应该是线路的问题,但总体还能接受

reload debian 6  内存初始化才占用5M,够牛吧。

由于初始化环境很精简,所以我们做一些必备的工作

apt-get update

apt-get upgrade

dpkg-reconfigure tzdata
更改一下时区

apt-get install vim

vi(m)开启语法高亮显示

修改其配置文件:/etc/vim/vimrc,将”syntax on”这项打开即可

初始化编辑crontab时,默认的编辑器是nano,我们改成vim

update-alternatives --config editor
然后选择使用/usr/vim/vim.basic就OK了

apt-get install dnsutils

apt-get install rcconf

至于要不要安装openssh,我个人觉得不装也行,毕竟我们这是vps,内存节省为主,而且装了openssh,增加被扫描的可能,我们还是从母机直接登录吧,挺安全的,还省内存

 

Written by zhangweibo

四月 13th, 2011 at 12:54 上午

Posted in debian,vps

Tagged with , ,