Linux / Unix

Initialize

Public

Shell

apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
apt install neofetch
echo 'neofetch' >> ~/.zshrc
# echo 'export LC_ALL=en_US.UTF-8' >> ~/.zshrc

Install

vim curl git unzip
htop ncdu lsb-release
byobu
aria2
python python-pip python3 python3-pip 
build-essential

ssh root login

sudo -i
vi /etc/ssh/sshd_config

PermitRootLogin yes
PasswordAuthentication yes

service sshd restart
/etc/init.d/ssh restart
systemctl restart sshd.service

curl https://github.com/dimpurr.keys >> /root/.ssh/authorized_keys
passwd root

Ubuntu/Debian (apt)

https://mirrors.ustc.edu.cn/help/ubuntu.html

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo sed -i 's/httpredir.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y

16.04 https://www.cnblogs.com/moonlightpoet/p/5615602.html

fcitx

export XIM_PROGRAM=fcitx
export XIM=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"

sudo vim /var/lib/snapd/desktop/applications/telegram-desktop_telegram-desktop.desktop
env QT_IM_MODULE=fcitx /opt/telegram/Telegram -- %u

DE Usage

  • change source
  • set DPI
  • reboot

HiDPI

sudo vim /etc/chromium-browser/default
CHROMIUM_FLAGS=”--force-device-scale-factor=1.5”

Proxmox

proxmox 源

#删除企业源
rm /etc/apt/sources.list.d/pve-enterprise.list 
##下载秘钥
wget http://download.proxmox.com/debian/proxmox-ve-release-5.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpg
#添加社区源
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription" >/etc/apt/sources.list.d/pve-no-subscription.list

去除订阅弹窗

sed -i "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js

debian 源

echo "deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free" > /etc/apt/sources.list

显卡直通

AMD ATI Radeon VII
➜  ~ vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet video=efifb:off amd_iommu=on pcie_acs_override=downstream"
➜  ~ update-grub
➜  ~ dmesg | grep -e DMAR -e IOMMU
[    0.610544] pci 0000:00:00.2: AMD-Vi: IOMMU performance counters supported
[    0.617178] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
[    0.619136] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
➜  ~ lspci -nn | grep Radeon
2c:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 [Radeon VII] [1002:66af] (rev c1)
2c:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 HDMI Audio [Radeon VII] [1002:ab20]
➜  ~ lspci -vv -s 2c:00.0 |grep drive
  Kernel driver in use: amdgpu
➜  ~ lspci -vv -s 2c:00.1 |grep drive
  Kernel driver in use: snd_hda_intel
➜  ~ vim /etc/modprobe.d/pve-blacklist.conf
blacklist nvidiafb
blacklist nouveau
blacklist nvidia
blacklist radeon
blacklist amdgpu
blacklist snd_hda_intel
➜  ~ echo "options vfio-pci ids=1002:66af,1002:ab20" > /etc/modprobe.d/vfio.conf
➜  ~ update-initramfs -u -k all
➜  ~ reboot
Intel 核显
vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on video=efifb:off"
update-grub

vim /etc/modules
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "blacklist radeon" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf
echo "blacklist snd_hda_intel" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist snd_hda_codec_hdmi" >> /etc/modprobe.d/pve-blacklist.conf
echo "blacklist i915" >> /etc/modprobe.d/pve-blacklist.conf
update-initramfs -u

lspci -nn | grep VGA
echo "options vfio-pci ids=8086:3e90" > /etc/modprobe.d/vfio.conf
update-initramfs -u -k all

reboot

lsmod | grep vfio
lspci -nnk
lspci -vvv -s 00:02.0

Manjaro (pacman)

OpenSUSE

OpenWRT/lede (opkg)

https://mirrors.ustc.edu.cn/help/brew.html

sed -i 's_downloads\.lede-project\.org_mirrors.ustc.edu.cn/lede_' /etc/opkg/distfeeds.conf
sed -i 's_downloads\.openwrt\.org_mirrors.ustc.edu.cn/lede_' /etc/opkg/distfeeds.conf

CentOS (yum)

yum install epel-release -y
yum clean all && yum makecache

masOS (brew)

https://mirrors.ustc.edu.cn/help/brew.html

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

other

locale (perl)

dpkg-reconfigure locales 

Tools

curl cip.cc

Cheatsheets

byobu

F2                 打开一个新的窗口
F3                进入前一个窗口
F4                 进入后一个窗口
F9                打开byobu菜单,查看帮助信息和配置信息
F12                锁住屏幕
F6                  断开链接

dotfile

.zshrc

alias cdw="cd /home/wwwroot/"
alias cdnc="cd /usr/local/nginx/conf/vhost/"
No Comments
Back to top