随记-阿里云服务器 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

相关推荐
火云代理4 小时前
动态IP是什么及其应用场景
服务器·网络·tcp/ip·动态代理ip·代理ip·火云代理·静态代理ip
.道阻且长.4 小时前
Linux基础IO:系统文件IO
linux·运维·服务器
迪康coolmu4 小时前
基于迪康端点安全一体化管理系统的屏幕录像审计:录屏的留存、回放与取证链
运维·服务器·网络·经验分享·安全·网络安全·制造
xurileidian4 小时前
第 24 篇 · 边玩边学Python · while 与死循环怎么退
服务器·前端·python
Logic1015 小时前
《网络实用技术》第6章·前沿技术全景:移动互联网/物联网/云计算/SDN四大支柱深度解析
物联网·云计算·iaas·sdn·软件定义网络·移动互联网·网络新技术
by209997 小时前
Linux 软硬链接与文件删除机制
linux·服务器
炸薯条!8 小时前
Python基础学习:文件操作详解(打开、读取、写入与路径)
java·服务器·python
信安IT租赁10 小时前
小公司服务器用户与权限管理:chmod/chown/用户组从零理清
linux·运维·服务器
redsea_HR10 小时前
全球化HR系统选型:本地服务网络和远程支持怎么选?
大数据·服务器·网络
AI探知-阿薇10 小时前
AWS WorkSpaces 升级 AI Agent 管控
人工智能·云计算·aws