Ubuntu18 配置全局JDK環境
# 1 配置/etc/profile 配置全局JDK環境變量
# 1.1 使用 vim 編輯 /etc/profile
vim /etc/profile
# 1.2 使用 Ubuntu18 自帶文本編輯器編輯 /etc/profile
gedit /etc/profile
# 1.3 在 /etc/profile 最後添加
#java environment
export JAVA_HOME=/home/ubuntu/software/java/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
# 2 保存退出
source /etc/profile
# 3 使用命令檢查是否安裝成功
java -version
javac -version
# 4 如果能看到輸出信息,說明按轉配置jdk成功
# 5 如果切換root用戶後 不能使用java或者javac命令
update-alternatives --install /usr/bin/javac javac /home/sinosoft/software/java/jdk1.8.0_191/bin/javac 300
update-alternatives --install /usr/bin/java java /home/sinosoft/software/java/jdk1.8.0_191/bin/java 300
update-alternatives --config java
Ubuntu18 自定義靜態 IP
使用 ipconfig 或者 ip addr 查看 Ubuntu IP地址信息
root@sitserver:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:fe:46:b5 brd ff:ff:ff:ff:ff:ff
inet 192.168.50.33/24 brd 192.168.50.255 scope global dynamic noprefixroute ens33
valid_lft 57414sec preferred_lft 57414sec
inet6 fe80::428f:5bb4:3c8c:a51b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
編輯 /etc/netplan/01-network-manager-all.yaml
gedit /etc/netplan/01-network-manager-all.yaml 或者 vim /etc/netplan/01-network-manager-all.yaml
/etc/netplan/01-network-manager-all.yaml 對排版要求嚴格
# Let NetworkManager manage all devices on this system
network:
ethernets:
ens33:
addresses: [192.168.50.100/24]
gateway4: 192.168.0.1
dhcp4: no
dhcp6: no
nameservers:
addresses: [223.5.5.5/24,223.6.6.6/24,8.8.8.8/24]
version: 2
應用自定義靜態 IP 地址
netplan apply
配置 DNS vim /etc/systemd/resolved.conf 使虛擬機可以連接網絡
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
DNS=223.5.5.5
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes