本篇主要记录 Ubuntu 安装软件的过程
开启root账号ssh
1 2 3 4 5 6 7 8 9 10
| cat ~/.ssh/id_rsa.pub | tee /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
systemctl restart ssh
|
ssh-keygen -R example.com
清除ssh指纹
更换源及升级包
升级包
1
| apt update && apt upgrade -y && apt autoremove -y
|
或
1 2 3
| apt update \ && apt install -y --allow-change-held-packages $(apt list --upgradable 2>/dev/null | grep -Ev "(列表|Listing)" | awk -F/ '{print $1}' | xargs) \ && apt autoremove -y
|
更改语言
1 2 3 4
| apt install fonts-wqy-zenhei && fc-cache sed -i 's/^# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen locale-gen echo 'LANG=zh_CN.UTF-8' > /etc/default/locale
|
网络配置工具
1
| apt install network-manager
|
即可使用 nmtui
安装ShellClash
阅读官方文档
1 2 3 4
| export url='https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master' \ && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh \ && bash /tmp/install.sh \ && source /etc/profile &> /dev/null
|
安装Docker及常用镜像
1
| curl -sSL https://proxy.yangrucheng.top/https://get.docker.com | sh
|
1
| nano /etc/docker/daemon.json
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| { "data-root": "/var/lib/docker", "dns": ["114.114.114.114", "8.8.8.8"], "registry-mirrors": [ "https://pull.loridocker.com", "https://docker.proxy.yangrucheng.top" ], "default-address-pools": [{ "base": "172.17.0.0/16", "size": 24 }], "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3" } }
|
配置 Docker Pull 代理
1
| nano /etc/systemd/system/multi-user.target.wants/docker.service
|
1 2 3
| Environment=HTTP_PROXY=http://127.0.0.1:7890 Environment=HTTPS_PROXY=http://127.0.0.1:7890 Environment=NO_PROXY=localhost,127.0.0.1
|
1 2 3 4 5
| systemctl daemon-reload \ && systemctl stop docker.service \ && systemctl stop docker.socket \ && systemctl start docker.service \ && systemctl start docker.socket
|
进入容器内部
docker exec -it 容器ID /bin/sh
安装常用语言
安装 Go
1 2 3 4 5 6 7 8
| GO_VERSION="1.23.6" DEVICE="linux-amd64" GO_URL="https://golang.google.cn/dl/go$GO_VERSION.$DEVICE.tar.gz" wget -O go.tar.gz $GO_URL sudo tar -C /usr/local -xzf go.tar.gz echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc source ~/.bashrc go version
|
安装 NodeJs
1 2 3 4 5 6 7 8
| NODE_VERSION="22.13.1" DEVICE="linux-x64" NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-$DEVICE.tar.xz" wget -O node.tar.xz $NODE_URL sudo tar -C /usr/local --strip-components 1 -xf node.tar.xz echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc source ~/.bashrc node -v && npm -v
|