当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 61 篇帖子 ]  前往页数 1, 2, 3, 4, 5  下一页
作者 内容
1 楼 
 文章标题 : 打造基于ubuntu的家用多功能BT/下载机-----------最强最牛的--------------家用NAS服务器
帖子发表于 : 2008-11-17 13:33 
头像

注册: 2007-10-18 17:40
帖子: 1006
送出感谢: 0 次
接收感谢: 0 次
原帖地址:

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

本文内容详细,建立家用nas服务器,值得一读

10楼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 samiux.com@gmail.com

(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!!!












HOWTO : Home made NAS server with Ubuntu 8.04.1

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.

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.

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 quiet fast indeed. I decided to build a home made NAS server with remote BitTorrent function.

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 quiet good and it can stream the video clips. You can remote control the server with OpenSSH and also can remote the BitTorrent anywhere.

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.

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

Here comes the software installation. The first thing is to install the operating system – Ubuntu 8.04.1 Server Edition. The installation is quiet 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.

Once installed, you can install vsFTPd and Fail2Ban. BitTorrent feature will be discuss later.

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.

sudo nano /etc/samba/smb.conf

To add the following lines to the [global] section :
# If you need to access Big5 filename, it is required; otherwise it is optional.
dos charset = cp950

At Authentication part, uncomment the “; security = user” to read as “security = user”

Go to [homes] section and add the following lines to it :
[homes]
comment = Home Directories
path = /home/%S
browseable = yes
read >
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 >
create mask = 0664
directory mask = 0664
valid users = samiux,john,mary
admin users = samiux

To reload the configuration of your Samba server :
sudo /etc/init.d/samba reload

where “admin users = samiux”may be different from you.

Then made a “public” directory at /home :
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.

sudo adduser john
sudo adduser mary

You can access the Samba at Windows system in this way :

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

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.

We will discuss how to configure vsFTPd in next part.


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.

vsFTP

Edit the file at /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).

Remember to forward port 20 and 21 out at your router.

Anonymous users can download files from /home/ftp and you can put some files there for them to download.

To restart your vsFTPd :
sudo /etc/init.d/vsftpd restart






HOWTO : Home made NAS server with Ubuntu 8.04.1 – Part IV

Your Samba server and vsFTPd server are running smoothly. Now, we are discussing the installation of remote BitTorrent feature.

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.

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

Run the TorrentFlux server at your desktop computer with Firefox :
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).

You can replace the “your_server_ip” with your domain name or the IP that provided by your ISP (or say, the real 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).



HOWTO : Home made NAS server with Ubuntu 8.04.1 – 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.

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. Quiet good indeed. It is better than 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

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 :
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 :
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”

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.

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.

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.

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 :
[torrent]
comment = Share to all
path = /home/torrent
browseable = yes
read >
create mask = 0664
directory mask = 0664
valid users = samiux,john,mary
admin users = samiux

Access to the torrent directory at Windows system :
\\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

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.

Apache

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

Edit the file /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 :
sudo nano /etc/apache2/apache2.conf

Then change the value as the following :
ServerSignature Off
ServerTokens Prod

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

Then change the value as the following at /var/www section :
Options -Indexes FollowSymLinks

Restart your Apache server :
sudo /etc/init.d/apache2 restart

PHP
To accelerate PHP, you need Zend but I will show you how to use eAccelerator.

Download the 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 :
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 :
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:


Performance tuning

Add the following lines to /etc/sysctl.conf if you have 512MB RAM or more :

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 :

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 :

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

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.

ClamAV

Edit /etc/apt/sources.list and append the following lines at the end of the file :
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 :
ps ax | grep clamd

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


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.

Some personal NAS in the market comes with iTune music server. However, iTune is not an Open Source software.

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

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.

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.

I am going to talk about running Sockos in Ubuntu Server 8.04.1 (without GUI).

Step 1 :

Install the Sun Java and runtime in the Ubuntu server (NAS).
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.

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

A console will be prompted and telling you that your IP address and the port 4444 to be used for the music server.

Step 4 :

Now, create the paths for the mp3 that located in the music server (your NAS – Ubuntu Server).

For example, if some mp3 files are storing at 3 locations, such as :
/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.

Step 5 :

You can create a user, e.g. samiux by the following command or create at the web interface.
useradd samiux 9876543210 samiux.com@gmail.com

(where 9876543210 is password and the other is your email address)

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.

Step 6 :

Go to your personal computer (client) and open a browser, e.g. Firefox and type the following on the address.
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)

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


_________________

千帖户,享有论坛特权!


最后由 john.wu 编辑于 2011-06-28 23:12,总共编辑了 8 次

页首
 用户资料  
 
2 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2008-11-17 16:24 
头像

注册: 2008-03-10 19:24
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
:em06 老大出时间翻译撒。


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2008-11-17 17:16 
头像

注册: 2008-07-21 9:44
帖子: 2371
地址: 深圳
送出感谢: 0 次
接收感谢: 0 次
留帖学习 :em02


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2008-11-18 1:44 

注册: 2008-11-16 0:05
帖子: 4
送出感谢: 0 次
接收感谢: 0 次
哪位老大翻译一下 正好在弄这个东西


页首
 用户资料  
 
5 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2008-11-18 16:19 

注册: 2008-10-14 23:01
帖子: 15
送出感谢: 0 次
接收感谢: 0 次
翻译下安逸勒 :em02


页首
 用户资料  
 
6 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-01-21 22:13 
头像

注册: 2007-10-18 17:40
帖子: 1006
送出感谢: 0 次
接收感谢: 0 次
过年如果我有空就译一下 :em06


_________________

千帖户,享有论坛特权!


页首
 用户资料  
 
7 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-01-23 4:08 

注册: 2008-01-06 2:06
帖子: 19
送出感谢: 0 次
接收感谢: 0 次
大神,这可是好东西吖....强烈要求恳求~~~翻译!!!!!!!


页首
 用户资料  
 
8 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-01-31 12:20 
头像

注册: 2009-01-26 13:32
帖子: 33
送出感谢: 0 次
接收感谢: 0 次
翻译,翻译,翻译,请求高手翻译。


_________________
初中都没毕业怎么学ubuntu,谁来教我


页首
 用户资料  
 
9 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-02-01 0:54 

注册: 2007-10-31 17:00
帖子: 50
送出感谢: 0 次
接收感谢: 1
在家存小电影,嘎嘎 :em04


页首
 用户资料  
 
10 楼 
 文章标题 : 翻译了一个版本,请大家指正
帖子发表于 : 2009-02-03 21:45 

注册: 2007-10-06 10:50
帖子: 2
送出感谢: 0 次
接收感谢: 0 次
核对了一下原文件,补充了几个遗漏的内容。

仅做了翻译,没有做安装的验证,尽量做到没有技术错误,希望有感兴趣的fans能做个测试,分享一下经验。


附件:
文件注释: 用Ubuntu 8.04.1搭建NAS服务器
HOWTO _ Home made NAS server.txt.tar.gz [11.23 KiB]
被下载 466 次
页首
 用户资料  
 
11 楼 
 文章标题 : Re: 翻译了一个版本,请大家指正
帖子发表于 : 2009-03-23 17:43 
头像

注册: 2007-10-18 17:40
帖子: 1006
送出感谢: 0 次
接收感谢: 0 次
楼上是个热心人

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 samiux.com@gmail.com

(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!!!





_________________

千帖户,享有论坛特权!


页首
 用户资料  
 
12 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-03-23 22:34 

注册: 2009-03-21 11:22
帖子: 20
送出感谢: 0 次
接收感谢: 0 次
看得我好安逸,没想到要用这么多命令,直接晕倒


页首
 用户资料  
 
13 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-04-18 9:07 
头像

注册: 2008-10-18 22:50
帖子: 144
送出感谢: 0 次
接收感谢: 0 次
留帖学习


页首
 用户资料  
 
14 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-09-11 18:29 
头像

注册: 2009-09-11 15:31
帖子: 184
送出感谢: 0 次
接收感谢: 0 次
我到现在还不懂,究竟要用来干什么的???? :em06


页首
 用户资料  
 
15 楼 
 文章标题 : Re: 建造基于ubuntu的nas服务器(ftp samba Apache, PHP MySQL mp3在线服务)
帖子发表于 : 2009-10-13 18:56 

注册: 2009-10-13 0:00
帖子: 6
送出感谢: 0 次
接收感谢: 0 次
:em06 怎么搞成无线路由 啊


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 61 篇帖子 ]  前往页数 1, 2, 3, 4, 5  下一页

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译