1.基础环境配置:
# Ubuntu18.04版,安装后的配置
## 1. 添加root密码
sudo passwd root
### 输入两遍root的密码
## 2. 修改静态IP -- ubuntu18跟16版本,在修改静态IP的时候有区别
cd /etc/netplan
sudo vim 01-network-manager-all.yaml #需要严格遵守yml语法格式(主要是冒号后面加一个空格)
### 添加 ens33的网络配置信息
network:
version: 2
renderer: NetworkManager
ethernets:
ens33:
dhcp4: no
addresses: [192.168.80.30/24]
optional: true
gateway4: 192.168.80.2
nameservers:
addresses: [223.5.5.5,8.8.8.8]
## 更改netplan
sudo netplan apply
## 修改国内源
cd /etc/apt
cp sources.list sources.list.bak
echo '' > sources.list
vim sources.list
## 3.修改国内源 -- 阿里、163、中科大都行
### 阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
### 163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
### 中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
## 更新
apt-get update && apt-get upgrade
# 4.图形界面的处理
sudo systemctl set-default multi-user.target # 关闭图形界面
sudo systemctl set-default graphical.target #开启图形界面
sudo reboot #重启
init 0 #关机
init 6 #重启
# 基础环境配置
# Ubuntu 16.04.7安装时,修改静态ip
## 修改文件
sudo vim /etc/network/interfaces
## 修改文件
auto ens33
iface ens33 inet static
address 192.168.80.30
netmask 255.255.255.0
gateway 192.168.80.2
dns-nameservers 8.8.8.8 114.114.114.114
## 修改DNS
sudo vim /etc/resolvconf/resolv.conf.d/base
## 添加内容
nameserver 114.114.114.114
nameserver 223.5.5.5
## 重启网络
sudo /etc/init.d/networking restart
## 修改国内源
cd /etc/apt
cp sources.list sources.list.bak
echo '' > sources.list
vim sources.list
#修改国内的源: 阿里源 -- 16.04版
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
## 更新
sudo apt-get update && apt-get upgrade
# 2.设置JDK的环境变量-- 跟docker无关,此处属于环境配置
sudo mkidr /usr/local/soft
tar -zxvf jdk1.8.0-202.tar.gz -C /usr/local/soft/
## 修改环境变量配置:
sudo vim /etc/profile
## 添加JDK的环境变量
#set java env
export JAVA_HOME=/usr/local/soft/jdk1.8.0
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
## 执行命令修改立即生效
source /etc/profile
## 如果未生效:需要手动修改/etc/bash.bashrc
export PATH=$PATH:/usr/local/jdk1.8.0/bin:/usr/local/jdk1.8.0/jre/bin
# 查看jdk安装情况
java -version