Vagrantfile 설정
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Prometheus & Grafana monitoring
Vagrant.configure("2") do |config|
config.vm.define "Prometheus_Grafana" do |cfg|
cfg.vm.box = "alvistack/ubuntu-22.04"
cfg.vm.provider "virtualbox" do |vb|
vb.name = "ProGra_SVR(Prometheus_Grafana)"
vb.cpus = 2
vb.memory = 2048
vb.customize ["modifyvm", :id, "--groups", "/ProGra(Prometheus_Grafana)"]
end
cfg.vm.host_name = "ProGra-SVR"
cfg.vm.network "private_network", ip: "192.168.56.125"
cfg.vm.synced_folder "../data", "/vagrant", disabled: true
cfg.vm.provision "shell", path: "config.sh"
end
end
# vagrant 파일 설명
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Prometheus & Grafana monitoring
Vagrant.configure("2") do |config|
config.vm.define "Prometheus_Grafana" do |cfg| # vagrant global-status 에서 나오는 명칭
cfg.vm.box = "alvistack/ubuntu-22.04" # vagrant 사이트에 검색해서 설치화려는 Vagrant VM box 설치명
cfg.vm.provider "virtualbox" do |vb|
vb.name = "ProGra_SVR(Prometheus_Grafana)" # Oracle VM에 설치되는 가성 서버 이름
vb.cpus = 2 # Oralce VM에 설정되는 CPU Core 수
vb.memory = 2048 # Oralce VM에 설정되는 memory 수(값)
vb.customize ["modifyvm", :id, "--groups", "/ProGra(Prometheus_Grafana)"] # Oralce VM에 설정되는 가성 서버 그룹 이름
※ 그룹이름 설정시 앞에 / 표시를 꼭 해야 됨 (안하면 에러남)
end # cfg.vm.provider "virtualbox" do |vb| do|vb|를 닫는다
cfg.vm.host_name = "ProGra-SVR" # 가상 서버 호스트 명
cfg.vm.network "private_network", ip: "192.168.56.125" # 가상 서버 ip
cfg.vm.synced_folder "../data", "/vagrant", disabled: true
cfg.vm.provision "shell", path: "config.sh" # 가상 서버 설치시 사용되는 추가 파일
end # config.vm.define "Prometheus_Grafana" do |cfg| do|cfg|를 닫는다
end # Vagrant.configure("2") do |config| #do |config|를 닫는다
# config.sh (Vagrant 파일과 같은 폴더에 설치하면 됨)
C:\Users\shim>type config.sh
# config.sh
# 수동 시간 맞추기
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
# centOS 8에서 필요한 내용 (YUM 레포사이트 주소변경)
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# net-tools 설치
yum install net-tools -y
# yum-utils 설치
yum install yum-utils -y
# dnf 설치
yum install dnf -y
# docker compose 설치
dnf install python3 python3-pip -y
pip3 install docker-compose
# docker repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# config DNS
cat <<EOF > /etc/resolv.conf
nameserver 1.1.1.1 #cloudflare DNS
nameserver 8.8.8.8 #Google DNS
EOF
# 기타 설명
# https://app.vagrantup.com/boxes/search 기본 설정
Vagrant.configure("2") do |config|
config.vm.define "ubuntu/trusty64"
config.vm.box = "ubuntu/trusty64"
end
# config.vm.define 설정을 안해주면 기본적으로 vagrant global-status 했을때 default로 나옴
C:\Users\shim>vagrant global-status
id name provider state directory
-----------------------------------------------------------------------------
73ef706 default virtualbox running C:/Users/shim
73ef706 ubuntu/trusty64 virtualbox running C:/Users/shim
# 설치 로그
C:\Users\shim>vagrant up
Bringing machine 'Prometheus_Grafana' up with 'virtualbox' provider...
==> Prometheus_Grafana: Importing base box 'alvistack/ubuntu-22.04'...
==> Prometheus_Grafana: Matching MAC address for NAT networking...
==> Prometheus_Grafana: Checking if box 'alvistack/ubuntu-22.04' version '20240120.1.1' is up to date...
==> Prometheus_Grafana: A newer version of the box 'alvistack/ubuntu-22.04' for provider 'virtualbox' is
==> Prometheus_Grafana: available! You currently have version '20240120.1.1'. The latest is version
==> Prometheus_Grafana: '20240202.1.1'. Run `vagrant box update` to update.
==> Prometheus_Grafana: Setting the name of the VM: ProGra_SVR(Prometheus_Grafana)
==> Prometheus_Grafana: Clearing any previously set network interfaces...
==> Prometheus_Grafana: Preparing network interfaces based on configuration...
Prometheus_Grafana: Adapter 1: nat
Prometheus_Grafana: Adapter 2: hostonly
==> Prometheus_Grafana: Forwarding ports...
Prometheus_Grafana: 22 (guest) => 2222 (host) (adapter 1)
==> Prometheus_Grafana: Running 'pre-boot' VM customizations...
==> Prometheus_Grafana: Booting VM...
==> Prometheus_Grafana: Waiting for machine to boot. This may take a few minutes...
Prometheus_Grafana: SSH address: 127.0.0.1:2222
Prometheus_Grafana: SSH username: vagrant
Prometheus_Grafana: SSH auth method: private key
Prometheus_Grafana: Warning: Connection reset. Retrying...
Prometheus_Grafana: Warning: Connection aborted. Retrying...
Prometheus_Grafana:
Prometheus_Grafana: Vagrant insecure key detected. Vagrant will automatically replace
Prometheus_Grafana: this with a newly generated keypair for better security.
Prometheus_Grafana:
Prometheus_Grafana: Inserting generated public key within guest...
Prometheus_Grafana: Removing insecure key from the guest if it's present...
Prometheus_Grafana: Key inserted! Disconnecting and reconnecting using new SSH key...
==> Prometheus_Grafana: Machine booted and ready!
==> Prometheus_Grafana: Checking for guest additions in VM...
Prometheus_Grafana: The guest additions on this VM do not match the installed version of
Prometheus_Grafana: VirtualBox! In most cases this is fine, but in rare cases it can
Prometheus_Grafana: prevent things such as shared folders from working properly. If you see
Prometheus_Grafana: shared folder errors, please make sure the guest additions within the
Prometheus_Grafana: virtual machine match the version of VirtualBox you have installed on
Prometheus_Grafana: your host and reload your VM.
Prometheus_Grafana:
Prometheus_Grafana: Guest Additions Version: 6.0.0 r127566
Prometheus_Grafana: VirtualBox Version: 7.0
==> Prometheus_Grafana: Setting hostname...
==> Prometheus_Grafana: Configuring and enabling network interfaces...
==> Prometheus_Grafana: Running provisioner: shell...
Prometheus_Grafana: Running: C:/Users/shim/AppData/Local/Temp/vagrant-shell20240204-16936-1upqxy3.sh
C:\Users\shim>
'vagrant' 카테고리의 다른 글
Vagrant로 가상머신 설치(추가설치) 하기 (1) | 2024.01.28 |
---|