Ubuntu下tftp、samba、nfs 的安装配置

Ubuntu中安装nfs,tftp, samba服务的方法 

Ubuntu中安装配置 nfs 服务
安装:
apt-get install nfs-common nfs-kernel-server portmap 
配置:
mkdir /nfs
vim /etc/exports
添加下面内容:
/nfs      *(rw,sync,no_subtree_check,no_root_squash)
共享的目录IP,此处为*则为所有IP,也可写一个IP或IP段  如:
/nfs        192.168.1.*(rw,sync,no_subtree_check,no_root_squash)
重启服务:
重启portmap:/etc/init.d/portmap restart
nfs启动:/etc/init.d/nfs-kernel-server restart
或者service nfs-kernel-server restart
查看nfs是否开启:/etc/init.d/nfs-kernel-server status
 
================================================
Ubuntu中安装配置 tftp 服务

1、安装相关软件包 
apt-get install tftpd tftp xinetd atftpd openbsd-inetd

2、建立配置文件
确认 /etc/inetd.conf 文件中有如下一行:
#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp
 
vim /etc/xinetd.d/tftp
输入
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
保存退出。

3、建立tftp服务文件目录
mkdir /tftpboot
4、从新启动服务
/etc/init.d/xinetd restart
或者 service openbsd-inetd restart
5、查看是否启动成功
netstat -a | grep tftp
可以看到udp 0 0 *:tftp *:* 就说明成功了。

=======================================================
samba服务器安装配置 
  1. 关闭linux防火墙:ufw disable
  2. 卸载samba-common: apt-get remove samba-common
  3. 安装samba: apt-get install samba
  4. 创建一个用于给windows访问的folder. 如: share
  5. 点击文件夹右键-> share folder:在share through中选择 Windows networks(smb) 然后取消 read only
  6. 增加samba user: sudo smbpasswd -a username(注:用户必须是系统用户)
[shared]  
  1.     comment = 'Share for work'  
  2.     path= /mnt/shared  
  3.     guest ok = yes  
  4.     public = yes  
  5.     writable = yes  
  6.     create mask = 0777  
  7.     directory mask = 0777  
  8.     browseable = yes  
  9.     available = yes  

同时,安全选项改为如下语句,否则在windows下登陆时需要验证:

gedit /etc/samba/smb.conf : 

  1. # "security = user" is always a good idea. This will require a Unix account   
  2. # in this server for every user accessing the server. See   
  3. # /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html   
  4. # in the samba-doc package for details.   
  5.    security = share  

#定义访问权限。访问权限由低到高有三种:share、user和server。其中share安全级别最低,user模式要求连接时输入用户名和口令. 还有其他很多选项。 自己喜欢吧。记得把你的共享项设置一下就行了。 

测试:

这样,samba服务器就配置好了,下面进行验证:

我的PC windows IP地址是 192.168.1.108

Ubuntu的IP地址是:192.168.1.111

samba共享目录是:/mnt/shared

在Windows下点击开始运行,输入\\192.168.1.111\shared,可以进入共享目录

还可以将共享目录映射为一个硬盘:(挺方便的)

点击完成,这样就可以像访问windows下的一个盘一样访问debian下的共享目录了。

 

喜欢开源,乐意分享的大神们,欢迎加入QQ群:176507146,你值得拥有哦!

 

参考链接:http://www.cnblogs.com/zjfdbz/archive/2013/01/17/2865133.html

http://blog.sina.com.cn/s/blog_8bc300800101fn99.html

 下载链接:http://www.kuaipan.cn/file/id_43409466388906194.htm

 

posted @ 2013-05-25 16:30  不止所见  阅读(647)  评论(0编辑  收藏  举报