Skip to content

Instantly share code, notes, and snippets.

@2niuhe
Last active December 7, 2022 14:02
Show Gist options
  • Save 2niuhe/710c5f14aed9656b3988564cefe4bc62 to your computer and use it in GitHub Desktop.
Save 2niuhe/710c5f14aed9656b3988564cefe4bc62 to your computer and use it in GitHub Desktop.
Ubuntu20.04配置软件

Ubuntu20一些软件配置记录

换清华源

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
#清华源
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb https://typora.io/linux ./
# deb-src https://typora.io/linux ./

换pip源

mkdir ~/.pip/
cd ~/.pip/
nano pip.conf
# input the content as below
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org
               pypi.tuna.tsinghua.edu.cn

更新,装工具

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim gcc g++ git zsh python3-dev python3-pip gparted  gimp steam shutter telegram-desktop  chromium-browser transmission unrar zip unzip aria2 fcitx exfat-utils openssh-client openssh-server
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor 
sudo apt-get update 
sudo apt-get install indicator-sysmonitor

安装oh my zsh 和powerline字体

cd /tmp
sudo apt-get install zsh
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/powerline/fonts.git
sudo ./fonts/install.sh
sudo chsh -s /usr/bin/zsh

修复双系统时间错误

sudo apt install ntpdate
sudo ntpdate time.windows.com
sudo hwclock --localtime --systohc

Jupyter服务器搭建

pip3 install jupyter
sudo chown -R user:user ~/.local/share/jupyter    #修改jupyter用户权限,以普通用户运行
jupyter notebook --no-browser   # 测试
# 创建hash密码
ipython
from IPython.lib import passwd
passwd()
# 生成 /home/ipynb/.jupyter/jupyter_notebook_config.py 文件
jupyter notebook --generate-config
"""
c.NotebookApp.certfile = u'/home/ipynb/cert.pem'    # 证书文件
c.NotebookApp.keyfile = u'/home/ipynb/privkey.pem'  # 私钥文件
c.NotebookApp.ip = '*'                              # 允许从任意 IP 访问
c.NotebookApp.open_browser = False                  # 运行 notebook 应用时不打开浏览器
c.NotebookApp.password = u'sha1:e9e608cacbb2:da88........2cf0c8c26877b7179100d8fd545a'  # 密码的 hash 值
c.NotebookApp.port = 28888  # 运行端口

#virtualenv多环境配置jupyter,先进入Pytorch环境
pip install ipykernel 
python -m ipykernel install --user --name Pytorch –display-name “Python3(pytorch)”
"""

# 启动服务
nohup jupyter-notebook &

安装eletron-ssr

wget https://github.com/shadowsocksrr/electron-ssr/releases/download/v0.2.7/electron-ssr-0.2.7.deb
dpkg -i electron-ssr-0.2.7.deb
ln -s /usr/bin/python3 /usr/bin/python

安装clash并自启动

# download config file
链接: https://pan.baidu.com/s/1HiXFuWvGnI1onbSIkKzAiQ 提取码: 2akv
mv Country.mmdb ~/.config/clash/
# reference https://github.com/yuanlam/Clash-Linux
wget https://github.com/Dreamacro/clash/releases/download/v0.19.0/clash-linux-amd64-v0.19.0.gz
gzip -d clash-linux-amd64-v0.19.0.gz
sudo mv clash-linux-amd64-v0.19.0 /usr/bin/clash 
sudo chmod +x /usr/bin/clash
# create config file
mkdir -p ~/.config/clash
cd ~/.config/clash

# set auto start when system boot
sudo touch /etc/systemd/system/clash.service
sudo nano /etc/systemd/system/clash.service
# add content as below
[Unit]
Description=clash daemon

[Service]
Type=simple
User=username
ExecStart=/usr/bin/clash -d /home/username/.config/clash/
Restart=on-failure

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload
sudo systemctl start clash.service
# set autostart
sudo systemctl enable clash.service
# some useful command 
## 启动Clash ##
sudo systemctl start clash.service

## 重启Clash ##
sudo systemctl restart clash.service

## 查看Clash运行状态 ##
sudo systemctl status clash.service

## 实时滚动状态 ##
sudo journalctl -u clash.service -f

## 浏览器web配置
http://clash.razord.top/#/proxies

ScreenRecorder

sudo add-apt-repository ppa:ubuntuhandbook1/apps
sudo apt update
sudo apt install vokoscreen-ng

安装wps2019并解决字体问题

https://linux.wps.cn/ 字体 链接: https://pan.baidu.com/s/1ZpvAlBegEJ3TP4v9SCdXWQ 提取码: bccr

开启ssh-server服务

ps -e|grep ssh  # 查看ssh服务状态
sudo/etc/init.d/ssh start   #启动服务
sudo /etc/init.d/ssh stop   #停止服务
sudo /etc/init.d/sshresart   #重启服务

禁用笔记本自带键盘

xinput list   #找出键盘ID
xinput set-prop id "Device Enabled" 0   #禁用该ID的设备

安装wireshark抓包工具

sudo apt-get install wireshark
#若安装后打开,权限不足
sudo apt-get install libcap2-bin
#添加一个组,名字为 wireshark ..我执行时,提示已经存在相同名字的组了
sudo groupadd wireshark  
#把自己当前的用户名添加到 wireshark组
sudo usermod -a -G wireshark YOUR-USER-NAME
newgrp wireshark
#修改组别
sudo chgrp wireshark /usr/bin/dumpcap
#添加执行权限
sudo chmod 754 /usr/bin/dumpcap
#下面两句执行其中一句就可以了,我执行的是第一句
sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap

一些问题

grub手动引导

ls
ls (hd1,gpt1)/
set root=(hd1,gpt2)
set prefix=(hd1,gpt2)/boot/grub
normal

视频剪辑

  • Kdenlive
  • Arctime 字幕
  • pyTranscriber (语音生成字幕)
  • avidenmux砍柴
  • openshot剪辑
  • blender
  • DaVinci (需要libcuda)
  • Flowblade
  • lightworks
  • shotcut
  • aegisub字幕:sudo apt install aegisub aegisub-l10n

安装chrome并走代理 google-chrome-stable --proxy-server="http://example.com:8080"

@2niuhe
Copy link
Author

2niuhe commented Nov 27, 2020

mpv播放器配置保留历史记录
vim .config/mpv/mpv.conf
添加
save-position-on-quit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment