vagrant로 로컬 개발 환경 만들기
3738 단어 teratermcentos7VirtualBoxVagrant
로컬 개발 환경을 만들고 싶습니다.
자사 FW로 개발 환경은 있지만, 장래를 향한 개발 환경을 시험할 필요가 있기 때문에 처음부터 검증할 수 있는 환경을 만든다
우선 teraterm으로 로그인하는 곳까지.
전제
Vagrant + VirtualBox
Docker 사용하고 싶지만, 개발은 VirtualBox.
Hyper-V 관계의 거동으로 공존을 할 수 없기 때문에, Vagrant + VirtualBox는 그대로 사용
우선 centOS7 환경 준비
vagrant 초기 설정
박스 만들기
디렉토리가 없었기 때문에 작성
mkdir vagrant
cd vagrant
init하면 화난
C:\Users\xxx\vagrant>vagrant init centos/7
==> vagrant: A new version of Vagrant is available: 2.2.5 (installed version: 2.2.4)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.
Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.
Path: C:/Users/xxx/.vagrant.d/data/machine-index/index
machine-index가 깨졌기 때문에 수동으로 나오시테. 적인.
대상 파일을 bkup하고 비우고 다시 시도하십시오.
vagrant up하다
마음대로 설치해 준다(편리)
C:\Users\xxxx\vagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos/7' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'centos/7'
...
자동으로 VirtualBox에 등록됨
등록 상태 확인
vagrant box list로 등록된 BOX를 확인할 수 있다
C:\Users\xxxx\vagrant>vagrant box list
centos/7 (virtualbox, 1905.1)
localXXXX (virtualbox, 0)
localXXXX2 (virtualbox, 0)
ssh 연결해보기
C:\Users\xxxx\vagrant>vagrant ssh
Last login: Mon Sep 30 13:07:50 2019 from 10.0.2.2
[vagrant@localhost ~]$ cd /var/
[vagrant@localhost var]$ dir
adm cache db empty games gopher kerberos lib local lock log mail nis opt preserve run spool tmp yp
teraterm에서 연결할 수 있기를 원합니다.
IP나 머신 이름 변경
/vagrant/Vagrantfile 편집
# Create a private network, which allows host-only access to the machine
# using a specific IP.
#config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "private_network", ip: "192.168.33.11"
centOS에서 비밀번호 인증 허용
[root@cent7 ~]# su - //passはvagrant
[root@cent7 ~]# vi /etc/ssh/sshd_config
sshd_config
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
teraterm에서 로그인 해보기
ID:root pass:vagrant
Last login: Mon Sep 30 13:35:22 2019
[root@cent7 ~]#
무사히 로그인할 수 있었다.
Reference
이 문제에 관하여(vagrant로 로컬 개발 환경 만들기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/sota/items/6a3f5b897220d3542acb
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
mkdir vagrant
cd vagrant
C:\Users\xxx\vagrant>vagrant init centos/7
==> vagrant: A new version of Vagrant is available: 2.2.5 (installed version: 2.2.4)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.
Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.
Path: C:/Users/xxx/.vagrant.d/data/machine-index/index
C:\Users\xxxx\vagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos/7' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'centos/7'
...
C:\Users\xxxx\vagrant>vagrant box list
centos/7 (virtualbox, 1905.1)
localXXXX (virtualbox, 0)
localXXXX2 (virtualbox, 0)
C:\Users\xxxx\vagrant>vagrant ssh
Last login: Mon Sep 30 13:07:50 2019 from 10.0.2.2
[vagrant@localhost ~]$ cd /var/
[vagrant@localhost var]$ dir
adm cache db empty games gopher kerberos lib local lock log mail nis opt preserve run spool tmp yp
# Create a private network, which allows host-only access to the machine
# using a specific IP.
#config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "private_network", ip: "192.168.33.11"
[root@cent7 ~]# su - //passはvagrant
[root@cent7 ~]# vi /etc/ssh/sshd_config
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
Last login: Mon Sep 30 13:35:22 2019
[root@cent7 ~]#
Reference
이 문제에 관하여(vagrant로 로컬 개발 환경 만들기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/sota/items/6a3f5b897220d3542acb텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)