$ cat /etc/os-release
$ lsb_release -a
$ uname -a
$ sudo apt update
$ sudo apt list --upgradable
$ sudo apt upgrade -y
webrx@us:~$ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.3 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal webrx@us:~$ sudo apt update [sudo] password for webrx: Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease Get:2 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [114 kB] Get:3 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [101 kB] Get:4 http://mirrors.aliyun.com/ubuntu focal-security InRelease [114 kB] Get:5 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages [1,258 kB] Hit:6 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease Get:7 http://mirrors.aliyun.com/ubuntu focal-updates/main Translation-en [265 kB] Get:8 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 c-n-f Metadata [14.4 kB] Get:9 http://mirrors.aliyun.com/ubuntu focal-updates/restricted amd64 Packages [486 kB] Get:10 http://mirrors.aliyun.com/ubuntu focal-updates/restricted Translation-en [69.6 kB] Get:11 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages [865 kB] Get:12 http://mirrors.aliyun.com/ubuntu focal-updates/universe Translation-en [185 kB] Get:13 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [19.2 kB] Get:14 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages [909 kB] Get:15 http://mirrors.aliyun.com/ubuntu focal-security/main Translation-en [173 kB] Get:16 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 c-n-f Metadata [8,820 B] Get:17 http://mirrors.aliyun.com/ubuntu focal-security/restricted amd64 Packages [447 kB] Get:18 http://mirrors.aliyun.com/ubuntu focal-security/restricted Translation-en [64.1 kB] Get:19 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 Packages [643 kB] Get:20 http://mirrors.aliyun.com/ubuntu focal-security/universe Translation-en [103 kB] Get:21 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 c-n-f Metadata [12.5 kB] Fetched 5,851 kB in 12s (470 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 11 packages can be upgraded. Run 'apt list --upgradable' to see them. webrx@us:~$ sudo apt list --upgradable Listing... Done distro-info-data/focal-updates,focal-security 0.43ubuntu1.8 all [upgradable from: 0.43ubuntu1.6] libpam-modules-bin/focal-updates 1.3.1-5ubuntu4.3 amd64 [upgradable from: 1.3.1-5ubuntu4.2] libpam-modules/focal-updates 1.3.1-5ubuntu4.3 amd64 [upgradable from: 1.3.1-5ubuntu4.2] libpam-runtime/focal-updates 1.3.1-5ubuntu4.3 all [upgradable from: 1.3.1-5ubuntu4.2] libpam0g/focal-updates 1.3.1-5ubuntu4.3 amd64 [upgradable from: 1.3.1-5ubuntu4.2] libpython3.8-minimal/focal-updates,focal-security 3.8.10-0ubuntu1~20.04.1 amd64 [upgradable from: 3.8.10-0ubuntu1~20.04] libpython3.8-stdlib/focal-updates,focal-security 3.8.10-0ubuntu1~20.04.1 amd64 [upgradable from: 3.8.10-0ubuntu1~20.04] libpython3.8/focal-updates,focal-security 3.8.10-0ubuntu1~20.04.1 amd64 [upgradable from: 3.8.10-0ubuntu1~20.04] python3.8-minimal/focal-updates,focal-security 3.8.10-0ubuntu1~20.04.1 amd64 [upgradable from: 3.8.10-0ubuntu1~20.04] python3.8/focal-updates,focal-security 3.8.10-0ubuntu1~20.04.1 amd64 [upgradable from: 3.8.10-0ubuntu1~20.04] tzdata/focal-updates,focal-security 2021a-2ubuntu0.20.04 all [upgradable from: 2021a-0ubuntu0.20.04] webrx@us:~$ sudo apt upgrade -y Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: distro-info-data libpam-modules libpam-modules-bin libpam-runtime libpam0g libpython3.8 libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal tzdata 11 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 7 standard security updates Need to get 6,999 kB of archives. After this operation, 2,048 B of additional disk space will be used. Get:1 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpam0g amd64 1.3.1-5ubuntu4.3 [55.4 kB] Get:2 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpam-modules-bin amd64 1.3.1-5ubuntu4.3 [41.2 kB] Get:3 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpam-modules amd64 1.3.1-5ubuntu4.3 [260 kB] Get:4 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpython3.8 amd64 3.8.10-0ubuntu1~20.04.1 [1,625 kB] Get:5 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 python3.8 amd64 3.8.10-0ubuntu1~20.04.1 [387 kB] Get:6 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04.1 [1,674 kB] Get:7 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 python3.8-minimal amd64 3.8.10-0ubuntu1~20.04.1 [1,900 kB] Get:8 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04.1 [717 kB] Get:9 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 libpam-runtime all 1.3.1-5ubuntu4.3 [37.3 kB] Get:10 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 distro-info-data all 0.43ubuntu1.8 [4,664 B] Get:11 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 tzdata all 2021a-2ubuntu0.20.04 [297 kB] Fetched 6,999 kB in 13s (550 kB/s) Preconfiguring packages ... (Reading database ... 76022 files and directories currently installed.) Preparing to unpack .../libpam0g_1.3.1-5ubuntu4.3_amd64.deb ... Unpacking libpam0g:amd64 (1.3.1-5ubuntu4.3) over (1.3.1-5ubuntu4.2) ... Setting up libpam0g:amd64 (1.3.1-5ubuntu4.3) ... (Reading database ... 76022 files and directories currently installed.) Preparing to unpack .../libpam-modules-bin_1.3.1-5ubuntu4.3_amd64.deb ... Unpacking libpam-modules-bin (1.3.1-5ubuntu4.3) over (1.3.1-5ubuntu4.2) ... Setting up libpam-modules-bin (1.3.1-5ubuntu4.3) ... (Reading database ... 76022 files and directories currently installed.) Preparing to unpack .../libpam-modules_1.3.1-5ubuntu4.3_amd64.deb ... Unpacking libpam-modules:amd64 (1.3.1-5ubuntu4.3) over (1.3.1-5ubuntu4.2) ... Setting up libpam-modules:amd64 (1.3.1-5ubuntu4.3) ... (Reading database ... 76022 files and directories currently installed.) Preparing to unpack .../0-libpython3.8_3.8.10-0ubuntu1~20.04.1_amd64.deb ... Unpacking libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.1) over (3.8.10-0ubuntu1~20.04) ... Preparing to unpack .../1-python3.8_3.8.10-0ubuntu1~20.04.1_amd64.deb ... Unpacking python3.8 (3.8.10-0ubuntu1~20.04.1) over (3.8.10-0ubuntu1~20.04) ... Preparing to unpack .../2-libpython3.8-stdlib_3.8.10-0ubuntu1~20.04.1_amd64.deb ... Unpacking libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.1) over (3.8.10-0ubuntu1~20.04) ... Preparing to unpack .../3-python3.8-minimal_3.8.10-0ubuntu1~20.04.1_amd64.deb ... Unpacking python3.8-minimal (3.8.10-0ubuntu1~20.04.1) over (3.8.10-0ubuntu1~20.04) ... Preparing to unpack .../4-libpython3.8-minimal_3.8.10-0ubuntu1~20.04.1_amd64.deb ... Unpacking libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.1) over (3.8.10-0ubuntu1~20.04) ... Preparing to unpack .../5-libpam-runtime_1.3.1-5ubuntu4.3_all.deb ... Unpacking libpam-runtime (1.3.1-5ubuntu4.3) over (1.3.1-5ubuntu4.2) ... Setting up libpam-runtime (1.3.1-5ubuntu4.3) ... (Reading database ... 76022 files and directories currently installed.) Preparing to unpack .../distro-info-data_0.43ubuntu1.8_all.deb ... Unpacking distro-info-data (0.43ubuntu1.8) over (0.43ubuntu1.6) ... Preparing to unpack .../tzdata_2021a-2ubuntu0.20.04_all.deb ... Unpacking tzdata (2021a-2ubuntu0.20.04) over (2021a-0ubuntu0.20.04) ... Setting up libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.1) ... Setting up distro-info-data (0.43ubuntu1.8) ... Setting up tzdata (2021a-2ubuntu0.20.04) ... Current default time zone: 'Etc/UTC' Local time is now: Sat Oct 9 11:50:18 UTC 2021. Universal Time is now: Sat Oct 9 11:50:18 UTC 2021. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up python3.8-minimal (3.8.10-0ubuntu1~20.04.1) ... Setting up libpython3.8-stdlib:amd64 (3.8.10-0ubuntu1~20.04.1) ... Setting up python3.8 (3.8.10-0ubuntu1~20.04.1) ... Setting up libpython3.8:amd64 (3.8.10-0ubuntu1~20.04.1) ... Processing triggers for libc-bin (2.31-0ubuntu9.2) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for mime-support (3.64ubuntu1) ... webrx@us:~$
linux 系统下,使用wget下载
$ wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
$ sudo vim /etc/profile
webrx@us:~$ cat /etc/profile # /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). if [ "${PS1-}" ]; then if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then # The file bash.bashrc already sets the default PS1. # PS1='\h:\w\$ ' if [ -f /etc/bash.bashrc ]; then . /etc/bash.bashrc fi else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi fi if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi export JAVA_HOME=/usr/local/jdk-17 export CLASSPATH=.:$JAVA_HOME/lib export PATH=.:$JAVA_HOME/bin:$JAVA_HOME/lib:$PATH webrx@us:~$
Demo.java public class Demo{ public static void main(String[] args){ System.out.println("Hello World"); System.out.println(System.getProperty("java.version")); System.out.println(System.getProperty("java.home")); System.out.println(System.getProperty("os.name")); } }