一、ubuntu18 服务器 配置国内镜像源

1.配置国内镜像源

## 修改配置文件,覆盖原文件内容
vim /etc/apt/source.list
## ------------------------------- 阿里源 start -------------------------------------------
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
## ------------------------------- 阿里源 end ---------------------------------------------
sudo apt-get update && sudo apt-get upgrade
## sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common

2.创建自己目录

mkdir /my/
## 修改某个目录下所有文件的权限,如果子目录中的文件权限也要修改,
## 则使用参数-R启动递归处理
chmod -R 777 /my/

3.java开发环境变量配置

## 1.编辑配置文件
vim ~/.bashrc
## ----------------------start----------------------------
## jdk8 env
export JAVA_HOME=/my/jdk1.8.0_251
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
## maven3.5.4   env
export M2_HOME=/my/apache-maven-3.5.4
export PATH=${M2_HOME}/bin:$PATH
## ----------------------end----------------------------
## 2.生效
source ~/.bashrc 

4.服务器时间差8小时

## 1.在配置文件中增加一行 
vim /etc/profile
export TZ='CST-8'
## 2.使文件立即生效
source /etc/profile
## 3.或者
. /etc/profile

5.配置maven阿里源

vim /my/apache-maven-3.5.4/conf/settings.xml
## localRepository 改成自己的maven本地仓库位置
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>/my/apache-maven-3.5.4/repo/</localRepository>
  <mirrors>
  <mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public class="hljs-tag"></url>
    </mirror>
  </mirrors>
</settings>

你可能感兴趣的:(一、ubuntu18 服务器 配置国内镜像源)