打造基於ubuntu的家用多功能BT/下載機-----------最強最牛的--------------家用NAS服務器

打造基於ubuntu的家用多功能BT/下載機-----------最強最牛的--------------家用NAS服務器

 

原帖地址:

http://samiux.wordpress.com/2008/08/12/ ... 93-part-i/

非常感謝NetRoamer  做了翻譯..如下是原文..

-------------------------------------------------------------------------------------

覈對了一下原文件,補充了幾個遺漏的內容。

僅做了翻譯,沒有做安裝的驗證,儘量做到沒有技術錯誤,希望有感興趣的fans能做個測試,分享一下經驗。

HOWTO : Home made NAS server with Ubuntu 8.04.1
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器

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.
現在市場上有很多家用NAS產品,例如:Synology, Qnap, LinkStation等。它們性能並不好,而且價格不便宜。不過,在低能耗方面做得較好,因此,我家裏有不止1個品牌的這類產品。

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.
最近,我買了1塊VIA PC-1 PC2500E主板,板上帶有VIA C7-D 1.5GHz CPU。價格便宜,也節能。最大可裝2G內存。

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.
用Ubuntu 8.04.1 Desktop測試一段時間,雖然不是足夠快,我還是對CPU的性能相當滿意。我決定在家組裝NAS服務器,並帶有遠程BT功能。

Hardware
硬件
Motherboard – VIA PC-1 PC2500E with VIA C7-D 1.5GHz CPU
RAM – 2 X 1GB DDR2 667MHz (maximum)
Hard drive – 300GB Seagate SATA (The motherboard treats it as ATA drive)
Router – Planet WRT-401E (wired) (optional)

Software
軟件
Operating system – Ubuntu 8.04.1 Server Edition
File server – Samba
FTP server – vsFTPd
Remote access – OpenSSH
Web Server – Apache, PHP and MySQL
Remote BitTorrent – TorrentFlux (front-end) and BitTornado (back-end)
Security software – Fail2Ban

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.
Samba的性能相當好,而且支持視頻流。你可以使用OpenSSH遠程控制服務器和BT。

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.
我沒有爲服務器的維護選擇GUI界面,因爲服務器安裝完成後就沒有用處了。我使用命令行。

The server needs some fine tune for better performance and I will tell you how. The installation of the softwares is in Part II.
我後面會介紹服務器需要調優提高性能的位置。第二部分是軟件的安裝。

HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part II
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part II

Here comes the software installation. The first thing is to install the operating system – 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.
這裏是軟件的安裝。首先是安裝操作系統Ubuntu 8.04.1 Server Edition。安裝過程中,選擇LAMP, OpenSSH and Samba(Print服務可選)。爲操作系統用戶和MySQL用戶設定足夠複雜又容易記住的口令。我使用了相同的口令。請寫下來,過一會兒就要使用,而且永遠要使用。

Once installed, you can install vsFTPd and Fail2Ban. BitTorrent feature will be discuss later.
下一步,安裝vsFTPd和Fail2Ban。BT後面再說。

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vsftpd fail2ban


Samba

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.
Samba已經安裝結束,你需要完成配置使它工作。我設計的Samba規則如下:每個用戶有自己的私有目錄,每個用戶都可以訪問共享文件的公共目錄。

sudo nano /etc/samba/smb.conf

To add the following lines to the [global] section :
在[global]段,加入以下幾行:

# If you need to access Big5 filename, it is required; otherwise it is optional.
#dos charset = cp950
dos charset = UTF-8
#dos charset = cp936

To add the following lines to the [global] section also :
在[global]段,再加入以下幾行:

hosts allow = 127.0.0.1 192.168.0.0/24 192.168.10.0/24
hosts deny = 0.0.0.0/0

At Authentication part, uncomment the “# security = user” to read as “security = user”
在認證部分,去掉註釋“# security = user”,變成“security = user”。

Go to [homes] section and add the following lines to it :
在[homes]段,加入以下幾行:

[homes]
comment = Home Directories
path = /home/%S
browseable = yes
read only = no
create mask = 0664
directory mask = 0664
valid users = %S

Add the following lines to the end of the file :
文件最後加入以下幾行:
[public]
comment = Share to all
path = /home/public
browseable = yes
read only = no
create mask = 0664
directory mask = 0664
valid users = samiux,john,mary
admin users = samiux

To reload the configuration of your Samba server :
重啓Samba服務器。

sudo /etc/init.d/samba reload

where “admin users = samiux”may be different from you.
其中“admin users = samiux”部分,你自己的設置應該不一樣的。

Then made a “public” directory at /home :
在/home下,創建“public”目錄:

sudo mkdir /home/public
chgrp users /home/public
chmod 0777 -R /home/public

Now, create normal users as Samba users. Only the users exist in the server can use the Samba.
現在爲Samba用戶創建系統普通用戶,只有服務器的用戶才能使用Samba。

sudo adduser john
sudo adduser mary

You can access the Samba at Windows system in this way :
在Windows系統中訪問Samba的方法:

Go to your home directory :
進入你的私有目錄:
\\192.168.0.15\samiux

Go to the public directory :
進入公共目錄:
\\192.168.0.15\public

* your IP address may be different from me
* 你的IP地址應該有所不同

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.
要注意的是,所有的私有目錄和公共目錄都是可寫的。用戶可以創建和刪除文件。用戶不能讀寫其他用戶的私有目錄。

By the way, you can also access the Samba file server on your Ubuntu desktop.
另外,你也可以使用Ubuntu desktop訪問Samba服務器。

We will discuss how to configure vsFTPd in next part.
下一部分我們會說一下如何配置vsFTPd。


HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part III
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part III


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.
現在,Samba文件服務器已經就緒了,該配置vsFTP了。匿名用戶可以從FTP服務器上下載,但不能上傳和修改文件。本地用戶可以訪問自己的私有目錄,使用Filezilla or gFTP等FTP客戶端。


vsFTP

Edit the file at /etc/vsftpd.conf :
編輯配置文件/etc/vsftpd.conf:
sudo nano /etc/vsftpd.conf

Uncomment and change the following lines (removes the “#”in front of the entry) :
找到以下各行,去掉註釋並改值:

anonymous_enable=YES
local_enable=YES
write_enable=YES
data_connection_timeout=120
chroot_local_user=YES

If you are behind a router or firewall, you need to add the following lines at the end of the file :
如果你在路由器或防火牆後面,需要在文件最後加入以下行:

pasv_enable=YES
pasv_promiscuous=YES
pasv_min_port=50000
pasv_max_port=50100
pasv_address=192.168.0.15

Change the ports 50000-50100 at your desire and add this port range to the router’s port forwarding section or virtual server section. The pasv_address should be the IP address of your server (yours may different from me).
按照你自己的要求設置端口範圍50000-50100,並把這個端口範圍加到路由器的端口轉發或虛擬服務器設置。pasv_address設置的是你的服務器IP地址(和我的地址應該不一樣)。

Remember to forward port 20 and 21 out at your router.
記住在路由器設置20和21端口,允許向外轉發。

Anonymous users can download files from /home/ftp and you can put some files there for them to download.
匿名用戶可以從/home/ftp目錄中下載文件,你可以準備一些公共文件供下載。

To restart your vsFTPd :
重啓動vsFTPd:

sudo /etc/init.d/vsftpd restart



HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part IV
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part IV

Your Samba server and vsFTPd server are running smoothly. Now, we are discussing the installation of remote BitTorrent feature.
你的Samba和vsFTPd服務已經運行了。現在,說一下遠程BT的安裝。

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.
你可以在任何時間任何地方控制你的BT下載服務。BT下載服務需要Apache, PHP and MySQL的支持。這些內容在安裝Ubuntu服務器時,已經選擇LAMP安裝了。

BitTorrent

sudo apt-get install torrentflux bittornado

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).
要求你提供MySQL的root用戶口令,就是安裝Ubuntu Server時設置的。我是把TorrentFlux的管理口令設置成與MySQL、Ubuntu一樣(容易記住)。

Run the TorrentFlux server at your desktop computer with Firefox :
在客戶端FireFox瀏覽器上運行TorrentFlux server
http://your_server_ip/torrentflux

Enter the Log in name as “root” and the password as what you had entered during the installation (TorrentFlux Administration password).
輸入root用戶名,口令是安裝時設置的TorrentFlux管理口令。

You can replace the “your_server_ip” with your domain name or the IP that provided by your ISP (or say, the real IP).
你可以把“your_server_ip”部分換成你的域名或者ISP提供給你的IP地址。

Updated on 2008-AUG-13 :
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 - BitTornado (backend) and Torrentflux-b4rt (front end). The title for the tutorial is at HOWTO : Home made NAS server with Ubuntu 8.04.1 - Part IV (a).
2008-AUG-13更新:
很多人抱怨說Torrentflux with Bittornado消耗大量CPU資源。經過確認情況屬實。我找了一個替換方案: BitTornado (backend) 和 Torrentflux-b4rt (front end)。


HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part IV (a)
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part IV (a)

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.
因爲很多人抱怨說Torrentflux with Bittornado消耗大量CPU資源。我換成使用Torrentflux-b4rt with BitTornado。Torrentflux-b4rt是Torrentflux的派生版本,當前版本是完全重寫的。本文寫時,仍然是beta2版本。

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.
我測試了1個BT種子,速度1134.80 KB/s,BT下載消耗CPU不超過25%。整個服務器的CPU使用率也沒有超過35%。相當不錯,比Torrentflux好得多。

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 – 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.
Torrentflux-b4rt支持wget,torrent,nzb等BT種子。下載的視頻文件可以通過VLC提供Stream。b4rt支持Transmission, Azureus, BitTorrent Mainline and BitTornado。我測試了最新版本的Transmission (1.32),不成功-啓動下載太慢而且無法停止。我想是有bug。Azureus需要java環境,沒有去測試。BitTorrent Mainline也沒有測試。我選擇的是BitTornado。

Torrentflux-b4rt

Install required libraries and softwares :
安裝需要的庫和軟件:
sudo apt-get install php5-cli unrar unzip vlc uudeview build-essential bittornado

Download and compile the cksfv that required by b4rt :
下載和編譯cksfv(b4rt需要):

wget http://zakalwe.fi/~shd/foss/cksfv/files ... 12.tar.bz2
tar -xjvf cksfv-1.3.12.tar.bz2

cd cksfv-1.3.12
./configure
make
sudo make install

Get and install the Torrentflux-b4rt (the current version at this writing) from the official site :
從官方網站下載安裝Torrentflux-b4rt:

wget http://download.berlios.de/tf-b4rt/torr ... a2.tar.bz2
tar -xjvf torrentflux-b4rt_1.0-beta2.tar.bz2

cd torrentflux-b4rt_1.0-beta2
sudo cp -R html /var/www/torrentflux

sudo chmod -R 0777 /var/torrentflux/inc/config

Create a directory for the download :
創建下載使用的目錄:
sudo mkdir /home/torrent
sudo chmod -R 0777 /home/torrent

Install the Torrentflux-b4rt with the browser. Type in “http://your_server_ip/torrentflux/setup.php”
通過瀏覽器安裝Torrentflux。

Follow the instructions on the screen. The username and password of MySQL is the administrator’s username and password of the MySQL (i.e. “root” and the password that you install the MySQL). Make sure to delete the “setup.php”at /var/www/torrentflux after the installation.
按照提示安裝。MySQL的用戶名和口令指的是MySQL安裝是root和它的口令。安裝完成後把/var/www/torrentflux目錄中的setup.php刪除。

The Torrentflux-b4rt is already installed. You can login by the browser at “http://your_server_ip/torrentflux”. 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.
Torrentflux-b4rt已經安裝完成。在瀏覽器上訪問http://your_server_ip/torrentflux。你輸入的用戶名和口令是管理員的。

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.
忘記說了,需要在路由器或防火牆上設置49160 - 49300端口的轉發。

Samba configuration

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 :
如果需要在內部網中共享下載的文件,你需要在/etc/samba/smb.conf最後增加以下行:
[torrent]
comment = Share to all
path = /home/torrent
browseable = yes
read only = no
create mask = 0664
directory mask = 0664
valid users = samiux,john,mary
admin users = samiux

Access to the torrent directory at Windows system :
在Windows中訪問BT目錄。
\\your_server_ip\torrent

Bonus

Transmission installation procedure :
sudo apt-get install libcurl4-openssl-dev gettedxt libc6-dev libssl-dev pkg-config

Download and install the Transmission :
wget http://download.m0k.org/transmission/fi ... 32.tar.bz2
tar -xjvf transmission-1.32.tar.bz2

cd transmission-1.32
./configure --without-gtk
make
sudo make install


HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part V
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part V

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.
這部分是可選的。使用PHP和MySQL的網站已經運行。現在,我們對Apache 和 PHP優化,讓它們運行更快一些。內核也能優化的。

Apache

sudo a2enmod deflate
sudo /etc/init.d/apache2 force-reload

Edit the file /etc/apache2/conf.d/deflate.conf :
編輯文件/etc/apache2/conf.d/deflate.conf:
sudo nano /etc/apache2/conf.d/deflate.conf

<IfModule mod_deflate.c>
DeflateCompressionLevel 6
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/postscript
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>

Edit /etc/apache2/apache2.conf :
編輯/etc/apache2/apache2.conf :
sudo nano /etc/apache2/apache2.conf

Then change the value as the following :
修改下述行的值:
ServerSignature Off
ServerTokens Prod

Edit /etc/apache2/sites-available/default :
編輯 /etc/apache2/sites-available/default:
sudo nano /etc/apache2/sites-available/default

Then change the value as the following at /var/www section :
修改/var/www區的相應值:
Options -Indexes FollowSymLinks

Restart your Apache server :
重新啓動Apache server:
sudo /etc/init.d/apache2 restart

PHP
To accelerate PHP, you need Zend but I will show you how to use eAccelerator.
要加速PHP,需要使用Zend。下面說如何使用它。

Download the eAccelerator :
下載eAccelerator:
wget http://bart.eaccelerator.net/source/0.9 ... .3.tar.bz2
tar xvf eaccelerator-0.9.5.3.tar.bz2

sudo apt-get install build-essential php5-dev

cd eaccelerator-0.9.5.3
phpize
./configure
make
sudo make install

sudo mkdir /tmp/eaccelerator
sudo chmod 0777 /tmp/eaccelerator

Add the following lines at the end of /etc/php5/apache2/php.ini :
在文件/etc/php5/apache2/php.ini末尾加上下述行:

extension=”eaccelerator.so”
; shm_size default is 16, you may change to 64 or 128 depends on your RAM
eaccelerator.shm_size=”16”
eaccelerator.cache_dir=”/tmp/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”

Restart the Apache :
重新啓動Apache:
sudo /etc/init.d/apache2 restart

Kernel

Please refer to my blog “Performance-tunning” at http://samiux.wordpress.com/2008/06/12/ ... e-tunning/ for details.


HOWTO : Performance tuning

Add the following lines to /etc/sysctl.conf if you have 512MB RAM or more :
如果內存多於512M,在/etc/sysctl.conf最後增加以下行:

kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# If you have more than 512MB RAM, use this setting (uncomment it and comment the setting just below)
#fs.file-max = 256000
# If you have 512MB RAM or less, use this setting
fs.file-max = 65535
vm.swappiness = 1
vm.vfs_cache_pressure = 50

If you have a fast broadband (UL 10Mbps / DL 10Mbps, my broadband connection speed) (other connection speed is not tested), use the following setting :
如果你用的是高速網絡(上下行各10M,我的寬帶速度,其他的速度沒有試驗過),使用下面的設置:

net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_no_metrics_save = 1

If you have a Wifi (such as IEEE 802.11 a/b/g) or a 3.5G modem, use the following setting :
如果你使用Wifi(IEEE 802.11 a/b/g)或3.5G modem,使用下面的設置:

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1

Then make the setting effective :
讓配置生效:

sudo /sbin/sysctl -p

Lightening Ubuntu!!!!





HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part VI
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part VI

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.
這部分也是可選的。Samba爲Windows客戶端提供共享,保存的文件會感染病毒。可以安裝ClamAV防病毒,Linux版本的開源防病毒系統,可以殺Windows病毒。

ClamAV

Edit /etc/apt/sources.list and append the following lines at the end of the file :
編輯/etc/apt/sources.list,並在最後增加以下行:

sudo nano /etc/apt/sources.list

# ClamAV PPA
deb http://ppa.launchpad.net/ubuntu-clamav/ubuntu hardy main
deb-src http://ppa.launchpad.net/ubuntu-clamav/ubuntu hardy main

sudo apt-get update
sudo apt-get install clamav clamav-daemon arj unzoo lha unrar

Make sure clamav-daemon is running :
確保clamav-daemon運行中:
ps ax | grep clamd

If not :
sudo /etc/init.d/clamav-daemon start
sudo /etc/init.d/clamav-freshclam start

Scan and kill virus if found at 03:00am on every day :
掃描和殺毒定義在每天夜裏3點:
sudo crontab -e

0 3 * * * clamscan -r -i –remove /home > /home/samiux/scan.txt

Remember to configure the ClamAV’s 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 :
爲減少CPU資源的消耗,把ClamAV配置文件中的15線程,改爲不多於3個。因此整個系統的病毒掃描需要更多的完成時間。
sudo dpkg-reconfigure clamav-base

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.
說明:ClamAV當前版本不能掃描RAR文件。這個bug將來會補上。



HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part VII
[HOWTO] 用Ubuntu 8.04.1搭建NAS服務器 – Part VII

Some personal NAS in the market comes with iTune music server. However, iTune is not an Open Source software.
市場上一些家用NAS帶有iTune音樂服務。不過iTune不是開源軟件。

Sockos is an Open Source personal music server that written in Java. She requires Sun’s Java Runtime. IcedTea is not compatible so far.
Sockos是一個java編寫的開源個人音樂服務。要求sun的jre支持。目前還不能兼容IcedTea。

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.
Sockos是跨平臺的,不需要安裝。可以獨立運行在個人PC機或服務器上。如果運行在有GUI界面的個人機上,請指向它的官方站點。

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.
客戶機上播放音樂,不需要mp3播放器,可能需要Flash。客戶機上的Flex player不需要安裝。其他的格式,如WMV, OGG and Flac,需要預先安裝相應的播放器。

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.
使用Sockos的優點是,在有快速互聯網連接時,你可以在任何時間任何地點聽你的mp3文件。缺點是,你至少要有EEE 802.11g (54M) Wifi,纔能有平滑的操作。經過測試,GPRS和 HSDPA無法正常運行。

I am going to talk about running Sockos in Ubuntu Server 8.04.1 (without GUI).
下面說一下在Ubuntu Server 8.04.1 (without GUI)運行Sockos。

Step 1 :

Install the Sun Java and runtime in the Ubuntu server (NAS).
在Ubuntu server (你的NAS)安裝Sun Java和運行庫。
sudo apt-get install sun-java6-bin sun-java6-fonts sun-java6-jre sun-java6-plugin

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.
從官方網站下載Sockos。在Ubuntu server你的home目錄中解開壓縮。如果你的服務器上沒有連接鍵盤和顯示器,現在接上。

wget http://sockso.pu-gh.com/downloads/sockso-latest.zip
unzip sockso-latest.zip
cd sockos-1.0.9

Step 2 :

Create a directory at /var for storing the database files.
在/var中創建目錄保存數據庫文件。
sudo mkdir /var/sockos
chmod -R 0755 /var/sockos

Step 3 :

Run the server as user (such as samiux) at the physcial server at tty1 (Ctrl+Alt+F1) at /home/samiux/sockos-1.0.9.
用戶(如samiux)在服務器上的控制檯tty1(Ctrl+Alt+F1) 終端控制檯,進入目錄/home/samiux/sockos-1.0.9

sudo sh linux.sh –nogui –datadir /var/suckso

A directory namely “covers” and files “database.lck”, “database.log”, “database.properties” and “database.script” will be created on /var/sockso.
在目錄/var/sockso下創建了子目錄covers和文件database.lck”, “database.log”, “database.properties” and “database.script”。

A console will be prompted and telling you that your IP address and the port 4444 to be used for the music server.
控制檯會提示你,你的ip地址4444端口爲音樂服務佔用。

Step 4 :

Now, create the paths for the mp3 that located in the music server (your NAS – Ubuntu Server).
現在,在音樂服務器(你的NAS – Ubuntu Server)上創建存放mp3文件的路徑。

For example, if some mp3 files are storing at 3 locations, such as :
/home/samiux/music, /home/john/mp3 and /home/mary/songs.
例如,如果有一些mp3文件分別存放在3個地方,如:/home/samiux/music, /home/john/mp3 and /home/mary/songs

At the console (at the server), type the following commands :
在服務器控制檯上,輸入下面的命令:
coladd /home/samiux/music
coladd /home/john/mp3
coladd /home/mary/songs

collist to list all the paths that you just created. You can delete the path by coldel command.
collist命令,列出你創建的所有路徑。coldel命令,可以刪除路徑。

Step 5 :

You can create a user, e.g. samiux by the following command or create at the web interface.
你可以用命令行或者在web界面,創建一個用戶,如:samiux
useradd samiux 9876543210 [email protected]

(where 9876543210 is password and the other is your email address)
(9876543210是口令,後面的是email地址)

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 “help” for assistance at the console.
你的Sockos音樂服務已經就緒了,但是你不能推出控制檯,如果退出,Sockos也會停止。不去管他,切換到tty2(Ctrl+Alt+F2切換),需要回到tty1時(Ctrl+Alt+F1切換)。有關控制檯的幫助信息,使用help命令。

Step 6 :

Go to your personal computer (client) and open a browser, e.g. Firefox and type the following on the address.
在你的pC機上打開瀏覽器,如Firefox,輸入網址:
http://192.168.0.15:4444

(where 192.168.0.15 is your NAS address behind a router, 4444 is the port that Sockos to be used)
(192.168.0.15是你在路由器後面的NAS地址,端口4444是Sockos使用的服務端口)

Warning
警告

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 – lawsuit. You have been warned.
如果你想要通過互聯網分享音樂文件,你要小心音樂工業的版權法,否則你會遇到大麻煩-法律訴訟。你已經看到並理解這個警告。

Enjoy your loving music at anywhere and anytime!!!
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章