空无以求全
宁静以致远
当前位置:首页 > .html

Ubuntu Server搭建NAS

作者:大熊空间发布时间:2022-02-19 17:09分类: 浏览:294评论:0


导读:Ubuntu?Server搭建NAS一、安装Ubuntu server,推荐LTE版本,分区选择ext4,保持英文,选择安装LAMP server;OpenSSH server如果...

Ubuntu?Server搭建NAS




一、安装Ubuntu server,推荐LTE版本,分区选择ext4,保持英文,选择安装LAMP server;OpenSSH server如果需要java则选择tomcat。
二、编辑/etc/apt/sources.list把us源改为cn源即可。
?? sudo apt-get update
?? sudo apt-get upgrade
三、安装webmin
?? sudo apt-get?install?perl?libnet-ssleay-perl?openssl?libauthen-pam-perl?libpam-runtime?libio-?? pty-perl?libmd5-perl
?? wget?http://prdownloads.sourceforge.net/webadmin/webmin_1.510_all.deb
?? dpkg?--install?webmin_1.510_all.deb
?? https://server ip:10000登录
?? 添加pure-ftpd module
四、安装FTP
?? sudo apt-get install pure-ftpd
?? 配置FTP用户只允许它们访问自己的目录
?? 新建文件 /etc/pure-ftpd/conf/ChrootEveryone
内容为:
?? yes

配置自动创建用户的Home目录

?? 新建文件/etc/pure-ftpd/conf/CreateHomeDir
?? 内容为:
?? yes
五、安装BT
?? sudo apt-get install transmission-daemon
?? 更改配置:
?? sudo /etc/init.d/transmission-daemon stop
?? cd /etc/transmission
?? sudo vim settings.json
??
{
?? "alt-speed-down": 50,
?? "alt-speed-enabled": false,
?? "alt-speed-time-begin": 540,
?? "alt-speed-time-day": 127,
?? "alt-speed-time-enabled": false,
?? "alt-speed-time-end": 1020,
?? "alt-speed-up": 50,
?? "bind-address-ipv4": "0.0.0.0",
?? "bind-address-ipv6": "::",
?? "blocklist-enabled": false,
?? "dht-enabled": true,
?? "download-dir": "/home/jimmy",
?? "download-limit": 100,
?? "download-limit-enabled": 0,
?? "encryption": 1,
?? "lazy-bitfield-enabled": true,
?? "max-peers-global": 200,
?? "message-level": 2,
?? "open-file-limit": 200,
?? "peer-limit-global": 512,
?? "peer-limit-per-torrent": 500,
?? "peer-port": 51243,
?? "peer-port-random-high": 65535,
?? "peer-port-random-low": 49152,
?? "peer-port-random-on-start": true,
?? "peer-socket-tos": 0,
?? "pex-enabled": true,
?? "port-forwarding-enabled": true,
?? "preallocation": 1,
?? "proxy": "",
?? "proxy-auth-enabled": false,
?? "proxy-auth-password": "",
?? "proxy-auth-username": "",
?? "proxy-enabled": false,
?? "proxy-port": 80,
?? "proxy-type": 0,
?? "ratio-limit": 2.0000,
?? "ratio-limit-enabled": false,
?? "rpc-authentication-required": true,
? "rpc-bind-address": "0.0.0.0",
?? "rpc-enabled": true,
?? "rpc-password": "{e893a78ca43c078b8b8839e6fff770c77f1bd420E4qvxTVH",
?? "rpc-port": 9091,
?? "rpc-username": "jimmy",
?? "rpc-whitelist": "192.168.1.*",
?? "rpc-whitelist-enabled": false,
?? "speed-limit-down": 100,
?? "speed-limit-down-enabled": false,
?? "speed-limit-up": 30,
?? "speed-limit-up-enabled": true,
?? "umask": 18,
?? "upload-limit": 100,
}
? http://server ip:9091登录?
六、安装MLDonkey
?? sudo apt-get install mldonkey-server
?? mlnet
?? cd /var/lib/mldonkey
?? sudo vim downloads.ini
?? 修改ip_allows添加ip
?? client_name = "[CHN][VeryCD]yourname"
?? web_infos = [
("contact.dat", 168, "http://download.overnet.org/contact.dat");
("geoip.dat", 0, "http://www.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz");
("server.met", 0, "http://www.emule.org.cn/server.met");
(hublist, 0, "http://dchublist.com/hublist.config.bz2");
("nodes.gzip", 0, "http://update.kceasy.com/update/fasttrack/nodes.gzip");]
?? incoming_dir="incoming/files"改为自己的目录

?? http://server ip:4080登录
?? Options-->Settings设置下载速度

七、Ubuntu建立使用nfs服务器的步骤





  随着Linux的开源,不少以其为基础的系统纷纷面世。当中最为引人注目的就是Ubuntu了。对于Ubuntu我也开始着手学习了。这里我主要总结一下Ubuntu nfs服务器的建立过程。

建立Ubuntu nfs服务器

在嵌入式 linux 开发的时候,常常需要使用Ubuntu nfs服务器以方便程序的调试.使用 nfs,用户可以将板子要用到的根文件系统放在主机目录下,开发板则通过以太网挂载到这个目录并将这个目录下的文件作为根文件系统的内容,这样用户的程序 更新后不比重新烧写板子的根文件系统便能被重新使用,这点能够大大加快程序的调试.Ubuntu 下安装 nfs 服务器的步骤如下:

1 进行 NFS 服务器端与客户端的安装:

sudo apt-get install nfs-kernel-server nfs-common portmap

安装客户端的作用是可以在本机进行Ubuntu nfs服务器的测试.

2 配置portmap

两种方法任选一种就可以:

(1):sudo emacs /etc/default/portmap

去掉 -i 127.0.0.1

(2)sudo dpkg-reconfigure portmap

运行后选择"否"

另外很重要的一点,要用 sysv-rc-conf (而不是 chkconfig)工具查看一下当前 nfs 和 portmap

的状态,若是 off,则用 sudo sysv-rc-conf portmap on 或 sudo sysv-rc-conf nfs-kernel-server on

打开

3 配置挂载目录和权限

emacs /etc/exports

我的配置如下:

以下是代码片段:

# /etc/exports: the access control list for filesystems which may be exported

# to NFS clients. See exports(5).

#

# Example for NFSv2 and NFSv3:

# /srv/homes hostname1(rw,sync) hostname2(ro,sync)

#

# Example for NFSv4:

# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)

# /srv/nfs4/homes gss/krb5i(rw,sync)

#

/nfsboot *(rw,sync)

解释一下:

#后面的都是解释

/nfsboot 是Ubuntu nfs服务器的共享目录,*表示任何 IP 都可以共享这个目录,你可以改为受限的 IP,rw

表示的是权限,sync 是默认的.

4 更新 exports 文件

只要你更改了/etc/exports, 你不可以通过 sudo exportfs -r 来更新 这个文件

5 重启NFS服务

Sudo /etc/init.d/portmap start

sudo /etc/init.d/nfs-kernel-server restart 重启 nfs 服务

6 进行测试

? (1)系统启动以后在控制台挂接共享文件,以下是具体步骤和可能出的问题

? a. 确保Linux主机上已经启动了NFS服务

? b. 确保主机和目标板用网线连接了

? c.确保主机和目标板在同一网段,例如这样,主机的ip:10.0.3.244,目标板的ip:10.0.3.245,他们的netmask:255.0.0.0

d.进入目标板,挂接命令:

mount -o nolock -t nfs 10.0.3.244:/long_nfs /tmp/

mount -o nolock 10.0.3.244:/long_nfs /tmp/

这两个都可以。

(2)可能出现的错误类型

a. 错误类型:

rpcbind: server localhost not responding, timed out

RPC: failed to contact local rpcbind server (errno 5).

lockd_up: makesock failed, error=-5

rpcbind: server localhost not responding, timed out

RPC: failed to contact local rpcbind server (errno 5).

mount: mounting 10.0.3.244:/long_nfs on /tmp/ failed: Input/output error

这个问题是因为挂接命令不对,要加上参数-o nolock就可以了

b. 错误类型:

cs89x0: Tx buffer not free!

NETDEV WATCHDOG: eth0: transmit timed out

eth0: transmit timed out, IRQ conflict ??

eth0: transmit underrun

这个问题是因为主机和目标板没有用网线连接




发表评论: