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.
--Host OS: Windows10 (* Windows Insider Program) --Editor: VSCode --Mounted RAM: 16GB
--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
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
Prepare the necessary extensions
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
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
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!!
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