vagrant version
vagrant plugin install vagrant-scp
작업 디렉토리 생성 및 Vagrant 설정 파일 생성
mkdir C:\Users\multicampus\be-ethereum
cd C:\Users\multicampus\be-ethereum
vagrant init
Vagrantfile 수정
VAGRANT_API_VERSION = "2"
vms = {
'eth0' => '10',
'eth1' => '11'
}
Vagrant.configure(VAGRANT_API_VERSION) do |config|
config.vm.box = "ubuntu/bionic64"
vms.each do |key, value|
config.vm.define "#{key}" do |node|
node.vm.network "private_network", ip: "192.168.50.#{value}"
if "#{key}" == "eth0"
node.vm.network "forwarded_port", guest: 8545, host: 8545
end
node.vm.hostname = "#{key}"
node.vm.provider "virtualbox" do |nodev|
nodev.memory = 2048
end
end
end
end
가상 머신 구동 명령어 실행
vagrant up
가상 머신 구동 상태 확인
vagrant status
가상 머신 접속
vagrant ssh [eth0 / eth1]
// eth0 가상머신과 eth1 가상머신에서 각각 수행
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get install ethereum
// 설치 확인
geth version
mkdir -p dev/eth_localdata
cd dev/eth_localdata
vi CustomGenesis.json
{
"config": {
"chainId": 921,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "0x10",
"coinbase": "0x0000000000000000000000000000000000000000",
"gasLimit": "9999999",
"alloc": {},
"extraData": "",
"nonce": "0xdeadbeefdeadbeef",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}
geth --networkid 921 --maxpeers 2 --datadir ~/dev/eth_localdata --allow-insecure-unlock --port 30303 --rpc --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcapi "admin,net,miner,eth,rpc,web3,txpool,debug,personal" --miner.threads 1
geth attach http://0.0.0.0:8545
geth --networkid 921 --maxpeers 2 --datadir ~/dev/eth_localdata --allow-insecure-unlock --port 30303 --rpc --rpcport 8545 --rpcaddr localhost --rpccorsdomain "\*" --miner.threads 1
geth attach http://localhost:8545