💡使用 root
或具有 sudo
权限的用户
💡默认你正在配置一个新的环境,若不是则按需执行
# debian 11.3
sudo sed -ri 's/(deb|security|ftp).debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && sudo apt update
debian 默认是没有 sudo 命令的,先下载命令:
apt insatll sudo
为 dev
用户设置管理员权限, 执行 vim /etc/sudoers
,添加如下行:
dev ALL=(ALL:ALL) ALL
sudo timedatectl set-timezone Asia/Shanghai
update-alternatives
用法
# jdk17 清华源
sudo wget https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jdk/x64/linux/OpenJDK17U-jdk_x64_linux_hotspot_17.0.3_7.tar.gz -O /tmp/jdk17.tar.gz \
&& sudo rm -rf /usr/local/jdk/jdk17 \
&& sudo mkdir -p /usr/local/jdk/jdk17 \
&& sudo tar -zxf /tmp/jdk17.tar.gz -C /usr/local/jdk/jdk17 --strip-components 1 \
&& sudo rm /tmp/jdk17.tar.gz \
&& sudo update-alternatives --install /usr/local/jdk/current jdk /usr/local/jdk/jdk17 17
# jdk8 清华源
sudo wget https://mirrors.tuna.tsinghua.edu.cn/Adoptium/8/jdk/x64/linux/OpenJDK8U-jdk_x64_linux_hotspot_8u332b09.tar.gz -O /tmp/jdk8.tar.gz \
&& sudo rm -rf /usr/local/jdk/jdk8 \
&& sudo mkdir -p /usr/local/jdk/jdk8 \
&& sudo tar -zxf /tmp/jdk8.tar.gz -C /usr/local/jdk/jdk8 --strip-components 1 \
&& sudo rm /tmp/jdk8.tar.gz \
&& sudo update-alternatives --install /usr/local/jdk/current jdk /usr/local/jdk/jdk8 8
# jdk17
sudo wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.3_7.tar.gz -O /tmp/jdk17.tar.gz \
&& sudo rm -rf /usr/local/jdk/jdk17 \
&& sudo mkdir -p /usr/local/jdk/jdk17 \
&& sudo tar -zxf /tmp/jdk17.tar.gz -C /usr/local/jdk/jdk17 --strip-components 1 \
&& sudo rm /tmp/jdk17.tar.gz \
&& sudo update-alternatives --install /usr/local/jdk/current jdk /usr/local/jdk/jdk17 17
# jdk8
sudo wget https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u332b09.tar.gz -O /tmp/jdk8.tar.gz \
&& sudo rm -rf /usr/local/jdk/jdk8 \
&& sudo mkdir -p /usr/local/jdk/jdk8 \
&& sudo tar -zxf /tmp/jdk8.tar.gz -C /usr/local/jdk/jdk8 --strip-components 1 \
&& sudo rm /tmp/jdk8.tar.gz \
&& sudo update-alternatives --install /usr/local/jdk/current jdk /usr/local/jdk/jdk8 8
sudo wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz -O /tmp/maven.tar.gz \
&& sudo rm -rf /usr/local/maven \
&& sudo mkdir -p /usr/local/maven \
&& sudo tar -zxf /tmp/maven.tar.gz -C /usr/local/maven --strip-components 1 \
&& sudo rm /tmp/maven.tar.gz
sudo wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.64/bin/apache-tomcat-9.0.64.tar.gz -O /tmp/tomcat9.tar.gz \
&& sudo rm -rf /usr/local/tomcat/tomcat9 \
&& sudo mkdir -p /usr/local/tomcat/tomcat9 \
&& sudo tar -zxf /tmp/tomcat9.tar.gz -C /usr/local/tomcat/tomcat9 --strip-components 1 \
&& sudo rm /tmp/tomcat9.tar.gz
当前用户 dev
, 若希望全局使用 root
,并将 ~/.bashrc
改为 /etc/profile
sed -i '$ a # jdk\nexport JAVA_HOME=/usr/local/jdk/current\nexport PATH=$JAVA_HOME/bin:$PATH\n# maven\nexport PATH=/usr/local/maven/bin:$PATH' ~/.bashrc \
&& source ~/.bashrc
痛斥以下腾讯云访问海外服务器的网络速度:
腾讯云下载速度: