うすのブログ

初心者プログラマです。

Vagrant × Atom

Vagrantの仮装環境でAtomでコーディング

ディストリビューションDebian系ならば

$ sudo apt install netatalk

AFS(netatalk)をインストールして使用すれば 非常に便利にコーディングできるし扱いやすい

最近RedHat系のCentOS7をVagrantで構築した。

# yum install netatalk

でインストールできない... Google先生もなかなか答えを教えてくれない。

AtomFTPプラグイン

 たどり着いた先は、ここでした。 非常に良い記事が見つかって、Atomプラグイン 「remote-ftp」というのをインストールする。 FTPの設定は、 Atomのタグの「Package」を選択 「Remote FTP」を選択 「Create SFTP config file」

{
    "protocol": "sftp",
    "host": "127.0.0.1",
    "port": 2222,
    "user": "vagrant",
    "pass": "",
    "promptForPass": false,
    "remote": "/home/vagrant/[file_name]",
    "local": "",
    "agent": "",
    "privatekey": "/Users/[user_name]/Vagrant/CentOS/.vagrant/machines/default/virtualbox/private_key",
    "passphrase": "",
    "hosthash": "",
    "ignorehost": true,
    "connTimeout": 10000,
    "keepalive": 10000,
    "keyboardInteractive": false,
    "keyboardInteractiveForPass": false,
    "remoteCommand": "",
    "remoteShell": "",
    "watch": [],
    "watchTimeout": 500
}

[file_name]は、ホームフォルダの下に参照したいファイルをあらかじめ作成しておいて その場所を作業ディレクトリにする [user_name]は、メイン機器側のuser_name

コーディングの流れ

Vagrantを立ち上げる。 Atomを開いてSMTPの設定を行う。 実際にAtomでコーディングする。 コンパイルデバッグ、実行は、ターミナルでVagrantにログインして行う。

-- 参考 -- vagrantで立ち上げた仮想マシンのファイルをAtomで編集する