LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

ゼロから始めるITエンジニアリング入門(環境構築編)

Last updated at Posted at 2017-10-16

本日学ぶこと

・VirtualBoxのインストール
・Vagrantのインストール
・Ubuntuのインストール
・Ubuntuに接続
・Ubuntuの日本語化
・Linuxコマンドでファイル操作等

VirtualBox

VirtualBox

Vagrant

スクリーンショット 2017-10-16 17.50.10.png

VirtualBoxのインストール

https://www.virtualbox.org/

Vagrantのインストール

https://www.vagrantup.com/downloads.html

コマンドプロンプトorターミナルの起動

Windowsの場合

・Windows 7
Windows キーを押してスタートメニューを開き、 「プログラムとファイルの検索」欄で「cmd」と入力すると「cmd.exe」か「コマンドプロンプト」が検索結果に表示される。それを右クリックし、出てきたメニューから「管理者として実行」を選択

・Windows 8 / 10
Windows キーを押してスタートメニューを開き、何もクリックせずに「cmd」と入力すると検索欄が表示されます。そこに「cmd.exe」か「コマンドプロンプト」が検索結果に表示される。それを右クリックし、出てきたメニューから「管理者として実行」を選択

Macの場合

Finder の左メニューの「アプリケーション」から、 「ユーティリティ」フォルダ内の「ターミナル.app」
をダブルクリック

Ubuntuをインストールするための準備

Windowsの場合

mkdir \vagrant\ubuntu
cd \vagrant\ubuntu

Macの場合

mkdir -p ~/vagrant/ubuntu
cd  ~/vagrant/ubuntu

Ubuntuのインストール

vagrant box add ubuntu/xenial64
vagrant init ubuntu/xenial64

Vagrantの起動

vagrant up

SSH接続の準備

Windowsの場合

SSHクライアント「rLogin」をインストール
http://nanno.dip.jp/softlib/man/rlogin/

インストールした RLogin を起動して、「新規」を選択し、以下のように設定

• エントリーには、vagrant
• プロトコルは、ssh
• Server Adress は、localhost
• Socket Portは、2222
• User Name は、 ubuntu
• SSH Identity Key は、%USERPROFILE\vagrant\ubuntu\.vagrant\machines\default\virtualbox\private_key(※Ubuntuをインストールしたフォルダ配下になります)
• デフォルト文字セットは、UTF-8を選択

Macの場合

cd ~/vagrant/ubuntu/
vagrant ssh

Ubuntuの日本語化

sudo locale-gen ja_JP.UTF-8
echo export LANG=ja_JP.UTF-8 >> ~/.profile
source ~/.profile
date

最新版にアップデート

sudo apt-get update

ローカルとのファイル共有場所

/vagrant

ログイン後
cd /vagrant/

簡単なLinuxコマンド

・ディレクトリ作成
mkdir フォルダ名
・ファイルの作成
touch ファイル名
・ディレクトリを移動
cd フォルダ名

参考:http://www.k4.dion.ne.jp/~mms/unix/linux_com/

Vagrantの終了

vagrant halt

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