博文

How to mount Google Drive on debian

图片
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 进入项目的API设置开启Drive API 建立一个OAuth验证ID 建立项目的Client ID 记录下这两个生成的参数做稍后使用 进入/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 ~/.o...

Create Fake Swap in OpenVZ VPS if you get swapon failed: Operation not permitted Error

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 51...

debian install shorewall

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 ...

Debian remove exim4

apt-get –purge remove exim4 apt-get –purge remove exim4-base dpkg -l | grep exim dpkg -P exim_name

实战Exim4配置

经过多方查阅资料,终于将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

web server setup with Debian 7 (Wheezy)

Setup bash and update the system cp /etc/skel/.bashrc /root/.bashrc apt-get update apt-get dist-upgrade Configure hostname correctly Make sure to have the following two lines (with the same format) at the top of your /etc/hosts file 127.0.0.1 localhost.localdomain localhost xxx.xxx.xxx.xxx web1.myserver.com web1 Note: xxx.xxx.xxx.xxx is the public IP address assigned to your server. Install all needed packages apt-get install php5 mysql-server mysql-client apache2 iptables phpmyadmin varnish shorewall vsftpd php5-cli php5-curl php5-dev php5-gd php5-idn php5-imagick php5-imap php5-memcache php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xcache php5-xmlrpc php-apc php-pear php-xml-rpc postfix apg ca-certificates heirloom-mailx MySQL/PhpMyAdmin: mysql root password: xxx repeat mysql root password: xxx web server to reconfigure automatically: apache2 configure database for phpmyadmin with dbconfig-common? Yes Password of the database’s ...

Git远程操作详解

图片
Git是目前最流行的版本管理系统,学会Git几乎成了开发者的必备技能。 Git有很多优势,其中之一就是远程操作非常简便。本文详细介绍5个Git命令,它们的概念和用法,理解了这些内容,你就会完全掌握Git远程操作。 git clone git remote git fetch git pull git push 本文针对初级用户,从最简单的讲起,但是需要读者对Git的基本用法有所了解。同时,本文覆盖了上面5个命令的几乎所有的常用用法,所以对于熟练用户也有参考价值。 一、git clone 远程操作的第一步,通常是从远程主机克隆一个版本库,这时就要用到git clone命令。 git clone 比如,克隆jQuery的版本库。 git clone https://github.com/jquery/jquery.git 该命令会在本地主机生成一个目录,与远程主机的版本库同名。如果要指定不同的目录名,可以将目录名作为git clone命令的第二个参数。 git clone git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子。 git clone http[s]://example.com/path/to/repo.git/ git clone ssh://example.com/path/to/repo.git/ git clone git://example.com/path/to/repo.git/ git clone /opt/git/project.git git clone file:///opt/git/project.git git clone ftp[s]://example.com/path/to/repo.git/ git clone rsync://example.com/path/to/repo.git/ SSH协议还有另一种写法。 git clone [user@]example.com:path/to/repo.git/ 通常来说,Git协议下载速度最快,SSH协议用于需要用户认证的场合。各种协议优劣的详细讨论请参考官方文档。 二、git remote 为了便于管理,Git要求每个远程主机都必须指定一个主机名。git remote命令就用于管理主机名。 不带选项的时候...

make: g++: Command not found

make: g++: Command not found g++ make: g++: Command not found sudo apt-get install build-essential

lftp Fatal error: Certificate verification: Not trusted - Junk Food for the Brain

If you use lftp alot, occasionally you will encounter sites that just use ssl to secure transmission, but don’t actually purchase a proper SSL cert for the domain. You would get the following error message: Fatal error: Certificate verification: Not trusted If you are sure its really the intended site (No Man in the Middle Attacks!), you can temporaryly disable certificate verification by the following command at the lftp prompt: lftp > set ssl:verify-certificate no To permanently set this for lftp, you could add this to your /etc/lftp.conf or in your home directory ~/.lfptrc file.