vagrant java build

I stopped studying ruby that I continued from March 2019, and now I am touching java using technical books. Recently, I bought a used 10-tab arrows f-03g for e-books, and my studies are progressing. I prepared a new virtual environment for java, so as a memo. It's almost the same as ruby.

Local environment

--Host OS: Windows10 (* Windows Insider Program) --Editor: VSCode --Mounted RAM: 16GB

What you want to prepare

--Preparation for virtualbox and vagrant is omitted --Virtual environment OS: Ubuntu (* bento / ubuntu-18.04) --Use VSCode remote function See here --javas: openJDK11 --Other: git

Actual content

As mentioned earlier, the preparation of virtualbox and vagrant itself is omitted.

terminal


#Creating a vagrantfile
vagrant init

vagrantfile.rb


#Most of the comment out part is omitted
Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-18.04"

  # vagrant name
  #Already a virtual environment"default"There is one, so rename it appropriately
  config.vm.define "JvUbuntu"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.provider "virtualbox" do |vb|
    # Customize the amount of memory on the VM:
    #According to your PC etc.
    vb.memory = "8192"
  end
  
  #If you want to automate the environment construction, you should play with the bottom.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

Launching a virtual environment

terminal


vagrant up

Preparing VSCode remote

Prepare the necessary extensions

Confirmation of ssh login information

terminal


vagrant ssh-config

###This is coming out
Host JvUbuntu
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile C:/Users/Yudai/vm/MyVagrant/JvUbuntu/.vagrant/machines/JvUbuntu/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

SSH Configuration file edit, connect

  1. On VSCode, open View> Command Palette> Remote-SSH: Open Configuration File and copy and paste the above ssh login information.
  2. Also in the command palette, open Jv Ubuntu with Connect to Host

Java, git preparation

In ssh


sudo apt update
sudo apt install git
sudo apt install openjdk-11-jdk

#Confirmation
java --version

Hello world

# hello.java creation
nano hello.java

code

hello.java


public class hello{
  public static void main(String[] args){
    System.out.println("Hello Java World!!");
  }
}

terminal


#compile
javac hello.java
# => hello.class creation

#Run
java hello
# => Hello Java World!!

DBs

Prepare PostgreSQL this time

postgresql

terminal


# install
sudo apt install postgresql

#Create admin
sudo -u postgres createuser admin -s

#Log in to postgresql with admin
sudo -u postgres psql

postgresql


#Set password for admin user
\password admin

#Quit from PostgreSQL
\q

end.

Recommended Posts

vagrant java build
java build a triangle
First gradle build (Java)
Build Java with Wercker
Java
Java
Build a Java project with Gradle
Java build with mac vs code
Build Java development environment (for Mac)
Build Virtual Box & Vagrant & Centos7 & GitLab
Build Virtual Box & Vagrant & Centos7 & Artifactory
GraalVM for Java Performance (Windows Developer Build)
Java learning (0)
Studying Java ―― 3
[Java] array
[Java] Annotation
[Java] Module
Java array
Java tips, tips
Java methods
Java method
java (constructor)
Java array
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
java (array)
Java static
Java serialization
java beginner 4
JAVA paid
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
java reflexes
java (interface)
Java memorandum
☾ Java / Collection
Java array
Studying Java ―― 1
[Java] Array
[Java] Polymorphism
Studying Java # 0
Java review
java framework
Java features
[Java] Inheritance
FastScanner Java
Java features
java beginner 3
CICS-Run Java applications-(3) Build management with Gradle
Java memo
java (encapsulation)
Java inheritance
[Java] Overload
Java basics
Decompile Java
[Java] Annotation