LoginSignup
2
2

More than 5 years have passed since last update.

virtualbox + ubuntu tips

Posted at

windowsにvirtualbox + ubuntuの環境を構築したときに
使いやすくするためのメモ

環境


  • VirtualBox 4.3
  • ubuntu 14.04

ubuntuへwindowsからターミナルで接続したい


virtualbox上のubuntuのターミナルで操作しても問題はないのですが、
使い慣れたターミナルを利用したいというときに。

1.ubuntuのSSHサーバをインストールする

$ sudo apt-get install openssh-server

2.設定ファイルの編集

$ sudo vi /etc/ssh/sshd_config

---変更箇所---
PermitRootLogin no
---変更箇所---

---変更箇所---
PasswordAuthentication yes
---変更箇所---

3.sshサーバ再起動

$ sudo /etc/init.d/ssh restart

4.確認

$ sudo lsof -nPi:22
---例---
sshd    10283  root    3u  IPv4  49690       TCP *:22 (LISTEN)
---例---

5.ubuntuを一度終了し、以下を実施

  1. VirtualBoxマネージャを開く
  2. 「設定」→「ネットワーク」→「アダプタ1」→「高度」を選択
  3. 「ポートフォワーディング」を選び、「+」を押下し、以下のように入力しOKを押す
 ホストポート:2222(任意の数値)
 ゲストポート:22

6.ubuntuを起動し、poderosa等で接続してみる

  1. ホスト名「localhost」、プロトコル「SSH2」、ポート「2222(先ほど設定した値)」、アカウント(作成したアカウント)、認証方法(任意)、パスフレーズ(任意)を設定する
  2. ログインする

vimインストール

$ sudo apt-get install vim
$ vim .bashrc
alias vi='vim'
$ source .bashrc

bashプロンプト表示切替

$ cd ~/
$ vim .bashrc
※最終行辺りに
---
PS1='[\u@\H \W]\$ '
---
$ source .bashrc
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2