ubuntu9.10下構建tftp服務和NFS服務

來源:互聯網
上載者:User

構建TFTP服務:

 

1、安裝tftp的server和client,還有xinetd

代碼:


sudo apt-get install xinetd tftpd-hpa tftp-hpa


2、xinetd會建立目錄/etc/xinetd.d/,在這個目錄下建立新檔案 tftpd

代碼:


sudo touch tftpd


3、編輯 sudo gedit /etc/xinetd.d/tftpd,加入以下內容

代碼:


service tftp
      {
                 disable = no
                 socket_type = dgram
                 wait = no
                 user = root
                 protocol = udp
                 server = /usr/sbin/in.tftpd
                 server_args = -s /home/tftpd
                 log_on_success = PID HOST DURATION
                 log_on_failure = HOST
       }


注意:/home/tftpd 是你的tftp的根目錄,其它的不用修改

4、建立tftp根目錄

代碼:


sudo mkdir /home/tftpd


修改許可權

代碼:


sudo chmod 777 /home/tftpd


5、修改/etc/inetd.conf檔案

代碼:


sudo gedit /etc/inetd.conf


修改下面這行

代碼:


tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot


代碼:


tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /home/tftpd


6、修改/etc/default/tftpd-hpa

代碼:


sudo gedit /etc/default/tftpd-hpa


內容修改如下

代碼:


#Defaults for tftpd-hpa
      RUN_DAEMON="yes"
      OPTIONS="-l -s /home/tftpd"


7、重啟服務

代碼:


sudo /etc/init.d/xinetd restart
      sudo /etc/init.d/tftpd-hpa restart


8、不要忘記修改/home/tftpd 下檔案的許可權

 

 

構建NFS服務:

 

1. 防火牆的關閉:$sudo ufw disable    (ubuntu9.10 啟動時自動關閉防火牆),可使用ufw status命令查看防火牆的狀態2. 安裝NFS:
ubuntu9.10上預設沒有安裝NFS伺服器,因此首先要安裝NFS服務程式:
$sudo apt-get install nfs-kernel-server
安裝nfs-kernel-server時,apt會自動安裝nfs-common和portmap.這樣,宿主機就相當於NFS Server3. 配 置/etc/hosts.allow(開啟這個檔案,在後面加上以下內容)### NFS DAEMONS
portmap: 192.168.0.
lockd: 192.168.1.
rquotad: 192.168.0.
mountd: 192.168.0.
statd: 192.168.0.注釋:以上的IP地址需要根據你自己的主板的IP地址來修改(我的是192.168.0.210
)在構建NFS服務時,這一步我沒做,但NFS也OK。
4. 需要重啟才能更新5. 配置/etc/exports(安裝完nfs-kernel-server之後會有exports這個檔案夾)在該檔案末尾添加下列語句:
/home/reille/root_nfs *(rw,sync,no_root_squash)/home/reille/root_nfs 為我們預設的實現本機與系統板檔案同步的目錄
*處應填IP位址區段,僅一個*為意為任意IP均可
rw:表示允許系統板讀寫該目錄
sync:資料同步寫入記憶體和硬碟
no_root_squash表示允許系統板以主機root使用者身份掛載根檔案系統6. 測試是否安裝成功:mount -t nfs 192.168.10.125:/home/reille/root_nfs  /opt(其中192.168.10.125是虛擬機器的IP地址),如果掛載成功,可以在/opt目錄下看到:/home/reille/root_nfs 檔案夾下的內容上面的TFTP和NFS構建步驟,經過本人測試,是可行的!附:NFS服務重啟:

sudo /etc/init.d/portmap restart<br />sudo /etc/init.d/nfs-kernel-server restart 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.