一款Linux下同步备份文件的好软件DROPBOX
原来一直用tar、sync等软件实现备份。需要些脚本还要找一台其他服务器进行同步。现在有了DROPBOX这个网站提供的服务,一切都变容易了。
DROPBOX网站:
DROP功能:
偷懒直接把官方介绍帖过来了。主要就是免费提供2G的同步空间,可以自动同步文件并保留文件的历史版本
Dropbox Features
File Sync
Dropbox allows you to sync your files online and across your computers automatically.
- 2GB of online storage for free, with up to 100GB available to paying customers.
- Sync files of any size or type.
- Sync Windows, Mac and Linux computers.
- Automatically syncs when new files or changes are detected.
- Work on files in your Dropbox even if you're offline. Your changes sync once your computer has an Internet connection again.
- Dropbox transfers will correctly resume where they left off if the connection drops.
- Efficient sync - only the pieces of a file that changed (not the whole file) are synced. This saves you time.
- Doesn't hog your Internet connection. You can manually set bandwidth limits.
File Sharing
Sharing files is simple and can be done with only a few clicks.
- Shared folders allow several people to collaborate on a set of files.
- You can see other people's changes instantly.
- A "Public" folder that lets you link directly to files in your Dropbox.
- Control who is able to access shared folders (including ability to kick people out and remove the shared files from their computers).
- Automatically create shareable online photo galleries from folders of photos in your Dropbox.
Online Backup
Dropbox backs up your files online without you having to think about it.
- Automatic backup of your files.
- Undelete files and folders.
- Restore previous versions of your files.
- 30 days of undo history, with unlimited undo available as a paid option.
Web Access
A copy of your files are stored on Dropbox's secure servers. This lets you access them from any computer or mobile device.
- Manipulate files as you would on your desktop - add, edit, delete, rename etc.
- Search your entire Dropbox for files.
- A "Recent Events" feed that shows you a summary of activity in your Dropbox.
- Create shared folders and invite people to them.
- Recover previous versions of any file or undelete deleted files.
- View photo galleries created automatically from photos in your Dropbox.
Security & Privacy
Dropbox takes the security and privacy of your files very seriously.
- Shared folders are viewable only by people you invite.
- All transmission of file data and metadata occurs over an encrypted channel (SSL).
- All files stored on Dropbox servers are encrypted (AES-256) and are inaccessible without your account password.
- Dropbox website and client software have been hardened against attacks from hackers.
- Dropbox employees are not able to view any user's files.
- Online access to your files requires your username and password.
- Public files are only viewable by people who have a link to the file(s). Public folders are not browsable or searchable.
Mobile Device Access
The free Dropbox iPhone app lets you:
- Access your Dropbox on the go.
- View your files on your iPhone or iPod Touch.
- Download files for offline viewing.
- Take photos and videos and sync them to your Dropbox.
- Share links to files in your Dropbox.
- View interactive photo galleries.
- Sync downloaded files so they're up-to-date.
A mobile-optimized version of the website is available for owners of Blackberry phones and other Internet-capable mobile devices.
Linux下安装
如果你的Linux服务器安装了Xserver和桌面,完全可以安装官方的指南来安装。但是因为一般的VPS都内存小得可怜,不会奢侈到安装桌面,所以下面主要介绍在没有安装桌面系统的命令行Linux下安装步骤。
关于安装方法的内容转帖自http://lazyhack.net/install-dropbox-in-vps/
1、登陆进VPS或者是服务器,进入用户目录
- cd
2、下载dropbox的客户端,要For linux那个而非For Nautilus的
这里我是在http://lazyhack.net/install-dropbox-in-vps/文档中找到的地址,官方网站找了半天都是Nautilus的版本
32位下载地址 http://www.dropbox.com/download?plat=lnx.x86
64位下载地址 http://www.dropbox.com/download?plat=lnx.x86_64
我这里用的32位系统,所以下载32位客户端
- wget http://www.dropbox.com/download?plat=lnx.x86
3、解压
- tar zxvf dropbox-lnx.x86-0.7.110.tar.gz
4、下载dbmakefilelib.py并运行
- wget http://dl.dropbox.com/u/637552/Dropbox/dbmakefilelib.py
- python dbmakefilelib.py
如果出现以下信息,说明它运行正常
dropboxd ran for 15 seconds without quitting - success?
看到它的提示了吗,Dropbox已经启动了,让你运行15秒后再退出,这个过程就是dropbox生成机器信息并保存到db文件的,其实对于国外的vps来说几秒时间就够了,我们ctrl-c将其退出,完成接下来的步骤
5、进入Dropbox的dot目录导出机器信息
- cd .~/.dropbox
- $ sqlite3 dropbox.db
- SQLite version 3.6.22
- Enter ".help" for instructions
- Enter SQL statements terminated with a ";"
- sqlite> .dump config
我们会在导出的信息中看到如下的一串字符
INSERT INTO "config" VALUES(4,'host_id','VmQ0NWFlMTdmYmQ3OGYzMzgyOTM0NWMzN2Q1MGFkOTIzCnAxCi4= ');
这个host_id就是机器的唯一标识,我们需要用它来跟自己的账户进行匹配,不过在这之前还有个工作需要做,因为上面的那长串字符很明显可以看出 是用base64编码后的结果,我们得先把它解码再说,注意这里Dropbox耍了个小花招,这串字符串前面的那个”V“,是无用的,我们在解码后的把它 忽略掉
6、将base64字符串解码
$ echo mQ0NWFlMTdmYmQ3OGYzMzgyOTM0NWMzN2Q1MGFkOTIzCnAxCi4= | base64 -d
我的结果是Vd45ae17fbd78f33829345c37d50ad923,忽略掉”V“,就是d45ae17fbd78f33829345c37d50ad923
7、将账户信息与机器信息绑定
这步很简单,只需要访问以下网址,并登陆
HOSTID替换成你刚才解码出来的那串字符就行了
https://www.dropbox.com/cli_link?host_id=HOSTID
8、建立dropbox的同步目录
dropbox的同步目录默认的是~/Dropbox
$ mkdir ~/Dropbox
9、运行,开始你的同步
$ ~/.dropbox-dist/dropboxd &
到这里dropbox就可以正常运行并同步了,文章标题说的是备份网站数据,那么我们就来使我们的网站数据能够同步到dropbox服务器上
其实很简单,就是建立符号连接而已,windows之前是没有这个功能的
比如要备份/var/www这个目录
cd ~/Dropbox
$ ln -s /var/www web_backup
这就可以了,或者要备份/etc目录
$ cd ~/Dropbox
$ ln -s /etc etc_backup
ok.发挥你的想象尽情的使用吧。
推广
如果你看过这篇文章后,打算也使用dropbox。那么你可以使用我下面的链接注册
https://www.dropbox.com/referrals/NTU4NDMyNzI5
采用这个链接注册,你会增加250M空间。注册后是2G,然后会给你再发封邮件告诉你已经提升到2.25G。而我也会增加250M空间。


CentOS 5.3下O
CENTOS下安装MUD
