2015年7月

apt-get install ocaml camlp4-extra
git clone https://github.com/OCamlPro/opam.git
cd opam
./configure
make
sudo make install

apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev
opam init //**if error( opam init https://opam.ocaml.org/1.1 )
opam update
opam install google-drive-ocamlfuse

安装成功后,进入Google Project建立一个Project
https://console.developers.google.com/project
googleproject
进入项目的API设置开启Drive API
googledriveenabledriveapi
建立一个OAuth验证ID
google_project_credentials_oauth
建立项目的Client ID
google_project_create_client_ID
记录下这两个生成的参数做稍后使用
google_project_client_id_native_application
进入/root/.opam/system/bin/目录绑定项目
cd /root/.opam/system/bin/
./google-drive-ocamlfuse -headless -label googledrive -id ##Client ID##.apps.googleusercontent.com -secret ##secret key##
执行完上述指令会返回一个https的网址在浏览器粘贴到浏览器后会进入google页面询问是否允许访问该项目,选accept然后记录下浏览器页面返回的密码,粘贴进去回车即可。
进入~/.gdfuse/googledrive
cd ~/.gdfuse/googledrive
nano config
编辑config修改内容例如
verification_code= [key returned from browser]
client_id= [eg. 123123231.apps.googleusercontent.com]
client_secret= [eg. ASDQWEWGSD!$@#@#ASD]
完成配置加载Google Drive远端存储到本地/googledrive

mkdir /googledrive
cd ~/.opam/system/bin
./google-drive-ocamlfuse -label googledrive /googledrive

if you get swapon failed: Operation not permitted Error even if you run as root it is because in your VPS swap creation is not allowed follow below steps to Create Fake Swap in OpenVZ VPS

[root@server] free -m total used free Mem: 4096 104 3991 -/+ buffers/cache: 104 3991
Swap: 0 0 0

create shell script file add lines like below
[root@server] vi fakeswap.sh

#!/bin/bash
SWAP="${1:-512}"
NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0"
umount /proc/meminfo 2> /dev/null
sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo > /etc/fake_meminfo
mount --bind /etc/fake_meminfo /proc/meminfo
free -m

[root@server] chmod +x fakeswap.sh
[root@server] sh fakeswap.sh [root@server] free -m total used free Mem: 4096 104 3991 -/+ buffers/cache: 104 3991 Swap: 512 0 512 to create 1024MB Swap run like below [root@server] sh fakeswap.sh 1024 [root@server] free -m total used free Mem: 4096 104 3991 -/+ buffers/cache: 104 3991 Swap: 1024 0 1024 - See more at: http://linux-problem-solver.blogspot.sg/2013/08/create-fake-swap-in-openvz-vps-if-you-get-swapon-failed-operation-not-permitted-error.html#sthash.Eeknzpcf.dpuf

apt-get install shorewall
cp /usr/share/doc/shorewall/examples/one-interface/interfaces /etc/shorewall/interfaces
cp /usr/share/doc/shorewall/examples/one-interface/policy /etc/shorewall/policy
cp /usr/share/doc/shorewall/examples/one-interface/rules /etc/shorewall/rules
cp /usr/share/doc/shorewall/examples/one-interface/zones /etc/shorewall/zones

Now open /etc/shorewall/policy file and change the line:
net all DROP info
removing info directive given it fills the system logs:
net all DROP
Now open /etc/shorewall/rules and add the following rules at the bottom of the file:
HTTP/ACCEPT net $FW
SSH/ACCEPT net $FW
FTP/ACCEPT net $FW
# real apache since varnish listens on port 80
#ACCEPT net $FW tcp 8080
ACCEPT net:192.168.1.10 $FW TCP 22

vi /etc/shorewall/shorewall.conf STARTUP_ENABLED=No —— STARTUP_ENABLED=Yes
vi /etc/default/shorewall startup=0 —— startup=1

/etc/init.d/shorewall start

经过多方查阅资料,终于将exim4的配置搞定了,结果才发现,原来是这么简单。下面我就把我配置的过程写出来,与大家分享。
1)在命令行输入dpkg-reconfigure exim4-config来进行配置。
2)将配置文档分拆成小文件吗?(否)
3)邮件系统配置的常见模式:(互联网站;直接通过 SMTP 发送或接收信件)
4)系统邮件名称:(我的机器名默认的)
5)要监听的入站 SMTP 连接的 IP 地址:(空白,就是什么都不写)
6)其它可接受的邮件目的地址:( localhost.localdomain:debian:localhost)
注:我的主机名是debian
7)中转(relay)邮件的域名: (空白)
8)为这些主机进行邮件转发:(空白)
9)保持最小 DNS 查询量吗(按需拔号 Dial-on-Demand)? (否)

测试发邮件
echo "text" | mail -s "title" xxxxxxx@qq.com