Notes on preparing multiple virtual environments with Vagrant
・ VirtualBox installed ・ Cyberduck installed
In the Home> MyVagrant folder, ・ MyCentOS ・ MyprojectA Create a folder called, and build a server for each. This time, MyCentOS is supposed to be the original one, and a folder called MyprojectA is created. After creating the MyprojectA folder, execute the following command there.
Create a Vagrantfile for virtual machine settings
vagrant init bento/centos-6.8
Edit the Vagrantfile to set the virtual machine IP address to 192.168.33.11.
sed -i '' -e 's/# config.vm.network "private_network", ip: "192.168.33.11"/config.vm.network "private_network", ip: "192.168.33.11"/' Vagrantfile
vagrant reload
(If you get an error, it may be the IP address setting. Rewrite the IP on the following line in Vagrantfile in the .vagrant folder.)
config.vm.network "private_network", ip: "192.168.33.11"
(If you get an error due to multiple environments, install the plugin at this timing)
vagrant plugin install vagrant-vbguest
Start a virtual machine (VirtualBox runs behind the scenes)
vagrant up
Check the status of the virtual machine
vagrant status
Log in to the virtual machine and check the IP address
vagrant ssh
ip a
Update OS to the latest state (it takes time)
sudo yum -y update
Install git to get the script
sudo yum -y install git
Download the script for application settings using git
git clone https://github.com/dotinstallres/centos6.git
A centos6 folder will be created, so move to that
cd centos6
Run the script (it takes time)
./run.sh
Reflect various settings
exec $SHELL -l
Start Cyberduck, click New Connection, set the following and connect. -Protocol: SFTP -Server: 192.168.33.11 ・ Username: vagrant ・ Password: vagrant After starting, register in bookmark (MyprojectA)
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Recommended Posts