目录

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=my@example.com

使用 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"
本文是转载文章,点击查看原文
如有侵权,请联系 xyy@jishuzhan.net 删除
相关推荐
咩咩大主教3 小时前
Gitlab报错:sudo: a password is required
linux·服务器·git·ubuntu·gitlab·shell·gitlabci/cd
S181517004865 小时前
美发行业的数字化转型:从痛点出发,探索未来新机遇
大数据·人工智能·经验分享·笔记·科技
田辛 | 田豆芽5 小时前
【Linux】在VMWare中安装Ubuntu操作系统(2025最新_Ubuntu 24.04.2)#VMware安装Ubuntu实战分享#
linux·运维·ubuntu
cndrip6 小时前
【量化交易笔记】16.因子的评价和分析
笔记
余多多_zZ6 小时前
鸿蒙初学者学习手册(HarmonyOSNext_API14)_UIContext(@ohos.arkui.UIContext (UIContext))
笔记·学习·华为·harmonyos
自由的晚风7 小时前
脑电波控制设备:基于典型相关分析(CCA)的脑机接口频率精准解码方法
人工智能·经验分享·笔记·算法·matlab·脑机接口·ssvep
代码猪猪傻瓜coding8 小时前
【统计学相关笔记】有效估计与一致最小方差无偏估计 (UMVUE)
人工智能·笔记·机器学习
工程师平哥8 小时前
【vscode-01】vscode不同项目不同语言扩展插件隔离方案
ide·笔记·vscode·嵌入式硬件·mcu·编辑器
奕天者8 小时前
C++学习笔记(十六)——函数重载
c++·笔记·学习
skywalk816311 小时前
Windows10 WSL又又又一次崩了 Docker Desktop - Unexpected WSL error
运维·ubuntu·docker·容器·wsl