{"id":1974,"date":"2011-03-23T09:05:44","date_gmt":"2011-03-23T09:05:44","guid":{"rendered":"http:\/\/www.icocean.com\/blog\/?p=1974"},"modified":"2011-03-23T09:34:27","modified_gmt":"2011-03-23T09:34:27","slug":"%E6%89%93%E9%80%A0%E5%9F%BA%E4%BA%8Eubuntu%E7%9A%84%E5%AE%B6%E7%94%A8%E5%A4%9A%E5%8A%9F%E8%83%BDbt%E4%B8%8B%E8%BD%BD%E6%9C%BA%E5%AE%B6%E7%94%A8nas%E6%9C%8D%E5%8A%A1%E5%99%A8","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=1974","title":{"rendered":"\u6253\u9020\u57fa\u4e8eubuntu\u7684\u5bb6\u7528\u591a\u529f\u80fdBT\/\u4e0b\u8f7d\u673a&#8212;\u5bb6\u7528NAS\u670d\u52a1\u5668"},"content":{"rendered":"<p>\u672c\u6587\u5185\u5bb9\u8be6\u7ec6\uff0c\u5efa\u7acb\u5bb6\u7528nas\u670d\u52a1\u5668\uff0c\u503c\u5f97\u4e00\u8bfb\uff0c\u6838\u5bf9\u4e86\u4e00\u4e0b\u539f\u6587\u4ef6\uff0c\u8865\u5145\u4e86\u51e0\u4e2a\u9057\u6f0f\u7684\u5185\u5bb9\u3002<br \/>\u4ec5\u505a\u4e86\u7ffb\u8bd1\uff0c\u6ca1\u6709\u505a\u5b89\u88c5\u7684\u9a8c\u8bc1\uff0c\u5c3d\u91cf\u505a\u5230\u6ca1\u6709\u6280\u672f\u9519\u8bef\uff0c\u5e0c\u671b\u6709\u611f\u5174\u8da3\u7684fans\u80fd\u505a\u4e2a\u6d4b\u8bd5\uff0c\u5206\u4eab\u4e00\u4e0b\u7ecf\u9a8c\u3002<\/p>\n<p><b>HOWTO : Home made NAS server with Ubuntu 8.04.1<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668<\/p>\n<p>There are many NAS for home users in the market, such as Synology, Qnap, LinkStation and etc. They are not in good performance and not cheap in price. However, they are good in less power consumption. It is because I owned not only one brand of such products at home now.<br \/>\u73b0\u5728\u5e02\u573a\u4e0a\u6709\u5f88\u591a\u5bb6\u7528NAS\u4ea7\u54c1\uff0c\u4f8b\u5982\uff1aSynology, Qnap, LinkStation\u7b49\u3002\u5b83\u4eec\u6027\u80fd\u5e76\u4e0d\u597d\uff0c\u800c\u4e14\u4ef7\u683c\u4e0d\u4fbf\u5b9c\u3002\u4e0d\u8fc7\uff0c\u5728\u4f4e\u80fd\u8017\u65b9\u9762\u505a\u5f97\u8f83\u597d\uff0c\u56e0\u6b64\uff0c\u6211\u5bb6\u91cc\u6709\u4e0d\u6b621\u4e2a\u54c1\u724c\u7684\u8fd9\u7c7b\u4ea7\u54c1\u3002<\/p>\n<p>Recently, I bought a VIA PC-1 PC2500E motherboard, which has VIA C7-D 1.5GHz CPU on board. It is cheap in price and use less power too. The maximum amount of RAM is 2 GB.<br \/>\u6700\u8fd1\uff0c\u6211\u4e70\u4e861\u5757VIA PC-1 PC2500E\u4e3b\u677f\uff0c\u677f\u4e0a\u5e26\u6709VIA C7-D 1.5GHz CPU\u3002\u4ef7\u683c\u4fbf\u5b9c\uff0c\u4e5f\u8282\u80fd\u3002\u6700\u5927\u53ef\u88c52G\u5185\u5b58\u3002<\/p>\n<p>Testing it with Ubuntu 8.04.1 Desktop version for a while, I am very satisfied with the performance of the CPU, although it is not quite fast indeed. I decided to build a home made NAS server with remote BitTorrent function.<br \/>\u7528Ubuntu 8.04.1 Desktop\u6d4b\u8bd5\u4e00\u6bb5\u65f6\u95f4\uff0c\u867d\u7136\u4e0d\u662f\u8db3\u591f\u5feb\uff0c\u6211\u8fd8\u662f\u5bf9CPU\u7684\u6027\u80fd\u76f8\u5f53\u6ee1\u610f\u3002\u6211\u51b3\u5b9a\u5728\u5bb6\u7ec4\u88c5NAS\u670d\u52a1\u5668\uff0c\u5e76\u5e26\u6709\u8fdc\u7a0bBT\u529f\u80fd\u3002<\/p>\n<p>Hardware<br \/>Motherboard \u2013 VIA PC-1 PC2500E with VIA C7-D 1.5GHz CPU<br \/>RAM \u2013 2 X 1GB DDR2 667MHz (maximum)<br \/>Hard drive \u2013 300GB Seagate SATA (The motherboard treats it as ATA drive)<br \/>Router \u2013 Planet WRT-401E (wired) (optional)<\/p>\n<p>Software<br \/>Operating system \u2013 Ubuntu 8.04.1 Server Edition<br \/>File server \u2013 Samba<br \/>FTP server \u2013 vsFTPd<br \/>Remote access \u2013 OpenSSH<br \/>Web Server \u2013 Apache, PHP and MySQL<br \/>Remote BitTorrent \u2013 TorrentFlux (front-end) and BitTornado (back-end)<br \/>Security software \u2013 Fail2Ban<!--more--><\/p>\n<p>The performance of the Samba is quite good and it can stream the video clips. You can remote control the server with OpenSSH and also can remote the BitTorrent anywhere.<br \/>Samba\u7684\u6027\u80fd\u76f8\u5f53\u597d\uff0c\u800c\u4e14\u652f\u6301\u89c6\u9891\u6d41\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528OpenSSH\u8fdc\u7a0b\u63a7\u5236\u670d\u52a1\u5668\u548cBT\u3002<\/p>\n<p>I do not choose the GUI interface for server maintenance as it is not required after the server has been set up. I use command line mode indeed.<br \/>\u6211\u6ca1\u6709\u4e3a\u670d\u52a1\u5668\u7684\u7ef4\u62a4\u9009\u62e9GUI\u754c\u9762\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u5b89\u88c5\u5b8c\u6210\u540e\u5c31\u6ca1\u6709\u7528\u5904\u4e86\u3002\u6211\u4f7f\u7528\u547d\u4ee4\u884c\u3002<\/p>\n<p>The server needs some fine tune for better performance and I will tell you how. The installation of the softwares is in Part II.<br \/>\u6211\u540e\u9762\u4f1a\u4ecb\u7ecd\u670d\u52a1\u5668\u9700\u8981\u8c03\u4f18\u63d0\u9ad8\u6027\u80fd\u7684\u4f4d\u7f6e\u3002\u7b2c\u4e8c\u90e8\u5206\u662f\u8f6f\u4ef6\u7684\u5b89\u88c5\u3002<\/p>\n<p>\u539f\u5e16\u5730\u5740\uff1a<\/p>\n<p>http:\/\/samiux.wordpress.com\/2008\/08\/12\/howto-home-made-nas-server-with-ubuntu-8041-%E2%80%93-part-i\/<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part II<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part II<\/p>\n<p>Here comes the software installation. The first thing is to install the operating system \u2013 Ubuntu 8.04.1 Server Edition. The installation is quite straight forward and you should choose LAMP, OpenSSH and Samba (Print server is optional) during the installation. Use a more complicate but easy to remember password as the user password and MySQL password. I use same password for them. Please write it down and you will need it later and forever.<br \/>\u8fd9\u91cc\u662f\u8f6f\u4ef6\u7684\u5b89\u88c5\u3002\u9996\u5148\u662f\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edfUbuntu 8.04.1 Server Edition\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u9009\u62e9LAMP, OpenSSH and Samba(Print\u670d\u52a1\u53ef\u9009)\u3002\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u548cMySQL\u7528\u6237\u8bbe\u5b9a\u8db3\u591f\u590d\u6742\u53c8\u5bb9\u6613\u8bb0\u4f4f\u7684\u53e3\u4ee4\u3002\u6211\u4f7f\u7528\u4e86\u76f8\u540c\u7684\u53e3\u4ee4\u3002\u8bf7\u5199\u4e0b\u6765\uff0c\u8fc7\u4e00\u4f1a\u513f\u5c31\u8981\u4f7f\u7528\uff0c\u800c\u4e14\u6c38\u8fdc\u8981\u4f7f\u7528\u3002<\/p>\n<p>Once installed, you can install vsFTPd and Fail2Ban. BitTorrent feature will be discuss later.<br \/>\u4e0b\u4e00\u6b65\uff0c\u5b89\u88c5vsFTPd\u548cFail2Ban\u3002BT\u540e\u9762\u518d\u8bf4\u3002<\/p>\n<p>sudo apt-get update<br \/>sudo apt-get upgrade<br \/>sudo apt-get install vsftpd fail2ban<\/p>\n<p>Samba<\/p>\n<p>The Samba is already installed and you are required to configure it to make it work. I will make the Samba working in this way : Every user has it owned home directory and every user can access to a public directory for sharing document and files.<br \/>Samba\u5df2\u7ecf\u5b89\u88c5\u7ed3\u675f\uff0c\u4f60\u9700\u8981\u5b8c\u6210\u914d\u7f6e\u4f7f\u5b83\u5de5\u4f5c\u3002\u6211\u8bbe\u8ba1\u7684Samba\u89c4\u5219\u5982\u4e0b\uff1a\u6bcf\u4e2a\u7528\u6237\u6709\u81ea\u5df1\u7684\u79c1\u6709\u76ee\u5f55\uff0c\u6bcf\u4e2a\u7528\u6237\u90fd\u53ef\u4ee5\u8bbf\u95ee\u5171\u4eab\u6587\u4ef6\u7684\u516c\u5171\u76ee\u5f55\u3002<\/p>\n<p>sudo nano \/etc\/samba\/smb.conf<\/p>\n<p>To add the following lines to the [global] section :<br \/>\u5728[global]\u6bb5\uff0c\u52a0\u5165\u4ee5\u4e0b\u51e0\u884c\uff1a<\/p>\n<p># If you need to access Big5 filename, it is required; otherwise it is optional.<br \/>#dos charset = cp950<br \/>dos charset = UTF-8<br \/>#dos charset = cp936<\/p>\n<p>To add the following lines to the [global] section also :<br \/>\u5728[global]\u6bb5\uff0c\u518d\u52a0\u5165\u4ee5\u4e0b\u51e0\u884c\uff1a<\/p>\n<p>hosts allow = 127.0.0.1 192.168.0.0\/24 192.168.10.0\/24<br \/>hosts deny = 0.0.0.0\/0<\/p>\n<p>At Authentication part, uncomment the \u201c\uff03 security = user\u201d to read as \u201csecurity = user\u201d<br \/>\u5728\u8ba4\u8bc1\u90e8\u5206\uff0c\u53bb\u6389\u6ce8\u91ca\u201c\uff03 security = user\u201d\uff0c\u53d8\u6210\u201csecurity = user\u201d\u3002<\/p>\n<p>Go to [homes] section and add the following lines to it :<br \/>\u5728[homes]\u6bb5\uff0c\u52a0\u5165\u4ee5\u4e0b\u51e0\u884c\uff1a<\/p>\n<p>[homes]<br \/>comment = Home Directories<br \/>path = \/home\/%S<br \/>browseable = yes<br \/>read only = no<br \/>create mask = 0664<br \/>directory mask = 0664<br \/>valid users = %S<\/p>\n<p>Add the following lines to the end of the file :<br \/>\u6587\u4ef6\u6700\u540e\u52a0\u5165\u4ee5\u4e0b\u51e0\u884c\uff1a<br \/>[public]<br \/>comment = Share to all<br \/>path = \/home\/public<br \/>browseable = yes<br \/>read only = no<br \/>create mask = 0664<br \/>directory mask = 0664<br \/>valid users = samiux,john,mary<br \/>admin users = samiux<\/p>\n<p>To reload the configuration of your Samba server :<br \/>\u91cd\u542fSamba\u670d\u52a1\u5668\u3002<\/p>\n<p>sudo \/etc\/init.d\/samba reload<\/p>\n<p>where \u201cadmin users = samiux\u201dmay be different from you.<br \/>\u5176\u4e2d\u201cadmin users = samiux\u201d\u90e8\u5206\uff0c\u4f60\u81ea\u5df1\u7684\u8bbe\u7f6e\u5e94\u8be5\u4e0d\u4e00\u6837\u7684\u3002<\/p>\n<p>Then made a \u201cpublic\u201d directory at \/home :<br \/>\u5728\/home\u4e0b\uff0c\u521b\u5efa\u201cpublic\u201d\u76ee\u5f55\uff1a<\/p>\n<p>sudo mkdir \/home\/public<br \/>chgrp users \/home\/public<br \/>chmod 0777 -R \/home\/public<\/p>\n<p>Now, create normal users as Samba users. Only the users exist in the server can use the Samba.<br \/>\u73b0\u5728\u4e3aSamba\u7528\u6237\u521b\u5efa\u7cfb\u7edf\u666e\u901a\u7528\u6237\uff0c\u53ea\u6709\u670d\u52a1\u5668\u7684\u7528\u6237\u624d\u80fd\u4f7f\u7528Samba\u3002<\/p>\n<p>sudo adduser john<br \/>sudo adduser mary<\/p>\n<p>You can access the Samba at Windows system in this way :<br \/>\u5728Windows\u7cfb\u7edf\u4e2d\u8bbf\u95eeSamba\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>Go to your home directory :<br \/>\u8fdb\u5165\u4f60\u7684\u79c1\u6709\u76ee\u5f55\uff1a<br \/>&#92;&#92;192.168.0.15&#92;samiux<\/p>\n<p>Go to the public directory :<br \/>\u8fdb\u5165\u516c\u5171\u76ee\u5f55\uff1a<br \/>&#92;&#92;192.168.0.15&#92;public<\/p>\n<p>* your IP address may be different from me<br \/>* \u4f60\u7684IP\u5730\u5740\u5e94\u8be5\u6709\u6240\u4e0d\u540c<\/p>\n<p>Beware that all home user directories and public directory are writable. Users can add or delete files therein. The home directory owners cannot read and writable another home user directories.<br \/>\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6240\u6709\u7684\u79c1\u6709\u76ee\u5f55\u548c\u516c\u5171\u76ee\u5f55\u90fd\u662f\u53ef\u5199\u7684\u3002\u7528\u6237\u53ef\u4ee5\u521b\u5efa\u548c\u5220\u9664\u6587\u4ef6\u3002\u7528\u6237\u4e0d\u80fd\u8bfb\u5199\u5176\u4ed6\u7528\u6237\u7684\u79c1\u6709\u76ee\u5f55\u3002<\/p>\n<p>By the way, you can also access the Samba file server on your Ubuntu desktop.<br \/>\u53e6\u5916\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528Ubuntu desktop\u8bbf\u95eeSamba\u670d\u52a1\u5668\u3002<\/p>\n<p>We will discuss how to configure vsFTPd in next part.<br \/>\u4e0b\u4e00\u90e8\u5206\u6211\u4eec\u4f1a\u8bf4\u4e00\u4e0b\u5982\u4f55\u914d\u7f6evsFTPd\u3002<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part III<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part III<\/p>\n<p>Now, your Samba file server is up and working. It is high time to configure the vsFTP server. Anonymous users can download your file from your FTP server but they cannot upload and change anything in it. Local users can access their local home directories (read and write) by using FTP client, e.g. Filezilla or gFTP.<br \/>\u73b0\u5728\uff0cSamba\u6587\u4ef6\u670d\u52a1\u5668\u5df2\u7ecf\u5c31\u7eea\u4e86\uff0c\u8be5\u914d\u7f6evsFTP\u4e86\u3002\u533f\u540d\u7528\u6237\u53ef\u4ee5\u4eceFTP\u670d\u52a1\u5668\u4e0a\u4e0b\u8f7d\uff0c\u4f46\u4e0d\u80fd\u4e0a\u4f20\u548c\u4fee\u6539\u6587\u4ef6\u3002\u672c\u5730\u7528\u6237\u53ef\u4ee5\u8bbf\u95ee\u81ea\u5df1\u7684\u79c1\u6709\u76ee\u5f55\uff0c\u4f7f\u7528Filezilla or gFTP\u7b49FTP\u5ba2\u6237\u7aef\u3002<\/p>\n<p>vsFTP<\/p>\n<p>Edit the file at \/etc\/vsftpd.conf :<br \/>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\/etc\/vsftpd.conf\uff1a<br \/>sudo nano \/etc\/vsftpd.conf<\/p>\n<p>Uncomment and change the following lines (removes the \u201c#\u201din front of the entry) :<br \/>\u627e\u5230\u4ee5\u4e0b\u5404\u884c\uff0c\u53bb\u6389\u6ce8\u91ca\u5e76\u6539\u503c\uff1a<\/p>\n<p>anonymous_enable=YES<br \/>local_enable=YES<br \/>write_enable=YES<br \/>data_connection_timeout=120<br \/>chroot_local_user=YES<\/p>\n<p>If you are behind a router or firewall, you need to add the following lines at the end of the file :<br \/>\u5982\u679c\u4f60\u5728\u8def\u7531\u5668\u6216\u9632\u706b\u5899\u540e\u9762\uff0c\u9700\u8981\u5728\u6587\u4ef6\u6700\u540e\u52a0\u5165\u4ee5\u4e0b\u884c\uff1a<\/p>\n<p>pasv_enable=YES<br \/>pasv_promiscuous=YES<br \/>pasv_min_port=50000<br \/>pasv_max_port=50100<br \/>pasv_address=192.168.0.15<\/p>\n<p>Change the ports 50000-50100 at your desire and add this port range to the router\u2019s port forwarding section or virtual server section. The pasv_address should be the IP address of your server (yours may different from me).<br \/>\u6309\u7167\u4f60\u81ea\u5df1\u7684\u8981\u6c42\u8bbe\u7f6e\u7aef\u53e3\u8303\u56f450000-50100\uff0c\u5e76\u628a\u8fd9\u4e2a\u7aef\u53e3\u8303\u56f4\u52a0\u5230\u8def\u7531\u5668\u7684\u7aef\u53e3\u8f6c\u53d1\u6216\u865a\u62df\u670d\u52a1\u5668\u8bbe\u7f6e\u3002pasv_address\u8bbe\u7f6e\u7684\u662f\u4f60\u7684\u670d\u52a1\u5668IP\u5730\u5740\uff08\u548c\u6211\u7684\u5730\u5740\u5e94\u8be5\u4e0d\u4e00\u6837\uff09\u3002<\/p>\n<p>Remember to forward port 20 and 21 out at your router.<br \/>\u8bb0\u4f4f\u5728\u8def\u7531\u5668\u8bbe\u7f6e20\u548c21\u7aef\u53e3\uff0c\u5141\u8bb8\u5411\u5916\u8f6c\u53d1\u3002<\/p>\n<p>Anonymous users can download files from \/home\/ftp and you can put some files there for them to download.<br \/>\u533f\u540d\u7528\u6237\u53ef\u4ee5\u4ece\/home\/ftp\u76ee\u5f55\u4e2d\u4e0b\u8f7d\u6587\u4ef6\uff0c\u4f60\u53ef\u4ee5\u51c6\u5907\u4e00\u4e9b\u516c\u5171\u6587\u4ef6\u4f9b\u4e0b\u8f7d\u3002<\/p>\n<p>To restart your vsFTPd :<br \/>\u91cd\u542f\u52a8vsFTPd\uff1a<\/p>\n<p>sudo \/etc\/init.d\/vsftpd restart<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part IV<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part IV<\/p>\n<p>Your Samba server and vsFTPd server are running smoothly. Now, we are discussing the installation of remote BitTorrent feature.<br \/>\u4f60\u7684Samba\u548cvsFTPd\u670d\u52a1\u5df2\u7ecf\u8fd0\u884c\u4e86\u3002\u73b0\u5728\uff0c\u8bf4\u4e00\u4e0b\u8fdc\u7a0bBT\u7684\u5b89\u88c5\u3002<\/p>\n<p>You can access your remote BitTorrent server anywhere at anytime. The server requires Apache, PHP and MySQL. They have been installed when you install your Ubuntu Server that selecting the LAMP option.<br \/>\u4f60\u53ef\u4ee5\u5728\u4efb\u4f55\u65f6\u95f4\u4efb\u4f55\u5730\u65b9\u63a7\u5236\u4f60\u7684BT\u4e0b\u8f7d\u670d\u52a1\u3002BT\u4e0b\u8f7d\u670d\u52a1\u9700\u8981Apache, PHP and MySQL\u7684\u652f\u6301\u3002\u8fd9\u4e9b\u5185\u5bb9\u5728\u5b89\u88c5Ubuntu\u670d\u52a1\u5668\u65f6\uff0c\u5df2\u7ecf\u9009\u62e9LAMP\u5b89\u88c5\u4e86\u3002<\/p>\n<p>BitTorrent<\/p>\n<p>sudo apt-get install torrentflux bittornado<\/p>\n<p>You will asked for MySQL root password, it is the same as the one when you install the Ubuntu Server. TorrentFlux Administration password to be entered in the same as the MySQL and Ubuntu user password in my case. (for easy remembering).<br \/>\u8981\u6c42\u4f60\u63d0\u4f9bMySQL\u7684root\u7528\u6237\u53e3\u4ee4\uff0c\u5c31\u662f\u5b89\u88c5Ubuntu Server\u65f6\u8bbe\u7f6e\u7684\u3002\u6211\u662f\u628aTorrentFlux\u7684\u7ba1\u7406\u53e3\u4ee4\u8bbe\u7f6e\u6210\u4e0eMySQL\u3001Ubuntu\u4e00\u6837\uff08\u5bb9\u6613\u8bb0\u4f4f\uff09\u3002<\/p>\n<p>Run the TorrentFlux server at your desktop computer with Firefox :<br \/>\u5728\u5ba2\u6237\u7aefFireFox\u6d4f\u89c8\u5668\u4e0a\u8fd0\u884cTorrentFlux server<br \/>http:\/\/your_server_ip\/torrentflux<\/p>\n<p>Enter the Log in name as \u201croot\u201d and the password as what you had entered during the installation (TorrentFlux Administration password).<br \/>\u8f93\u5165root\u7528\u6237\u540d\uff0c\u53e3\u4ee4\u662f\u5b89\u88c5\u65f6\u8bbe\u7f6e\u7684TorrentFlux\u7ba1\u7406\u53e3\u4ee4\u3002<\/p>\n<p>You can replace the \u201cyour_server_ip\u201d with your domain name or the IP that provided by your ISP (or say, the real IP).<br \/>\u4f60\u53ef\u4ee5\u628a\u201cyour_server_ip\u201d\u90e8\u5206\u6362\u6210\u4f60\u7684\u57df\u540d\u6216\u8005ISP\u63d0\u4f9b\u7ed9\u4f60\u7684IP\u5730\u5740\u3002<\/p>\n<p>Updated on 2008-AUG-13 :<br \/>Someone complained that the Torrentflux with Bittornado eats a lot of CPU resources. I confirmed that it is. I am looking for an alternative solution &#8211; BitTornado (backend) and Torrentflux-b4rt (front end). The title for the tutorial is at HOWTO : Home made NAS server with Ubuntu 8.04.1 &#8211; Part IV (a).<br \/>2008-AUG-13\u66f4\u65b0\uff1a<br \/>\u5f88\u591a\u4eba\u62b1\u6028\u8bf4Torrentflux with Bittornado\u6d88\u8017\u5927\u91cfCPU\u8d44\u6e90\u3002\u7ecf\u8fc7\u786e\u8ba4\u60c5\u51b5\u5c5e\u5b9e\u3002\u6211\u627e\u4e86\u4e00\u4e2a\u66ff\u6362\u65b9\u6848\uff1a BitTornado (backend) \u548c Torrentflux-b4rt (front end)\u3002<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part IV (a)<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part IV (a)<\/p>\n<p>Since someone complained that Torrentflux with BitTornado eats a lot of CPU resources. I then switch to Torrentflux-b4rt with BitTornado. Torrentflux-b4rt is a fork of Torrentflux but it is completely rewritten by the developers for the current version. The current version is still in beta 2 at this writing.<br \/>\u56e0\u4e3a\u5f88\u591a\u4eba\u62b1\u6028\u8bf4Torrentflux with Bittornado\u6d88\u8017\u5927\u91cfCPU\u8d44\u6e90\u3002\u6211\u6362\u6210\u4f7f\u7528Torrentflux-b4rt with BitTornado\u3002Torrentflux-b4rt\u662fTorrentflux\u7684\u6d3e\u751f\u7248\u672c\uff0c\u5f53\u524d\u7248\u672c\u662f\u5b8c\u5168\u91cd\u5199\u7684\u3002\u672c\u6587\u5199\u65f6\uff0c\u4ecd\u7136\u662fbeta2\u7248\u672c\u3002<\/p>\n<p>I have tested the torrent download at 1134.80 KB\/s (one torrent) and it eats not more than 25% of CPU resources (according to the TOP). The overall CPU usage of the system is not more than 35% for the speed of download. Quite good indeed. It is better than Torrentflux.<br \/>\u6211\u6d4b\u8bd5\u4e861\u4e2aBT\u79cd\u5b50\uff0c\u901f\u5ea61134.80 KB\/s\uff0cBT\u4e0b\u8f7d\u6d88\u8017CPU\u4e0d\u8d85\u8fc725%\u3002\u6574\u4e2a\u670d\u52a1\u5668\u7684CPU\u4f7f\u7528\u7387\u4e5f\u6ca1\u6709\u8d85\u8fc735%\u3002\u76f8\u5f53\u4e0d\u9519\uff0c\u6bd4Torrentflux\u597d\u5f97\u591a\u3002<\/p>\n<p>Torrentflux-b4rt supports wget, torrent and nzb metafile type download method. The downloaded video clips can be used for streaming via VLC. B4rt also supports Transmission, Azureus, BitTorrent Mainline and BitTornado. However, I had tested the latest version of Transmission (1.32) unsuccessful \u2013 it is too slow to start the download and unable to stop the transfer. I think it is bugs. Azureus requires Java to run and I will not test it at all. BitTorrent Mainline is also not tested. Therefore, I selected BitTornado.<br \/>Torrentflux-b4rt\u652f\u6301wget,torrent,nzb\u7b49 BT\u79cd\u5b50\u3002\u4e0b\u8f7d\u7684\u89c6\u9891\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7VLC\u63d0\u4f9bStream\u3002b4rt\u652f\u6301Transmission, Azureus, BitTorrent Mainline and BitTornado\u3002\u6211\u6d4b\u8bd5\u4e86\u6700\u65b0\u7248\u672c\u7684Transmission (1.32)\uff0c\u4e0d\u6210\u529f-\u542f\u52a8\u4e0b\u8f7d\u592a\u6162\u800c\u4e14\u65e0\u6cd5\u505c\u6b62\u3002\u6211\u60f3\u662f\u6709bug\u3002Azureus\u9700\u8981java\u73af\u5883\uff0c\u6ca1\u6709\u53bb\u6d4b\u8bd5\u3002BitTorrent Mainline\u4e5f\u6ca1\u6709\u6d4b\u8bd5\u3002\u6211\u9009\u62e9\u7684\u662fBitTornado\u3002<\/p>\n<p>Torrentflux-b4rt<\/p>\n<p>Install required libraries and softwares :<br \/>\u5b89\u88c5\u9700\u8981\u7684\u5e93\u548c\u8f6f\u4ef6\uff1a<br \/>sudo apt-get install php5-cli unrar unzip vlc uudeview build-essential bittornado<\/p>\n<p>Download and compile the cksfv that required by b4rt :<br \/>\u4e0b\u8f7d\u548c\u7f16\u8bd1cksfv\uff08b4rt\u9700\u8981\uff09\uff1a<\/p>\n<p>wget http:\/\/zakalwe.fi\/~shd\/foss\/cksfv\/files\/cksfv-1.3.12.tar.bz2<br \/>tar -xjvf cksfv-1.3.12.tar.bz2<\/p>\n<p>cd cksfv-1.3.12<br \/>.\/configure<br \/>make<br \/>sudo make install<\/p>\n<p>Get and install the Torrentflux-b4rt (the current version at this writing) from the official site :<br \/>\u4ece\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5b89\u88c5Torrentflux-b4rt\uff1a<\/p>\n<p>wget http:\/\/download.berlios.de\/tf-b4rt\/torrentflux-b4rt_1.0-beta2.tar.bz2<br \/>tar -xjvf torrentflux-b4rt_1.0-beta2.tar.bz2<\/p>\n<p>cd torrentflux-b4rt_1.0-beta2<br \/>sudo cp -R html \/var\/www\/torrentflux<\/p>\n<p>sudo chmod -R 0777 \/var\/torrentflux\/inc\/config<\/p>\n<p>Create a directory for the download :<br \/>\u521b\u5efa\u4e0b\u8f7d\u4f7f\u7528\u7684\u76ee\u5f55\uff1a<br \/>sudo mkdir \/home\/torrent<br \/>sudo chmod -R 0777 \/home\/torrent<\/p>\n<p>Install the Torrentflux-b4rt with the browser. Type in \u201chttp:\/\/your_server_ip\/torrentflux\/setup.php\u201d<br \/>\u901a\u8fc7\u6d4f\u89c8\u5668\u5b89\u88c5Torrentflux\u3002<\/p>\n<p>Follow the instructions on the screen. The username and password of MySQL is the administrator\u2019s username and password of the MySQL (i.e. \u201croot\u201d and the password that you install the MySQL). Make sure to delete the \u201csetup.php\u201dat \/var\/www\/torrentflux after the installation.<br \/>\u6309\u7167\u63d0\u793a\u5b89\u88c5\u3002MySQL\u7684\u7528\u6237\u540d\u548c\u53e3\u4ee4\u6307\u7684\u662fMySQL\u5b89\u88c5\u662froot\u548c\u5b83\u7684\u53e3\u4ee4\u3002\u5b89\u88c5\u5b8c\u6210\u540e\u628a\/var\/www\/torrentflux\u76ee\u5f55\u4e2d\u7684setup.php\u5220\u9664\u3002<\/p>\n<p>The Torrentflux-b4rt is already installed. You can login by the browser at \u201chttp:\/\/your_server_ip\/torrentflux\u201d. Beware, the username and password that you have key in is the administrator username and password. The program will create for you once you keyed in.<br \/>Torrentflux-b4rt\u5df2\u7ecf\u5b89\u88c5\u5b8c\u6210\u3002\u5728\u6d4f\u89c8\u5668\u4e0a\u8bbf\u95eehttp:\/\/your_server_ip\/torrentflux\u3002\u4f60\u8f93\u5165\u7684\u7528\u6237\u540d\u548c\u53e3\u4ee4\u662f\u7ba1\u7406\u5458\u7684\u3002<\/p>\n<p>I nearly forgot to tell you to open or forward the (default) port 49160 to 49300 at router or firewall. You can change it as desire.<br \/>\u5fd8\u8bb0\u8bf4\u4e86\uff0c\u9700\u8981\u5728\u8def\u7531\u5668\u6216\u9632\u706b\u5899\u4e0a\u8bbe\u7f6e49160 \uff0d 49300\u7aef\u53e3\u7684\u8f6c\u53d1\u3002<\/p>\n<p>Samba configuration<\/p>\n<p>If you want to share the downloaded files with the intranet, you just added the following lines at the end of the \/etc\/samba\/smb.conf :<br \/>\u5982\u679c\u9700\u8981\u5728\u5185\u90e8\u7f51\u4e2d\u5171\u4eab\u4e0b\u8f7d\u7684\u6587\u4ef6\uff0c\u4f60\u9700\u8981\u5728\/etc\/samba\/smb.conf\u6700\u540e\u589e\u52a0\u4ee5\u4e0b\u884c\uff1a<br \/>[torrent]<br \/>comment = Share to all<br \/>path = \/home\/torrent<br \/>browseable = yes<br \/>read only = no<br \/>create mask = 0664<br \/>directory mask = 0664<br \/>valid users = samiux,john,mary<br \/>admin users = samiux<\/p>\n<p>Access to the torrent directory at Windows system :<br \/>\u5728Windows\u4e2d\u8bbf\u95eeBT\u76ee\u5f55\u3002<br \/>&#92;&#92;your_server_ip&#92;torrent<\/p>\n<p>Bonus<\/p>\n<p>Transmission installation procedure :<br \/>sudo apt-get install libcurl4-openssl-dev gettedxt libc6-dev libssl-dev pkg-config<\/p>\n<p>Download and install the Transmission :<br \/>wget http:\/\/download.m0k.org\/transmission\/files\/transmission-1.32.tar.bz2<br \/>tar -xjvf transmission-1.32.tar.bz2<\/p>\n<p>cd transmission-1.32<br \/>.\/configure &#8211;without-gtk<br \/>make<br \/>sudo make install<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part V<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part V<\/p>\n<p>This part is optional. The web server with PHP and MySQL is already running. Now, we are going to fine tune the Apache and PHP to make it running as faster as possible. The kernel can also be optimized too.<br \/>\u8fd9\u90e8\u5206\u662f\u53ef\u9009\u7684\u3002\u4f7f\u7528PHP\u548cMySQL\u7684\u7f51\u7ad9\u5df2\u7ecf\u8fd0\u884c\u3002\u73b0\u5728\uff0c\u6211\u4eec\u5bf9Apache \u548c PHP\u4f18\u5316\uff0c\u8ba9\u5b83\u4eec\u8fd0\u884c\u66f4\u5feb\u4e00\u4e9b\u3002\u5185\u6838\u4e5f\u80fd\u4f18\u5316\u7684\u3002<\/p>\n<p>Apache<\/p>\n<p>sudo a2enmod deflate<br \/>sudo \/etc\/init.d\/apache2 force-reload<\/p>\n<p>Edit the file \/etc\/apache2\/conf.d\/deflate.conf :<br \/>\u7f16\u8f91\u6587\u4ef6\/etc\/apache2\/conf.d\/deflate.conf:<br \/>sudo nano \/etc\/apache2\/conf.d\/deflate.conf<\/p>\n<p><IfModule mod_deflate.c><br \/>DeflateCompressionLevel 6<br \/>AddOutputFilterByType DEFLATE text\/plain<br \/>AddOutputFilterByType DEFLATE text\/html<br \/>AddOutputFilterByType DEFLATE text\/xml<br \/>AddOutputFilterByType DEFLATE text\/css<br \/>AddOutputFilterByType DEFLATE application\/xhtml+xml<br \/>AddOutputFilterByType DEFLATE application\/xml<br \/>AddOutputFilterByType DEFLATE application\/rss+xml<br \/>AddOutputFilterByType DEFLATE application\/atom_xml<br \/>AddOutputFilterByType DEFLATE application\/x-javascript<br \/>AddOutputFilterByType DEFLATE application\/x-httpd-php<br \/>AddOutputFilterByType DEFLATE application\/x-httpd-fastphp<br \/>AddOutputFilterByType DEFLATE application\/x-httpd-eruby<br \/>AddOutputFilterByType DEFLATE image\/svg+xml<br \/>AddOutputFilterByType DEFLATE application\/postscript<br \/><IfModule mod_headers.c><br \/>Header append Vary User-Agent<br \/><\/IfModule><br \/><\/IfModule><\/p>\n<p>Edit \/etc\/apache2\/apache2.conf :<br \/>\u7f16\u8f91\/etc\/apache2\/apache2.conf :<br \/>sudo nano \/etc\/apache2\/apache2.conf<\/p>\n<p>Then change the value as the following :<br \/>\u4fee\u6539\u4e0b\u8ff0\u884c\u7684\u503c\uff1a<br \/>ServerSignature Off<br \/>ServerTokens Prod<\/p>\n<p>Edit \/etc\/apache2\/sites-available\/default :<br \/>\u7f16\u8f91 \/etc\/apache2\/sites-available\/default:<br \/>sudo nano \/etc\/apache2\/sites-available\/default<\/p>\n<p>Then change the value as the following at \/var\/www section :<br \/>\u4fee\u6539\/var\/www\u533a\u7684\u76f8\u5e94\u503c\uff1a<br \/>Options -Indexes FollowSymLinks<\/p>\n<p>Restart your Apache server :<br \/>\u91cd\u65b0\u542f\u52a8Apache server:<br \/>sudo \/etc\/init.d\/apache2 restart<\/p>\n<p>PHP<br \/>To accelerate PHP, you need Zend but I will show you how to use eAccelerator.<br \/>\u8981\u52a0\u901fPHP\uff0c\u9700\u8981\u4f7f\u7528Zend\u3002\u4e0b\u9762\u8bf4\u5982\u4f55\u4f7f\u7528\u5b83\u3002<\/p>\n<p>Download the eAccelerator :<br \/>\u4e0b\u8f7deAccelerator:<br \/>wget http:\/\/bart.eaccelerator.net\/source\/0.9.5.3\/eaccelerator-0.9.5.3.tar.bz2<br \/>tar xvf eaccelerator-0.9.5.3.tar.bz2<\/p>\n<p>sudo apt-get install build-essential php5-dev<\/p>\n<p>cd eaccelerator-0.9.5.3<br \/>phpize<br \/>.\/configure<br \/>make<br \/>sudo make install<\/p>\n<p>sudo mkdir \/tmp\/eaccelerator<br \/>sudo chmod 0777 \/tmp\/eaccelerator<\/p>\n<p>Add the following lines at the end of \/etc\/php5\/apache2\/php.ini :<br \/>\u5728\u6587\u4ef6\/etc\/php5\/apache2\/php.ini\u672b\u5c3e\u52a0\u4e0a\u4e0b\u8ff0\u884c\uff1a<\/p>\n<p>extension=\u201deaccelerator.so\u201d<br \/>; shm_size default is 16, you may change to 64 or 128 depends on your RAM<br \/>eaccelerator.shm_size=\u201d16\u201d<br \/>eaccelerator.cache_dir=\u201d\/tmp\/eaccelerator\u201d<br \/>eaccelerator.enable=\u201d1\u201d<br \/>eaccelerator.optimizer=\u201d1\u201d<br \/>eaccelerator.check_mtime=\u201d1\u201d<br \/>eaccelerator.debug=\u201d0\u201d<br \/>eaccelerator.filter=\u201d\u201d<br \/>eaccelerator.shm_max=\u201d0\u201d<br \/>eaccelerator.shm_ttl=\u201d0\u201d<br \/>eaccelerator.shm_prune_period=\u201d0\u201d<br \/>eaccelerator.shm_only=\u201d0\u201d<br \/>eaccelerator.compress=\u201d1\u201d<br \/>eaccelerator.compress_level=\u201d9\u201d<\/p>\n<p>Restart the Apache :<br \/>\u91cd\u65b0\u542f\u52a8Apache:<br \/>sudo \/etc\/init.d\/apache2 restart<\/p>\n<p>Kernel<\/p>\n<p>Please refer to my blog \u201cPerformance-tunning\u201d at http:\/\/samiux.wordpress.com\/2008\/06\/12\/performance-tunning\/ for details.<\/p>\n<p>HOWTO : Performance tuning<\/p>\n<p>Add the following lines to \/etc\/sysctl.conf if you have 512MB RAM or more :<br \/>\u5982\u679c\u5185\u5b58\u591a\u4e8e512M\uff0c\u5728\/etc\/sysctl.conf\u540e\u589e\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<p>kernel.sem = 250 32000 100 128<br \/>kernel.shmall = 2097152<br \/>kernel.shmmax = 2147483648<br \/>kernel.shmmni = 4096<br \/># If you have more than 512MB RAM, use this setting (uncomment it and comment the setting just below)<br \/>#fs.file-max = 256000<br \/># If you have 512MB RAM or less, use this setting<br \/>fs.file-max = 65535<br \/>vm.swappiness = 1<br \/>vm.vfs_cache_pressure = 50<\/p>\n<p>If you have a fast broadband (UL 10Mbps \/ DL 10Mbps, my broadband connection speed) (other connection speed is not tested), use the following setting :<br \/>\u5982\u679c\u4f60\u7528\u7684\u662f\u9ad8\u901f\u7f51\u7edc\uff08\u4e0a\u4e0b\u884c\u540410M\uff0c\u6211\u7684\u5bbd\u5e26\u901f\u5ea6\uff0c\u5176\u4ed6\u7684\u901f\u5ea6\u6ca1\u6709\u8bd5\u9a8c\u8fc7\uff09\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u8bbe\u7f6e\uff1a<\/p>\n<p>net.core.rmem_max = 16777216<br \/>net.core.wmem_max = 16777216<br \/>net.ipv4.tcp_rmem = 4096 87380 16777216<br \/>net.ipv4.tcp_wmem = 4096 65536 16777216<br \/>net.ipv4.tcp_no_metrics_save = 1<\/p>\n<p>If you have a Wifi (such as IEEE 802.11 a\/b\/g) or a 3.5G modem, use the following setting :<br \/>\u5982\u679c\u4f60\u4f7f\u7528Wifi(IEEE 802.11 a\/b\/g)\u62163.5G modem\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u8bbe\u7f6e\uff1a<\/p>\n<p>net.core.rmem_default = 524288<br \/>net.core.rmem_max = 524288<br \/>net.core.wmem_default = 524288<br \/>net.core.wmem_max = 524288<br \/>net.ipv4.tcp_wmem = 4096 87380 524288<br \/>net.ipv4.tcp_rmem = 4096 87380 524288<br \/>net.ipv4.tcp_mem = 524288 524288 524288<br \/>net.ipv4.tcp_rfc1337 = 1<br \/>net.ipv4.ip_no_pmtu_disc = 0<br \/>net.ipv4.tcp_sack = 1<br \/>net.ipv4.tcp_fack = 1<br \/>net.ipv4.tcp_window_scaling = 1<br \/>net.ipv4.tcp_timestamps = 1<br \/>net.ipv4.tcp_ecn = 0<br \/>net.ipv4.route.flush = 1<\/p>\n<p>Then make the setting effective :<br \/>\u8ba9\u914d\u7f6e\u751f\u6548:<\/p>\n<p>sudo \/sbin\/sysctl -p<\/p>\n<p>Lightening Ubuntu!!!!<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part VI<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part VI<\/p>\n<p>This part is also optional. The Samba is shared with Windows desktops that files stored in the Samba will be infected by virus. To prevent this, you should install the ClamAV, the open source anti-virus program for Linux that kills Windows virus.<br \/>\u8fd9\u90e8\u5206\u4e5f\u662f\u53ef\u9009\u7684\u3002Samba\u4e3aWindows\u5ba2\u6237\u7aef\u63d0\u4f9b\u5171\u4eab\uff0c\u4fdd\u5b58\u7684\u6587\u4ef6\u4f1a\u611f\u67d3\u75c5\u6bd2\u3002\u53ef\u4ee5\u5b89\u88c5ClamAV\u9632\u75c5\u6bd2\uff0cLinux\u7248\u672c\u7684\u5f00\u6e90\u9632\u75c5\u6bd2\u7cfb\u7edf\uff0c\u53ef\u4ee5\u6740Windows\u75c5\u6bd2\u3002<\/p>\n<p>ClamAV<\/p>\n<p>Edit \/etc\/apt\/sources.list and append the following lines at the end of the file :<br \/>\u7f16\u8f91\/etc\/apt\/sources.list\uff0c\u5e76\u5728\u6700\u540e\u589e\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<p>sudo nano \/etc\/apt\/sources.list<\/p>\n<p># ClamAV PPA<br \/>deb http:\/\/ppa.launchpad.net\/ubuntu-clamav\/ubuntu hardy main<br \/>deb-src http:\/\/ppa.launchpad.net\/ubuntu-clamav\/ubuntu hardy main<\/p>\n<p>sudo apt-get update<br \/>sudo apt-get install clamav clamav-daemon arj unzoo lha unrar<\/p>\n<p>Make sure clamav-daemon is running :<br \/>\u786e\u4fddclamav-daemon\u8fd0\u884c\u4e2d\uff1a<br \/>ps ax &#124; grep clamd<\/p>\n<p>If not :<br \/>sudo \/etc\/init.d\/clamav-daemon start<br \/>sudo \/etc\/init.d\/clamav-freshclam start<\/p>\n<p>Scan and kill virus if found at 03:00am on every day :<br \/>\u626b\u63cf\u548c\u6740\u6bd2\u5b9a\u4e49\u5728\u6bcf\u5929\u591c\u91cc3\u70b9\uff1a<br \/>sudo crontab -e<\/p>\n<p>0 3 * * * clamscan -r -i \u2013remove \/home > \/home\/samiux\/scan.txt<\/p>\n<p>Remember to configure the ClamAV\u2019s 15 threads to 3 or less in order to reduce the consumption of CPU resources but the con is that it take a longer time to complete the virus scan of the whole system :<br \/>\u4e3a\u51cf\u5c11CPU\u8d44\u6e90\u7684\u6d88\u8017\uff0c\u628aClamAV\u914d\u7f6e\u6587\u4ef6\u4e2d\u768415\u7ebf\u7a0b\uff0c\u6539\u4e3a\u4e0d\u591a\u4e8e3\u4e2a\u3002\u56e0\u6b64\u6574\u4e2a\u7cfb\u7edf\u7684\u75c5\u6bd2\u626b\u63cf\u9700\u8981\u66f4\u591a\u7684\u5b8c\u6210\u65f6\u95f4\u3002<br \/>sudo dpkg-reconfigure clamav-base<\/p>\n<p>Remarks : The current version of ClamAV at the time of this writing cannot scan RAR files. It is a bug and it will be fixed later.<br \/>\u8bf4\u660e\uff1aClamAV\u5f53\u524d\u7248\u672c\u4e0d\u80fd\u626b\u63cfRAR\u6587\u4ef6\u3002\u8fd9\u4e2abug\u5c06\u6765\u4f1a\u8865\u4e0a\u3002<\/p>\n<p><!--nextpage--><br \/><b>HOWTO : Home made NAS server with Ubuntu 8.04.1 \u2013 Part VII<\/b><br \/>[HOWTO] \u7528Ubuntu 8.04.1\u642d\u5efaNAS\u670d\u52a1\u5668 \u2013 Part VII<\/p>\n<p>Some personal NAS in the market comes with iTune music server. However, iTune is not an Open Source software.<br \/>\u5e02\u573a\u4e0a\u4e00\u4e9b\u5bb6\u7528NAS\u5e26\u6709iTune\u97f3\u4e50\u670d\u52a1\u3002\u4e0d\u8fc7iTune\u4e0d\u662f\u5f00\u6e90\u8f6f\u4ef6\u3002<\/p>\n<p>Sockos is an Open Source personal music server that written in Java. She requires Sun\u2019s Java Runtime. IcedTea is not compatible so far.<br \/>Sockos\u662f\u4e00\u4e2ajava\u7f16\u5199\u7684\u5f00\u6e90\u4e2a\u4eba\u97f3\u4e50\u670d\u52a1\u3002\u8981\u6c42sun\u7684jre\u652f\u6301\u3002\u76ee\u524d\u8fd8\u4e0d\u80fd\u517c\u5bb9IcedTea\u3002<\/p>\n<p>Sockos is a cross platform software and requires no installation. She can run on a standalone personal computer or on a server. For running on personal computer with GUI, please refer to her official site.<br \/>Sockos\u662f\u8de8\u5e73\u53f0\u7684\uff0c\u4e0d\u9700\u8981\u5b89\u88c5\u3002\u53ef\u4ee5\u72ec\u7acb\u8fd0\u884c\u5728\u4e2a\u4ebaPC\u673a\u6216\u670d\u52a1\u5668\u4e0a\u3002\u5982\u679c\u8fd0\u884c\u5728\u6709GUI\u754c\u9762\u7684\u4e2a\u4eba\u673a\u4e0a\uff0c\u8bf7\u6307\u5411\u5b83\u7684\u5b98\u65b9\u7ad9\u70b9\u3002<\/p>\n<p>The client computer requires no mp3 player to play the music but may need Flash (optional). Flex player requires no installation of music player on the clinet computer. Other formats, such as WMV, OGG and Flac, require pre-installed music players that fit for the special formats.<br \/>\u5ba2\u6237\u673a\u4e0a\u64ad\u653e\u97f3\u4e50\uff0c\u4e0d\u9700\u8981mp3\u64ad\u653e\u5668\uff0c\u53ef\u80fd\u9700\u8981Flash\u3002\u5ba2\u6237\u673a\u4e0a\u7684Flex player\u4e0d\u9700\u8981\u5b89\u88c5\u3002\u5176\u4ed6\u7684\u683c\u5f0f\uff0c\u5982WMV, OGG and Flac\uff0c\u9700\u8981\u9884\u5148\u5b89\u88c5\u76f8\u5e94\u7684\u64ad\u653e\u5668\u3002<\/p>\n<p>The advantage of Sockos is that you can listen to your mp3 files at anytime and anywhere under the condition that fast internet connection is available. The disadvantage is that you should have at least IEEE 802.11g (54M) Wifi connection for smooth operation. GPRS and HSDPA do not work properly in my testing.<br \/>\u4f7f\u7528Sockos\u7684\u4f18\u70b9\u662f\uff0c\u5728\u6709\u5feb\u901f\u4e92\u8054\u7f51\u8fde\u63a5\u65f6\uff0c\u4f60\u53ef\u4ee5\u5728\u4efb\u4f55\u65f6\u95f4\u4efb\u4f55\u5730\u70b9\u542c\u4f60\u7684mp3\u6587\u4ef6\u3002\u7f3a\u70b9\u662f\uff0c\u4f60\u81f3\u5c11\u8981\u6709EEE 802.11g (54M) Wifi\uff0c\u624d\u80fd\u6709\u5e73\u6ed1\u7684\u64cd\u4f5c\u3002\u7ecf\u8fc7\u6d4b\u8bd5\uff0cGPRS\u548c HSDPA\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p>I am going to talk about running Sockos in Ubuntu Server 8.04.1 (without GUI).<br \/>\u4e0b\u9762\u8bf4\u4e00\u4e0b\u5728Ubuntu Server 8.04.1 (without GUI)\u8fd0\u884cSockos\u3002<\/p>\n<p>Step 1 :<\/p>\n<p>Install the Sun Java and runtime in the Ubuntu server (NAS).<br \/>\u5728Ubuntu server (\u4f60\u7684NAS)\u5b89\u88c5Sun Java\u548c\u8fd0\u884c\u5e93\u3002<br \/>sudo apt-get install sun-java6-bin sun-java6-fonts sun-java6-jre sun-java6-plugin<\/p>\n<p>Download the Sockos from the official site. Extact it on your home directory of your Ubuntu server. If your server (NAS) is detached the keyboard and monitor, plug in them now.<br \/>\u4ece\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7dSockos\u3002\u5728Ubuntu server\u4f60\u7684home\u76ee\u5f55\u4e2d\u89e3\u5f00\u538b\u7f29\u3002\u5982\u679c\u4f60\u7684\u670d\u52a1\u5668\u4e0a\u6ca1\u6709\u8fde\u63a5\u952e\u76d8\u548c\u663e\u793a\u5668\uff0c\u73b0\u5728\u63a5\u4e0a\u3002<\/p>\n<p>wget http:\/\/sockso.pu-gh.com\/downloads\/sockso-latest.zip<br \/>unzip sockso-latest.zip<br \/>cd sockos-1.0.9<\/p>\n<p>Step 2 :<\/p>\n<p>Create a directory at \/var for storing the database files.<br \/>\u5728\/var\u4e2d\u521b\u5efa\u76ee\u5f55\u4fdd\u5b58\u6570\u636e\u5e93\u6587\u4ef6\u3002<br \/>sudo mkdir \/var\/sockos<br \/>chmod -R 0755 \/var\/sockos<\/p>\n<p>Step 3 :<\/p>\n<p>Run the server as user (such as samiux) at the physcial server at tty1 (Ctrl+Alt+F1) at \/home\/samiux\/sockos-1.0.9.<br \/>\u7528\u6237\uff08\u5982samiux\uff09\u5728\u670d\u52a1\u5668\u4e0a\u7684\u63a7\u5236\u53f0tty1(Ctrl+Alt+F1) \u7ec8\u7aef\u63a7\u5236\u53f0\uff0c\u8fdb\u5165\u76ee\u5f55\/home\/samiux\/sockos-1.0.9<\/p>\n<p>sudo sh linux.sh \u2013nogui \u2013datadir \/var\/suckso<\/p>\n<p>A directory namely \u201ccovers\u201d and files \u201cdatabase.lck\u201d, \u201cdatabase.log\u201d, \u201cdatabase.properties\u201d and \u201cdatabase.script\u201d will be created on \/var\/sockso.<br \/>\u5728\u76ee\u5f55\/var\/sockso\u4e0b\u521b\u5efa\u4e86\u5b50\u76ee\u5f55covers\u548c\u6587\u4ef6database.lck\u201d, \u201cdatabase.log\u201d, \u201cdatabase.properties\u201d and \u201cdatabase.script\u201d\u3002<\/p>\n<p>A console will be prompted and telling you that your IP address and the port 4444 to be used for the music server.<br \/>\u63a7\u5236\u53f0\u4f1a\u63d0\u793a\u4f60\uff0c\u4f60\u7684ip\u5730\u57404444\u7aef\u53e3\u4e3a\u97f3\u4e50\u670d\u52a1\u5360\u7528\u3002<\/p>\n<p>Step 4 :<\/p>\n<p>Now, create the paths for the mp3 that located in the music server (your NAS \u2013 Ubuntu Server).<br \/>\u73b0\u5728\uff0c\u5728\u97f3\u4e50\u670d\u52a1\u5668\uff08\u4f60\u7684NAS \u2013 Ubuntu Server\uff09\u4e0a\u521b\u5efa\u5b58\u653emp3\u6587\u4ef6\u7684\u8def\u5f84\u3002<\/p>\n<p>For example, if some mp3 files are storing at 3 locations, such as :<br \/>\/home\/samiux\/music, \/home\/john\/mp3 and \/home\/mary\/songs.<br \/>\u4f8b\u5982\uff0c\u5982\u679c\u4e00\u4e9bmp3\u6587\u4ef6\u5206\u522b\u5b58\u653e\u57283\u4e2a\u5730\u65b9\uff0c\u5982\uff1a\/home\/samiux\/music, \/home\/john\/mp3 and \/home\/mary\/songs<\/p>\n<p>At the console (at the server), type the following commands :<br \/>\u5728\u670d\u52a1\u5668\u63a7\u5236\u53f0\u4e0a\uff0c\u8f93\u5165\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<br \/>coladd \/home\/samiux\/music<br \/>coladd \/home\/john\/mp3<br \/>coladd \/home\/mary\/songs<\/p>\n<p>collist to list all the paths that you just created. You can delete the path by coldel command.<br \/>collist\u547d\u4ee4\uff0c\u5217\u51fa\u4f60\u521b\u5efa\u7684\u6240\u6709\u8def\u5f84\u3002coldel\u547d\u4ee4\uff0c\u53ef\u4ee5\u5220\u9664\u8def\u5f84\u3002<\/p>\n<p>Step 5 :<\/p>\n<p>You can create a user, e.g. samiux by the following command or create at the web interface.<br \/>\u4f60\u53ef\u4ee5\u7528\u547d\u4ee4\u884c\u6216\u8005\u5728web\u754c\u9762\uff0c\u521b\u5efa\u4e00\u4e2a\u7528\u6237\uff0c\u5982\uff1asamiux<br \/>useradd samiux 9876543210 samiux.com@gmail.com<\/p>\n<p>(where 9876543210 is password and the other is your email address)<br \/>(9876543210\u662f\u53e3\u4ee4\uff0c\u540e\u9762\u7684\u662femail\u5730\u5740)<\/p>\n<p>Your Sockos Music Server is ready but you should not exit the console; otherwise, it will terminate the Sockos. Leave it alone and press Ctrl+Alt+F2. You can revisit to the console again by pressing Ctrl+Alt+F1. Type \u201chelp\u201d for assistance at the console.<br \/>\u4f60\u7684Sockos\u97f3\u4e50\u670d\u52a1\u5df2\u7ecf\u5c31\u7eea\u4e86\uff0c\u4f46\u662f\u4f60\u4e0d\u80fd\u63a8\u51fa\u63a7\u5236\u53f0\uff0c\u5982\u679c\u9000\u51fa\uff0cSockos\u4e5f\u4f1a\u505c\u6b62\u3002\u4e0d\u53bb\u7ba1\u4ed6\uff0c\u5207\u6362\u5230tty2(Ctrl+Alt+F2\u5207\u6362)\uff0c\u9700\u8981\u56de\u5230tty1\u65f6(Ctrl+Alt+F1\u5207\u6362)\u3002\u6709\u5173\u63a7\u5236\u53f0\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u4f7f\u7528help\u547d\u4ee4\u3002<\/p>\n<p>Step 6 :<\/p>\n<p>Go to your personal computer (client) and open a browser, e.g. Firefox and type the following on the address.<br \/>\u5728\u4f60\u7684pC\u673a\u4e0a\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u5982Firefox\uff0c\u8f93\u5165\u7f51\u5740\uff1a<br \/>http:\/\/192.168.0.15:4444<\/p>\n<p>(where 192.168.0.15 is your NAS address behind a router, 4444 is the port that Sockos to be used)<br \/>\uff08192.168.0.15\u662f\u4f60\u5728\u8def\u7531\u5668\u540e\u9762\u7684NAS\u5730\u5740\uff0c\u7aef\u53e34444\u662fSockos\u4f7f\u7528\u7684\u670d\u52a1\u7aef\u53e3\uff09<\/p>\n<p>Warning<br \/>\u8b66\u544a<\/p>\n<p>If you want to share your music files with others over the internet, you should beware the copyright law in the music industry or you may in serious trouble \u2013 lawsuit. You have been warned.<br \/>\u5982\u679c\u4f60\u60f3\u8981\u901a\u8fc7\u4e92\u8054\u7f51\u5206\u4eab\u97f3\u4e50\u6587\u4ef6\uff0c\u4f60\u8981\u5c0f\u5fc3\u97f3\u4e50\u5de5\u4e1a\u7684\u7248\u6743\u6cd5\uff0c\u5426\u5219\u4f60\u4f1a\u9047\u5230\u5927\u9ebb\u70e6\uff0d\u6cd5\u5f8b\u8bc9\u8bbc\u3002\u4f60\u5df2\u7ecf\u770b\u5230\u5e76\u7406\u89e3\u8fd9\u4e2a\u8b66\u544a\u3002<\/p>\n<p>Enjoy your loving music at anywhere and anytime!!!<\/p>\n<nav class=\"page-links\"><strong>\u9875\u9762\uff1a<\/strong> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974\" class=\"post-page-numbers\"><span class=\"page-num\">1<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=2\" class=\"post-page-numbers\"><span class=\"page-num\">2<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=3\" class=\"post-page-numbers\"><span class=\"page-num\">3<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=4\" class=\"post-page-numbers\"><span class=\"page-num\">4<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=5\" class=\"post-page-numbers\"><span class=\"page-num\">5<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=6\" class=\"post-page-numbers\"><span class=\"page-num\">6<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=7\" class=\"post-page-numbers\"><span class=\"page-num\">7<\/span><\/a> <a href=\"https:\/\/www.icocean.com\/blog\/?p=1974&#038;page=8\" class=\"post-page-numbers\"><span class=\"page-num\">8<\/span><\/a><\/nav>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5185\u5bb9\u8be6\u7ec6\uff0c\u5efa\u7acb\u5bb6\u7528nas\u670d\u52a1\u5668\uff0c\u503c\u5f97\u4e00\u8bfb\uff0c\u6838\u5bf9\u4e86\u4e00\u4e0b\u539f\u6587\u4ef6\uff0c\u8865\u5145\u4e86\u51e0\u4e2a\u9057\u6f0f\u7684\u5185\u5bb9\u3002\u4ec5\u505a\u4e86\u7ffb\u8bd1\uff0c\u6ca1\u6709\u505a\u5b89\u88c5\u7684 <a href='https:\/\/www.icocean.com\/blog\/?p=1974' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[3183,3182,595,3184],"class_list":["post-1974","post","type-post","status-publish","format-standard","hentry","category-linuxunix","tag-bt","tag-nas","tag-ubuntu","tag-3184","category-16-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1974"}],"version-history":[{"count":0,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1974\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}