在VirtualBox安裝Ubuntu server的一些備忘

強烈建議:備份一個參照的系統(tǒng)作為參考,網(wǎng)速允許的話,第一項也可以放到后面做。

1、配置源

編輯源列表文件

~$ sudo vim /etc/apt/sources.list

2、安裝虛擬機工具(Tools)

  • 首先需要安裝下DKMS
  • Vbox軟件菜單里面選擇安裝附加工具
  • 在虛擬系統(tǒng)里面掛載chrom,用超級用戶安裝vbox addtions即可

3、配置fstab

編輯fstab文件:

~$ sudo vim /etc/fstab

在里面加入:

share /home/user/share vboxsf defaults,uid=1000,gid=1000,dmask=022,fmask=133     0    0

重啟虛擬機,記得在數(shù)據(jù)共享空間中加入share文件夾。
14.04新問題:由于fstab啟動先于vboxsf模塊,導致每次啟動都掛接不上,因此使用以下方法,在系統(tǒng)啟動時執(zhí)行掛接腳本。編輯rc.local文件:

~$ vi /etc/rc.d/rc.local

在其最后加入掛載的命令,比如:

~$ sudo mount -t vboxsf -o defaults,uid=1000,gid=1000,dmask=022,fmask=133 share /home/user/share/

如果在fstab中加入了VBOX共享文件夾的掛載,可以在其中加入noauto,完后rc.local中的語句就更簡單。

4、復制配置文件

~$ sudo cp   share/molokai.vim    /usr/share/vim/vim73/colors/
~$ cp   share/.vimrc   .vimrc
~$ sudo cp   share/fortran.vim   /usr/share/vim/vim73/syntax/

5、配置ssh

~$ sudo  vim /etc/ssh/sshd_config

進行如下更改:

禁止根用戶登錄:PermitRootLogin no
注釋掉:RSAAuthentication yes
禁止空密碼:PermitEmptyPasswords no
禁止密碼登錄:PasswordAuthentication no
X11Forwarding no
中文的支持:AcceptEnv LANG LC_* 修改為 AcceptEnv LANG * 和 AcceptEnv LANGUAGE * 兩行
UsePAM no

復制已有的密鑰:

~$ cp ~/.ssh/authorized_keys

5.1、OpenSSH 生成Key

~$ ssh -keygencd ~/.sshmv id_rsa.pub authorized_keys

6、其它一些記錄

6.1加入第二塊網(wǎng)卡

編輯網(wǎng)絡(luò)配置文件:

~$ sudo vim /etc/network/interfaces

6.2、VirtualBox piix4_smbus Error

VirtualBox 3.2.10 gives me the following error message when booting Ubuntu 10.10: -piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddrThis error is caused by VM having no smbus but Ubuntu always trying to load the module.It doesn't affect anything but is a bit annoying – to fix:

  • Check module is being loaded: ~$ lsmod | grep i2c_piix42。
  • If so, blacklist it in/etc/modprobe.d/blacklist.conf, by adding the following to the end of the file :blacklist i2c_piix4

6.3、disable ipv6

  1. edit grub file use sudo vim /etc/default/grub, and replace
    GRUB_CMDLINE_LINUX_DEFAULT="quiet"
    with
    GRUB_CMDLINE_LINUX_DEFAULT="quiet ipv6.disable=1"
  2. update
~$ sudo update-grub

6.4、Kernal

1.列出所有安裝的內(nèi)核

~$ dpkg --get-selections|grep linux

2.查看當前系統(tǒng)使用的內(nèi)核。

~$ uname -a

3.刪除舊內(nèi)核的時候 刪除headers和image項,最后要記得更新grub

~$ sudo update-grub

也可用下面命令全部刪除

sudo aptitude purge ~ilinux-image-.*\(\!`uname -r`\)

6.5、Time Skew

在Ubuntu下修改/etc/default/rcS 文件,將 UTC=yes改為 UTC=no即可。

6.6、清除殘留配置文件

~$ dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

6.7、關(guān)于vbox新建虛擬機運行虛擬硬盤中原有系統(tǒng)出現(xiàn)無法發(fā)現(xiàn)網(wǎng)絡(luò)設(shè)備的解決措施

主要原因是新建虛擬機的虛擬網(wǎng)絡(luò)設(shè)備與舊的不一致導致的,解決辦法是刪除(改名)下面文件。

~$ sudo mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.old
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容