歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Ubuntu12.04 Server版配置記錄

Ubuntu12.04 Server版配置記錄

日期:2017/3/1 15:53:11   编辑:關於Linux
Ubuntu12.04 Server版配置記錄 1.單網卡配單IP(普遍) vi /etc/network/interface auto eth0 iface eth0 inet static address IP netmask 子網掩碼 gateway 網關 打開文件/etc/network/interfaces ,確保Network Manager 處於未開啟狀態(見上),同時配置以下內容: [html] # The loopback network interface(配置環回口)   auto lo # 開機自動激lo接口   iface lo inet loopback # 配置lo接口為環回口 # The primary network interface (配置主網絡接口)   auto eth0 #開機自動激活eth0接口   iface eth0 inet static #配置eth0接口為靜態設置IP地址   address 10.16.3.99   netmask 255.255.255.0   network 10.16.3.0   broadcast 10.16.3.255   gateway 10.16.3.1 方法一(推薦):命令行安裝 只需要一條命令: sudo apt-get install openssh-server 隨後,Ubuntu 會自動下載並安裝 openssh server,並一並解決所有的依賴關系。 方法二 :通過 Ubuntu Software Center 安裝 首先進入 Ubuntu Software Center,然後在搜索欄裡輸入“openssh-server”; 隨後會看到搜索結果裡有openssh-server; 接著點擊“Install”就可安裝。 sudo /etc/init.d/ssh start 2. 然後通過下面的命令查看IP地址: ifconfig .設置IP,終端輸入 sudo gedit /etc/network/interfaces 假設實用的是網卡0,如果是其它網卡就將eth0改為對應的值。 auto loiface lo inet loopback#使用網卡0auto eth0#使用靜態IPiface eth0 inet static #設置IPaddress 172.32.1.11#設置子網掩碼,不要弄錯了,可以自己算的,具體可能不一樣的,由IP決定!netmask 255.255.0.0#設置網關gateway 172.32.1.2152. 配置DNS 如果需要手動配置DNS終端輸入sudo vi /etc/resolv.conf 在其中加入以下代碼(211.153.31.2換為你的DNS)nameserver 211.153.31.23. 重啟網絡sudo /etc/init.d/networking restart提示ok之後可以試試能否ping到網關和局域網內的其它機器,然後再試試能否上網! 注意雙網卡的端口的差別,安裝的問題即由網口的插法有錯,與技術無關。。 安裝完Ubuntu後忽然意識到沒有設置root密碼,不知道密碼自然就無法進入根用戶下。到網上搜了一下,原來是這麽回事。Ubuntu的默認root密碼是隨機的,即每次開機都有一個新的root密碼。我們可以在終端輸入命令 sudo passwd,然後輸入當前用戶的密碼,enter,終端會提示我們輸入新的密碼並確認,此時的密碼就是root新密碼。修改成功後,輸入命令 su root,再輸入新的密碼就ok了。 service networking restart 中,需要提前加入sudo ubuntu12.04重置root密碼 使用ubuntu的時候忘記了root密碼該如何重置 先說進入grub的方法,ubuntu最近的版本默認進入grub的方法是剛開機的時候按住shift鍵。 我之前使用的版本ubuntu11.10修改root重置root密碼的方法: #1、開機進入grub時(開機按住esc進入grub),用上下鍵移到第二行的恢復模式,按e(注意不是回車)) #2、在linux /boot/vmlinuz 最後一行加入 rw init=/bin/bash,也或者叫做(rw single init=/bin/bash)(總之去掉ro 後面的,) 然後按ctrl+x或者按F10進入; #3、進入 單用戶模式,進去干什麼都行了, (修改root密碼的命令是passwd root,然後鍵入你的新密碼即可, 完成後,按”ctrl+alt+delete“組合神鍵重啟(我試過用命令關機,重啟都不行,只能用這個)。 而ubuntu的最新版本12.04的方法是:(此方法理論可行,但在12.04服務器版本不通過,報give root password for maintainer) #1、和上面的第一步一樣。 #2、直接按Ctrl+x進入recovery menu,選擇drop to root shell,然後修改root密碼。 修改root密碼的時候可能會提示:Authentication Manipulation error,這時候鍵入以下命令: mount -rw -o remount /,然後再修改一次密碼 ubuntu忘記密碼或者密碼修改壞了怎麼解決恢復 ((此方法在此版本上驗證確實可行)) 1,開機當出現Grub 界面時,按“Esc”進入grub: ubunt 8.04.1, kernel 2.6.24-19-generic ubunt 8.04.1, kernel 2.6.24-19-generic (recovery mode) ubunt 8.04.1, MeMtest86+ 2,選擇第二行"ubunt 8.04.1, kernel 2.6.24-19-generic (recovery mode)",按“Enter”進入Recovery Menu: resume resume normal boot dpkg repair broken packages root drop to root shell prompt xfix try to fix x server 3,選擇"root drop to root shell prompt",按“Enter” 接著就提示: root@QA-desktop:~# 於是可以使用passwd生成新密碼了. root@QA-desktop:~# passwd root Enter new password: Retype new password: passwd: password updated successfully root@QA-desktop:~# 然後reboot就生效了。
Copyright © Linux教程網 All Rights Reserved