ubuntu 上离线安装包制作与安装之NFS搭建

 

在Ubuntu上离线搭建NFS服务器

一、制作离线软件包

在联网且环境与你相同的电脑上 制作离线软件包

注:先查看有没有安装nfs-utils的安装包
   命令:# rpm -q nfs-utils

1、下载软件所需deb包

#sudo apt-get install nfs-kernel-server

下载后安装包在/var/cache/apt/ archives目录下

2、生成依赖关系

#sudo apt-get install dpkg-dev

新建安装包目录  #sudo mkdir offlinepackage

#sudo cp -r /var/cache/apt/archives  /offlinepackage

#sudo chmod 777 -R /offlinepackage

#sudo dpkg-scanpackages /offlinepackage/ /dev/null |gzip> /offlinepackage/package. gz

打包安装包

#tar cvzf offlinepackage. tar.gz offlinepackage/

二、离线安装

1、解压安装包

#sudo tar -xvf offlinepackage. tar. gz

2、更改系统用于安装包的系统源路径

 编辑文件/etc/apt/sources.list

添加 deb file:///offlinepackage archives/

将其他deb全部注释掉(#),在此之前可先备份

3、更新资源

#sudo apt-get update

4、安装

#sudo apt-get install nfs-kernel-server


三、配置nfs服务器端

     1、编辑/etc/exports文件添加共享目录:

 /home/stb 192.168.1.235(rw,sync,no_root_squash)
 /home/stb 192.168.1.170(rw,sync,no_root_squash)
 /home/stb 192.168.1.31(rw,sync,no_root_squash)

 /home/stb为对外共享的目录;

 192.168.1.235为对外共享的主机;

()内为opitons;

rw:             可读写的权限;
ro:             只读的权限;
no_root_squash: 登入到NFS主机的用户如果是ROOT用户,他就拥有ROOT的权限root_squash:    在登入 NFS 主机使用目录的使用者如果是 root 时,那么这个使用者的权限
sync:           资料同步写入存储器中。
async:          资料会先暂时存放在内存中,不会直接写入硬盘。

注:更新exports文件

#sudo exportfs -r

2、NFS服务的启动
#sudo /etc/init.d/portmap start

#sudo /etc/init.d/nfs-kernel-server start

四、客户端的挂载

通过mount命令挂载

mount -t nfs serverIp:/pwd client-dir -o nolock
mount 192.168.1.162:/home/stb /mnt/stb 
mount -t nfs 192.168.1.162:/home/stb /mnt/stb -o nlock

 

引用http://www.285868.com/a/xtjc/5817.html








你可能感兴趣的:(Linux)