Linux
修改主机名
git 和 github
###安装git
sudo apt install git
###设置用户信息
git config --global user.name "user"
git config --global user.email "[email protected]"
###生成ssh密钥(生成的id_rsa.pub添加的Github)
ssh-keygen -t rsa -C "[email protected]"
#git设置代理
git config --global http.proxy '<http://127.0.0.1:7890>'
git config --global https.proxy '<http://127.0.0.1:7890>'
#git查看代理
git config --global --get http.proxy
git config --global --get https.proxy
#git取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
#Github连通性测试
ssh -T [email protected]
#git修改443端口
$ vim ~/.ssh/config
Host [github.com](http://github.com)
Hostname [ssh.github.com](http://ssh.github.com)
Port 443
zsh 和 ohmyzsh
安装
###安装zsh
sudo apt install zsh curl git
###替换bash为zsh。debian系自带chsh;红帽系,chsh命令需要安装包util-linux-user
sudo chsh -s /bin/zsh
###安装ohmyzsh
sh -c "$(curl -fsSL https://raw.github.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
###2.自动补全
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
开启插件
下载完了以后打开 .zshrc
文件 放入 plugins 里面就可以。
### 每个插件注意空格分隔 或者换行
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
### 或者这样
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
### 添加常用alias
alias cls='clear'
alias osu='sudo apt update && sudo apt upgrade -y'
更新配置文件 source ~/.zshrc
设置 Pwconfig
CPU 风扇自动,机箱风扇全速。 0【全速】,1【手动】,5【根据 bios 自定义设置】
apt install lm-sensors -y
sensors-detect
apt install fancontrol -y
cd /sys/devices/platform/nct6775.656/hwmon/hwmon9
#查看当前风扇模式、转速
cat pwm1_enable && cat pwm2_enable && cat pwm7_enable && cat pwm1 && cat pwm2 && cat pwm7
#机箱风扇全速(夏季散热)
echo 0 > pwm2_enable && echo 0> pwm7_enable
#机箱风扇自动(通用)
echo 5 > pwm1_enable && echo 5 > pwm2_enable && echo 5 > pwm7_enable
#机箱风扇手动,调速70(冬季静音)
echo 1 > pwm1_enable && echo 1 > pwm2_enable && echo 1 > pwm7_enable && echo 70 > pwm1 && echo 70 > pwm2 && echo 70 > pwm7
#机箱风扇手动,调速90(冬季静音)
echo 1 > pwm1_enable && echo 1 > pwm2_enable && echo 1 > pwm7_enable && echo 90 > pwm1 && echo 90 > pwm2 && echo 90 > pwm7
~/opt/pve/my-pwconfig.sh
#!/bin/bash
BASE_PATH=/sys/devices/platform/nct6775.656/hwmon/hwmon9
echo "***********************************************"
echo "当前风扇模式、转速 (0【全速】,1【手动】,5【bios设置】)"
echo "模式 pwm1:$(<$BASE_PATH/pwm1_enable);pwm2:$(<$BASE_PATH/pwm2_enable);pwm7:$(<$BASE_PATH/pwm7_enable)"
echo "转速 pwm1:$(<$BASE_PATH/pwm1);pwm2:$(<$BASE_PATH/pwm2);pwm7:$(<$BASE_PATH/pwm7)"
echo "***********************************************"
echo "请选择以下选项:"
echo "1:通用全自动"
echo "2:夏季散热全速255"
echo "3:冬季静音90"
echo "4:冬季静音70"
read choice
case $choice in
1)
echo 5 >$BASE_PATH/pwm1_enable && echo 5 >$BASE_PATH/pwm2_enable && echo 5 >$BASE_PATH/pwm7_enable
echo "已就绪:通用全自动"
;;
2)
echo 0 >$BASE_PATH/pwm2_enable && echo 0 >$BASE_PATH/pwm7_enable
echo "已就绪:夏季散热全速"
;;
3)
echo 1 >$BASE_PATH/pwm1_enable && echo 1 >$BASE_PATH/pwm2_enable && echo 1 >$BASE_PATH/pwm7_enable && echo 90 >$BASE_PATH/pwm1 && echo 90 >$BASE_PATH/pwm2 && echo 90 >$BASE_PATH/pwm7
echo "已就绪:冬季静音90"
;;
4)
echo 1 >$BASE_PATH/pwm1_enable && echo 1 >$BASE_PATH/pwm2_enable && echo 1 >$BASE_PATH/pwm7_enable && echo 70 >$BASE_PATH/pwm1 && echo 70 >$BASE_PATH/pwm2 && echo 70 >$BASE_PATH/pwm7
echo "已就绪:冬季静音70"
;;
*)
echo "无效的选择,请输入数字1、2、3、4"
;;
esac
安装 Cpu 省电工具包
apt-get install linux-cpupower -y
#可用的模式
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
#设置到性能模式
cpupower -c all frequency-set -g performance
#查看当前所处模式
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
#设置到省电模式
cpupower -c all frequency-set -g powersave
安装 docker
安装 1Panel
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo sh quick_start.sh
调整 swap 大小
### 使用 dd 命令创建 SWAP 文件(例如创建 10GB 的 SWAP):
sudo dd if=/dev/zero of=/usr/swap/swap0 bs=1M count=10240 status=progress
### 设置正确的权限:使其不可读
sudo chmod 600 /usr/swap/swap0
### 格式化为SWAP文件系统
sudo mkswap /usr/swap/swap0
### 启用SWAP文件
sudo swapon /usr/swap/swap0
### 设置开机自动启用,编辑 /etc/fstab 文件
echo '/usr/swap/swap0 none swap sw 0 0' | sudo tee -a /etc/fstab