目录

配置 Ubuntu 环境

安装 zsh-终端

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 设置主机名
hostnamectl set-hostname wantname
 # 更新软件更新源
apt-get update && apt-get -y upgrade
 # 安装zsh
apt install zsh -y
# 查看当前系统使用的shell
echo $SHELL
# 查看系统自带哪些shell
cat /etc/shells
# 设置zsh为默认shell,该命令执行后重启机器(reboot)
chsh -s /bin/zsh
# 安装my-zsh之前需要安装Git:
apt install git -y
# 安装my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 设置主题,ys
vim ~/.zshrc
# 设置插件
plugins=(git
        zsh-autosuggestions
        zsh-syntax-highlighting
        )
# 生效配置
source ~/.zshrc
## zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
## zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  • 快速配置:
1
apt-get update && apt-get -y upgrade && apt-get install -y zsh && apt install -y git && apt-get install -y vim && apt-get install -y curl && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && vim ~/.zshrc

配置alias-快捷命令

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 运行进入到页面,然后在文件末尾加入下面的配置
vim ~/.zshrc
# my aliases
# telegram bot server
alias tgbot="wget https://raw.githubusercontent.com/TeamPGM/PagerMaid-Pyro/development/utils/docker.sh -O docker.sh && chmod +x docker.sh && bash docker.sh"
# ping -c 5 -s 1000 $1
alias p5='p5(){ping -c 5 -s 1000 $1;};p5'
# Streaming unblock test
alias stream="bash <(curl -L -s https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh)"
# easy to clear
alias c="clear"
# update and upagrade
alias upg="apt-get update && apt-get -y upgrade"
# easy to alias
alias a="alias" 
# adg user
alias adg="sudo /opt/AdGuardHome/AdGuardHome -s " 
# nginx
alias ng="sudo /usr/local/nginx/sbin/nginx"
# glances
alias g="glances"
# systemctl
alias sy="systemctl"
# ffmpeg out video
alias fc='bg(){ffmpeg -i $1 -i $2 -vcodec copy -acodec copy outffmpeg.mkv;};bg'
# install
alias ins="apt-get install -y "
# yt-dlp YouTube rclone gd
alias yt='yt(){yt-dlp $1 --paths /home/google_drive/youtube --write-subs --write-auto-subs --sub-langs "zh-Hant,zh-Hants" --merge-output-format mkv --external-downloader aria2c --external-downloader-args "-x 5 -k 4M";};yt'
# yt-dlp bilibili,使用浏览器插件:Get cookies.txt获得cookies, rclone gd
alias bili='bili(){yt-dlp $1 --paths /home/google_drive/bilibili --write-subs --write-auto-subs --sub-langs "zh-Hant,zh-Hants" --merge-output-format mkv --cookies /root/.aria2c/cookies.txt --external-downloader aria2c --external-downloader-args "-x 5 -k 4M";};bili'
# yt-dlp reality rclone gd
alias reality='video(){yt-dlp $1 --paths /home/google_drive/reality --write-subs --write-auto-subs --sub-langs "zh-Hant,zh-Hants" --merge-output-format mkv --external-downloader aria2c --external-downloader-args "-x 5 -k 4M";};video'

安装glances-监控服务器状态

1
sudo apt install -y glances

不能安装的话,试试下面这个:

1
sudo apt install python3 python3-dev python3-jinja2 python3-psutil python3-setuptools hddtemp python3-pip lm-sensors -y && sudo pip3 install glances

安装 docker 和 docker-compose 和 snap

1
ins docker && ins docker-compose && ins snapd

使用 portainer 来进行 docker 管理

1
docker volume create portainer_data
1
docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

通过:https://IP:9443 进行访问。