随记-阿里云服务器 Ubuntu20.04

文章目录

禁止root 远程登录

先创建一个用户

sudo adduser username

赋予用户sudo

sudo usermod -a -G adm username

sudo usermod -a -G sudo username

禁用 root 远程登录

修改config

vim /etc/ssh/sshd_config

将 PermitRootLogin yes 改为 PermitRootLogin no

PermitRootLogin no

重启 ssh

sudo service ssh restart

修改默认22 端口

修改config

vim /etc/ssh/sshd_config

搜索并复制 Port,修改 22 为其他可用端口

Port 55

重启 ssh

sudo service ssh restart

免密登录

生成密钥

ssh-keygen -t rsa -b 4096 -f file_name

上传公钥到服务器

ssh-copy-id -i .ssh/id_rsa.pub 用户名@192.168.x.xxx

安装Docker

更新软件包索引

sudo apt update

sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common

curl 导入源仓库的 GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

添加 Docker APT 软件源

sudo add-apt-repository "deb arch=amd64 https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

安装 Docker

安装 Docker 最新版本

sudo apt update

sudo apt install docker-ce docker-ce-cli containerd.io

安装指定版本

查看可用版本

sudo apt update

apt list -a docker-ce

示例

docker-ce/focal 5:20.10.24~3-0~ubuntu-focal amd64

docker-ce/focal 5:20.10.23~3-0~ubuntu-focal amd64

如上,VERSION 在第二列

5:20.10.24~3-0~ubuntu-focal

5:20.10.23~3-0~ubuntu-focal

安装指定版本

sudo apt install -y docker-ce=<VERSION> docker-ce-cli=<VERSION> containerd.io

阻止 Docker 自动更新

sudo apt-mark hold docker-ce

以非 Root 用户身份执行 Docker

sudo usermod -aG docker $USER

安装 Git

sudo apt update

sudo apt install -y git

安装 GitLab Runner

gitlab link:安装 GitLab Runner

添加源

curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash

安装

最新版本

sudo apt-get install -y gitlab-runner

安装指定版本

apt-cache madison gitlab-runner

sudo apt-get install -y gitlab-runner=15.11.0

注册

sudo gitlab-runner register \

--non-interactive \

--url "https://jihulab.com" \

--registration-token "<token>" \

--executor "docker" \

--docker-image <image> \

--description "docker-runner"


到此结 DragonFangQy  2023.8.10

相关推荐
程序员小崔日记1 小时前
20块钱注册一年 .COM 域名!Spaceship 最新优惠教程,支付宝即可付款(附优惠码)
服务器·腾讯云·域名
梦想的颜色1 小时前
2026 国产大模型硬核横评|阿里云百炼(通义 Qwen3.7 Max)VS DeepSeek V4-Pro:平台、定价、吞吐、能力、工程落地全方位对比
阿里云·通义千问·阿里云百炼·deepseek v4-pro·qwen3.7·llm 吞吐量实测·#企业 maas 平台横评
实心儿儿2 小时前
Linux —— 进程间关系和守护进程
linux·运维·服务器
林浅不想努力3 小时前
LVS知识点总结
服务器·云原生·lvs
栈溢出的浪漫3 小时前
2026 WAIC 直击丨阿里云全栈AI落地:从芯片算力到智能体原生云
阿里云·全栈ai·2026waic·智能体原生云·大模型产业化
Dawn-bit3 小时前
Linux磁盘管理详解
linux·运维·服务器·计算机网络·云计算
三言老师7 小时前
CentOS7.9:Redis‑Cluster集群部署结构化实战教程
linux·运维·服务器·数据库
technology_x9 小时前
2026年财务报表分析软件测评:兼容与安全解析
java·服务器·前端
海域云-罗鹏9 小时前
分支访问总部ERP卡顿?如何部署SD-WAN组网解决方案
服务器·网络·安全
大鱼>9 小时前
eBPF内核编程:从TC到XDP的全栈可观测性
linux·服务器·php