Ubuntu安裝的一些配置
NVIDIA顯卡問題
有時候N卡驅動會出現一些問題(比如開機黑屏,開機循環登陸等)
第一次啟動可以按e編輯grub,然后在"quiet splash"后面加上"nouveau.modeset=0 intel_idle.max_cstate=1", 形成如GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0 intel_idle.max_cstate=1"。進入系統后再去編輯grub文件,不然每次我們都要開機的時候修改。
sudo vim /etc/default/grub, 然后修改成GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0 intel_idle.max_cstate=1"即可,接着sudo update-grub
搜狗拼音的安裝
先在系統的language support里面補充完語言包
然后卸載ibus和它的配置, 卸載頂部面板的鍵盤指示
sudo apt remove ibus
sudo apt purge ibus
sudo apt remove indicator-keyboard
安裝fcitx並切換, 重啟生效
sudo apt install fcitx fcitx-config-gtk
im-config -n fcitx
sudo shutdown -r now
接下來安裝安裝搜狗拼音的deb包.鏈接:https://pinyin.sogou.com/linux/?r=pinyin
然后在fcitx的config里面添加輸入法,注意把Only Show Current Language給去掉,添加Sogou pinyin即可
PS: 安裝后若希望禁用Shift鍵切換中英文, 在搜狗拼音的設置面板里面按鍵--中英文切換--換成無
zsh安裝配置
sudo apt-get install zsh curl git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
然后注銷登錄
關於語法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.zsh-syntax-highlighting" --depth 1
echo "source $HOME/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> "$HOME/.zshrc"
ranger配置
安裝:pip install ranger-fm
初始化:ranger --copy-config=all
文件圖標插件:https://github.com/alexanderjeurissen/ranger_devicons
如果想要ranger高亮代碼文件,則需要sudo apt install highlight
更多ranger配置:https://github.com/ranger/ranger/wiki/Official-user-guide
多版本python
當存在2和3時,可以這樣修改
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --config python
參考鏈接https://stackoverflow.com/questions/41986507/unable-to-set-default-python-version-to-python3-in-ubuntu
pip配置
安裝最新版的pip時,會報錯,可以修改文件
➜ ~ cat /usr/bin/pip3
#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
#from pip import main
from pip._internal import main
if __name__ == '__main__':
sys.exit(main.main())
修改pip到清華源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
窗口管理器Regolith
# install
sudo add-apt-repository -y ppa:kgilmer/regolith-stable
sudo apt install regolith-desktop
# reboot
要先安裝i3-gaps 然后再復制配置文件過去,因為配置文件里啟動要用到這個
Polybar安裝配置
# 安裝依賴
# 如果還不行就根據提示安裝少的包
參考: https://github.com/polybar/polybar#building-from-source
https://github.com/polybar/polybar/wiki/Compiling#optional-dependencies1(依賴)
若有些模塊運行不出來,則用polybar example來看看哪些模塊啟動失敗,然后去查依賴,重新編譯運行.
dwm
寫在/usr/share/xsessions/dwm.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic window manager
Exec=dwm
Icon=dwm
Type=XSession
vim的coc插件安裝
需要安裝node
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
安裝ccls https://github.com/MaskRay/ccls/wiki/Build
編譯的時候會發現ld -lz 少了 lz , 安裝zlib1g-dev即可
然后把Release下編譯好的./ccls復制到/usr/local/bin即可
Gnome下交換swap和escape
采用 gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']"
或者 setxkbmap -option "caps:swapescape"
備用: 首先需要安裝dconf-tools, 然后打開,找到org>>gnome>>desktop>>input-sources, 自定義的值加入'caps:swapescape' 就OK
安裝字體
將字體移到/usr/share/fonts目錄下,然后執行sudo fc-cache -f -v
TIM and WeChat
主要還是https://github.com/wszqkzqk/deepin-wine-ubuntu項目
微信無法發送圖片sudo apt install libjpeg62:i386
調整字體大小WINEPERFIX=~/.deepinwine/Deepin-TIM /usr/bin/deepin-wine winecfg
關於字體的亂碼和修改, 首先下載msyh.ttc:鏈接
並安裝:sudo apt install fonts-wine fonts-wqy-microhei fonts-wqy-zenhei
然后
#1.添加字體
cp msyh.ttc ~/.deepinwine/Deepin-WeChat/drive_c/windows/Fonts
#2.修改系統注冊表
gedit ~/.deepinwine/Deepin-WeChat/system.reg
#修改以下兩行
"MS Shell Dlg"="msyh"
"MS Shell Dlg 2"="msyh"
#3.字體注冊
gedit msyh_config.reg
#內容添加
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="msyh.ttc"
"Microsoft Sans Serif"="msyh.ttc"
"MS Sans Serif"="msyh.ttc"
"Tahoma"="msyh.ttc"
"Tahoma Bold"="msyhbd.ttc"
"msyh"="msyh.ttc"
"Arial"="msyh.ttc"
"Arial Black"="msyh.ttc"
#注冊
WINEPREFIX=~/.deepinwine/Deepin-WeChat deepin-wine regedit msyh_config.reg
#4.reboot
TIM和WeChat的系統托盤,gnome下安裝這個插件
雙系統時間問題
執行sudo timedatectl set-local-rtc 1 --adjust-system-clock即可
ssh自動斷開問題
ssh容易自己斷開連接,需要在'~/.ssh/config'配置一下
Host *
ServerAliveInterval 60
Ubuntu server中文環境的語言包支持
因為買完服務器安裝完畢后,系統是英文版的,還不支持中文,需要我們自行配置。
1.安裝中文包:
sudo apt-get install language-pack-zh*
2.配置相關環境變量:
sudo vim /etc/environment
在文件中添加語言和編碼的支持
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
3.重新配置本地語言環境:
sudo dpkg-reconfigure locales
snap proxy
sudo snap set system proxy.http=http://127.0.0.1:3128
sudo snap set system proxy.https=http://127.0.0.1:3128
# system proxy
export https_proxy=http://127.0.0.1:12333
export http_proxy=http://127.0.0.1:12333
export http_proxy="socks5://127.0.0.1:1080"
export https_proxy="socks5://127.0.0.1:1080"
