Ubuntu 一站式初始化笔记

安装 oh-my-zsh

安装 Zsh

bash 复制代码
sudo apt update
sudo apt install zsh -y

验证是否成功安装了 zsh:

bash 复制代码
zsh --version

更改默认 Shell 为 Zsh

bash 复制代码
chsh -s $(which zsh)

注销并重新登录或者重启终端,以应用更改。

安装 oh-my-zsh

bash 复制代码
# 使用 curl 安装(镜像源)
sh -c "$(curl --insecure -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"

在安装过程中,将会询问是否更改默认 Shell 为 Zsh。如果之前已经更改为 Zsh,可以忽略这步。

安装完成后,默认配置文件会在 ~/.zshrc 中,你可以根据需要进行编辑:

bash 复制代码
nano ~/.zshrc

alias d="docker"
alias dp="docker ps"
alias dc="docker container"
alias di="docker image"
alias dcd="docker compose down"
alias dcu="docker compose up"
alias dcud="docker compose up -d"
alias dil="docker image ls"
alias dcl="docker container ls"

保存并关闭文件,然后重新加载配置:

bash 复制代码
source ~/.zshrc

安装 Docker

bash 复制代码
# curl -fsSL test.docker.com -o get-docker.sh
curl --insecure -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun
# sudo sh get-docker.sh --mirror AzureChinaCloud

如果 lock 报错,执行 reboot 重启机器再次执行。

安装 Nginx

bash 复制代码
sudo apt update
sudo apt install nginx -y

启动 Nginx 服务

bash 复制代码
sudo systemctl start nginx
sudo systemctl enable nginx

验证安装

bash 复制代码
sudo systemctl status nginx

此外,打开浏览器,进入 http://your_server_ip 或 http://localhost,你应该能看到 Nginx 欢迎页面,这表示安装成功。

配置 Nginx

bash 复制代码
ln -s /etc/nginx ~/nginx
ln -s /var/log/nginx ~/nginx-log

nano /etc/nginx/proxy_params
# 填入如下内容
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:$server_port;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_http_version 1.1;

安装 acme.sh

bash 复制代码
curl https://get.acme.sh | sh -s [email protected]

使用 dnsapi 快速添加证书

bash 复制代码
cd .acme.sh/
export Ali_Key="xxx"
export Ali_Secret="Vn2XCoJnYAGFTNqQlbbCFQ90Nuuhh6"
./acme.sh --issue --dns dns_ali -d "*.chantaria.com"

将证书添加到 nginx

bash 复制代码
mkdir /etc/nginx/cert_file

./acme.sh --install-cert -d "*.chantaria.com" \
--key-file       /etc/nginx/cert_file/key.pem  \
--fullchain-file /etc/nginx/cert_file/fullchain.pem \
--reloadcmd     "service nginx reload"
相关推荐
Vizio<14 分钟前
基于FashionMnist数据集的自监督学习(生成式自监督学习AE算法)
人工智能·笔记·深度学习·神经网络·自监督学习
TaoTao Li2 小时前
学习笔记:3个学习AI路上反复看到的概念:RAG,Langchain,Agent
人工智能·笔记·学习
Wireless_wifi62 小时前
Compre Analysis: QCN9274/QCN6274 WiFi7 Modules – M.2 vs mini PCIe Interface
linux·数据库·人工智能·ubuntu
moxiaoran57532 小时前
uni-app学习笔记十六-vue3页面生命周期(三)
笔记·学习·uni-app
东京老树根3 小时前
SAP学习笔记 - 开发15 - 前端Fiori开发 Boostrap,Controls,MVC(Model,View,Controller),Modules
笔记·学习
LouSean3 小时前
mac mini m4命令行管理员密码设置
经验分享·笔记·学习·macos
初级代码游戏3 小时前
Xamarin劝退之踩坑笔记
笔记·maui·xamarin
初级代码游戏4 小时前
Xamarin入门笔记(Xamarin已经被MAUI取代)
笔记·maui·xamarin
一大Cpp4 小时前
Ubuntu下编译mininim游戏全攻略
linux·ubuntu·游戏