# 一.安装 JDK
# 1.一键安装
#安装jdk
sudo yum install java-1.8.0-openjdk-devel
#检查
java -version
1
2
3
4
5
2
3
4
5
# 2.源码步骤
#创建目录
mkdir -p /usr/local/src/jdk
cd /usr/local/src/jdk
#下载
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
#解压
tar xzvf jdk-8u131-linux-x64.tar.gz
mv jdk1.8.0_131/ jdk1.8
#配置文件
vi /etc/profile
#使配置生效
source /etc/profile
#查看版本
java -version
#查看位置
which java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 3.profile c文件
export JAVA_HOME=/usr/local/src/jdk/jdk1.8
export PATH=$PATH:$JAVA_HOME/bin
1
2
2
# 4.查询
echo:
#打印位置
echo $JAVA_HOME
/usr/local/src/jdk/jdk1.8
1
2
3
2
3
which:
which java
1
# 三.安装 docker
# 1.下载
#下载地址,最新的版本
https://download.docker.com/linux/static/stable/x86_64/
#下载这个版本
docker-24.0.7.tgz
1
2
3
4
5
2
3
4
5
# 2.上传解压
#上传到服务器
scp /Users/qinyingjie/Downloads/docker-24.0.7.tgz root@117.72.42.89:/kwan/software
#进入目录
cd /kwan/software
#解压
tar -zxvf docker-24.0.7.tgz
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 3.移动文件
#移动文件
cp docker/* /usr/bin/
#进入系统目录
cd /etc/systemd/system/
#编辑文件
vim docker.service
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
# 此处的–insecure-registry=127.0.0.1(此处改成你私服ip)设置是针对有搭建了自己私服Harbor时允许docker进行不安全的访问,否则访问将会被拒绝。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 4.启动 docker
# 给docker.service文件添加执行权限
chmod +x /etc/systemd/system/docker.service
# 重新加载配置文件(每次有修改docker.service文件时都要重新加载下)
systemctl daemon-reload
# 启动
systemctl start docker
# 设置开机启动
systemctl enable docker.service
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 5.查看状态
# 查看docker服务状态
systemctl status docker
#启动 Docker 服务并设置它开机自启动
systemctl start docker
systemctl restart docker
systemctl enable docker
#验证版本
docker --version
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
← 03-代理服务器 05-服务器资源备份 →