记录一下Ubuntu下服务环境部署
前言:最近
配置apt
源为阿里云
1、备份你的旧源文件:
1 | sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak |
2、检查系统内核版本号
1 | sudo lsb_release -a |
得到如下回显:
1 | root@uosoubuntu:~# lsb_release -a |
这里的jammy
就是当前服务器的版本号
3、设置阿里云源
编辑
/etc/apt
目录下的sources.list
文件,填入以下内容1
2
3
4
5
6
7
8
9
10
11
12阿里源
deb http://mirrors.aliyun.com/ubuntu/ version main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ version-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ version-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ version-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ version-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ version main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ version-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ version-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ version-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ version-backports main restricted universe multiverse将填入内容中的
version
字段替换为当前系统版本号,即如下格式1
2
3
4
5
6
7
8
9
10
11阿里源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse刷新 apt 列表
1
sudo apt update
Ubuntu安装JDK8
1 | sudo apt-get install openjdk-8-jdk |
Ubuntu安装Nginx
安装
1
sudo apt install nginx
启动和部署
1
2
3
4
5
6
7
8
9
10
11
12
13
14启动Nginx
sudo systemctl start nginx
查看Nginx状态
sudo systemctl status nginx
配置开机自启
sudo systemctl enable nginx
检查配置文件
sudo nginx -t
刷新Nginx
sudo nginx -s reload