前言
本文主要介紹kali linux rolling版安裝后的通用配置。包括網絡優化,系統更新,顯卡驅動安裝,亂碼問題解決方案,常用工具軟件安裝,鍵盤燈配置等。當前kali版本為2018.7,文章隨時更新。
update:2019-04-08 17:24:40
一、 網絡優化
更換host
wget https://raw.githubusercontent.com/googlehosts/hosts/master/hosts-files/hosts -O /etc/hosts
更換dns
domain
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 9.9.9.9
當前版本不能直接編輯/etc/resolv.conf
,需通過 resolvconf
命令配置,最多可指定3個DNS服務器。
sudo vi /etc/resolvconf/resolv.conf.d/head #另外還有base、tail幾個文件可選
sudo service resolvconf restart #手動重啟服務
sudo update-rc.d resolvconf enable #設為開機啟動
#可以通過如下方式驗證是否生效
cat /etc/resolv.conf
添加源
kali rolling現在的官方源會“智能”跳轉到國內源,但速度實在不敢恭維。下面提供幾個源地址,挑選一個最快的寫到 /etc/apt/sources.list
里面。
#官方源
deb http://http.kali.org/kali kali-rolling main contrib non-free
# For source package access, uncomment the following line
# deb-src http://http.kali.org/kali kali-rol3ling main contrib non-free
#浙大
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
#東軟
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
# 阿里雲
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb http://mirrors.aliyun.com/kali-security kali-rolling/updates main contrib non-free
deb-src http://mirrors.aliyun.com/kali-security kali-rolling/updates main contrib non-free
# 中科大
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/kali-security kali-current/updates main contrib non-free
如何判斷哪個快?ping……
二、 更新系統
apt-get update -y && apt-get dist-upgrade -y
#reboot
apt-get install linux-headers-$(uname -r)
#reboot
有兩處建議重啟下,如果結束后提示--fix-missing相關字樣,按照提示再運行一次,apt-get dist-upgrade --fix-missing -y
。有些內容需要手動確認,根據實際情況按q,或者挪動方向鍵回車。
如果apt-get update
出現GPG Error – Key Expired
,需要更新一下gpg key。
wget https://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2018.1_all.deb
sudo dpkg -i kali-archive-keyring_2018.1_all.deb
- 方案二
sudo apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 7D8D0BF6
- 方案三
wget -q -O - https://archive.kali.org/archive-key.asc |sudo apt-key add
三 、安裝N卡驅動
網上關於"KALI LINUX NVIDIA顯卡驅動"的帖子五花八門,踩了無數坑之后,才意識到RTFM的重要性。安裝方法其實很簡單,直接按照官方文檔進行操作,GTX1070親測有效。個別地方有小變動,但不影響安裝。
注意幾點:glxinfo需要手動安裝,安裝命令是:sudo apt-get install mesa-utils
;查看是否開啟渲染:glxinfo| grep -i "direct rendering"
;查看屏幕fps:glxgears
;
四、修復 add-apt-repository
根據官方的說法,由於kali是針對滲透測試進行了高度定制化的系統,采用add-apt-repository這種方式安裝第三方軟件容易導致系統不穩定。在漫長的源碼編譯和快速安裝之間,總要有個取舍。自帶的add-apt-repository是用python3寫的,運行時各種報錯。下面代碼算是add-apt-repository命令的另一個版本的源碼,可以寫成腳本替換/usr/bin/add-apt-repository
。
#!/bin/bash
if [ $# -eq 1 ]
NM=`uname -a && date`
NAME=`echo $NM | md5sum | cut -f1 -d" "`
then
ppa_name=`echo "$1" | cut -d":" -f2 -s`
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu oneiric main " >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/${NAME}_apt_add_key.txt
key=`cat /tmp/${NAME}_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3`
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/${NAME}_apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
五、安裝常用軟件
安裝apt自帶的包
-
normal
sudo apt-get install apt-file aptitude remmina blender audacity smplayer vlc fcitx-rime filezilla cheese screengrab conky conky-manager cairo-dock gimp cmus qmmp sandi zeal deluge rarcrack terminator dos2unix python-mutagen dia ghex thunderbird gnome-screenshot putty* calibre kchmviewer transmission gnome-clocks translate-shell meld
-
environment
sudo apt-get install android* androguard strace virtualbox
-
secure
sudo apt install network-manager-openvpn-gnome libappindicator3-1 network-manager-pptp network-manager-pptp-gnome network-manager-strongswan network-manager-vpnc network-manager-vpnc-gnome telegram-desktop
-
other
wxhexeditor
安裝第三方的deb包
#大體流程如下
sudo dpkg -i xxx.deb
# sudo apt-get install -f #如果出現依賴缺失,執行這個從源里面下載。
# 如果源里面沒有指定包,去debian網站上下載。為保證系統穩定,千萬不要亂改自己的sources.list。
搜狗輸入法
需要事先准備如下幾個文件:libqt5webkit5_5.212.0_alpha2-9_amd64.deb、fcitx-libs-qt_4.2.9.1-6_all.deb、sogoupinyin_2.2.0.0102_amd64.deb
> sudo apt-get install fcitx #搜狗基於fcitx,需要先裝好。
#如果此時直接dpkg安裝sogoupinyin.deb會報依賴問題,去debian官網找到對應的依賴包,手動安裝。
> sudo dpkg -i libqt5webkit5_5.212.0_alpha2-9_amd64.deb
(Reading database ... 520377 files and directories currently installed.)
Preparing to unpack libqt5webkit5_5.212.0_alpha2-9_amd64.deb ...
Unpacking libqt5webkit5:amd64 (5.212.0~alpha2-9) over (5.212.0~alpha2-9) ...
dpkg: dependency problems prevent configuration of libqt5webkit5:amd64:
libqt5webkit5:amd64 depends on qtbase-abi-5-10-0; however:
Package qtbase-abi-5-10-0 is not installed.
libqt5webkit5:amd64 depends on qtdeclarative-abi-5-10-1; however:
Package qtdeclarative-abi-5-10-1 is not installed.
> sudo apt-get install -f
> sudo dpkg -i fcitx-libs-qt_4.2.9.1-6_all.deb
> sudo dpkg -i sogoupinyin_2.2.0.0102_amd64.deb
(Reading database ... 520388 files and directories currently installed.)
Preparing to unpack sogoupinyin_2.2.0.0102_amd64.deb ...
Unpacking sogoupinyin (2.2.0.0102) over (2.2.0.0102) ...
Setting up sogoupinyin (2.2.0.0102) ...
Processing triggers for mime-support (3.61) ...
Processing triggers for gnome-menus (3.13.3-11) ...
Processing triggers for desktop-file-utils (0.23-3) ...
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for libglib2.0-0:amd64 (2.56.1-2) ...
No such key 'Gtk/IMModule' in schema 'org.gnome.settings-daemon.plugins.xsettings' as specified in override file '/usr/share/glib-2.0/schemas/50_sogoupinyin.gschema.override'; ignoring override for this key.
Processing triggers for hicolor-icon-theme (0.17-2) ...
安裝后需要重啟一次系統,然后在fcitx面板中配置輸入法順序。
如果配置好后無法啟動搜狗輸入法,找到搜狗輸入法的這個配置文件:
$ find /usr -name 50_sogoupinyin.gschema.override
/usr/share/glib-2.0/schemas/50_sogoupinyin.gschema.override
查看文件內容
$ cat /usr/share/glib-2.0/schemas/50_sogoupinyin.gschema.override
[org.gnome.settings-daemon.plugins.keyboard]
active=false
[org.gnome.settings-daemon.plugins.xsettings]
Gtk/IMModule=fcitx
[com.canonical.indicator.keyboard]
visible=false
修改成如下內容
[org.gnome.settings-daemon.plugins.keyboard]
active=false
[org.gnome.settings-daemon.plugins.xsettings]
overrides={'Gtk/IMModule':<'fcitx'>}
[com.canonical.indicator.keyboard]
visible=false
經過驗證,從官網下載的皮膚在linux下通用。不同的是,linux版的候選字無法豎屏顯示。此外,linux版的搜狗輸入法沒有廣告、彈窗、也沒有占CPU內存的sougou_cloud.exe。其實仔細想想不難發現,對搜狗來說,單單是開發linux版的輸入法就已經耗費人力財力了,linux用戶又不多,再開發一堆垃圾彈窗雲服務實在是得不償失。wps同理。
網易雲音樂
自帶源版本 sudo apt-get install netease-cloud-music
官網版本V1.1.0 ubuntu下載https://music.163.com/#/download
sudo dpkg -i netease_xxx_xxx.deb
sudo apt-get install -f
# 執行以下命令啟動:
unset SESSION_MANAGER && netease-cloud-music &
#可以在cairo中新建啟動器,輸入上面的命令。
安裝后無法啟動的具體原因及解決方案:
https://www.zhihu.com/question/277330447/answer/478510195
安裝WPS
sudo dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb #https://packages.debian.org/jessie/amd64/multiarch-support/download
sudo dpkg -i libpng12-0_1.2.50-2+deb8u3_amd64.deb #https://packages.debian.org/jessie/libpng12-0
sudo dpkg -i wps-office_10.1.0.5707~a21_amd64.deb #http://wps-community.org/downloads
由於版權原因,一些字體wps沒有內置,初次啟動時會提示部分字體缺失。github上有人整理了一份,可以從這里下載安裝:https://github.com/rains31/ttf-wps-fonts
- wingide
sudo dpkg -i wingide6_6.1.0-1_amd64.deb
sudo apt install libpango1.0-0
sudo apt --fix-broken install
安裝完成后,嘿嘿嘿……
安裝tgz的包
- 為知筆記compile/綠色版
Ubuntu 18.04 下運行前,請先執行 sudo apt install openssl1.0 libssl1.0-dev ,再雙擊運行綠色版
推薦使用 ibus 輸入法 - eclipse-adt
- 安裝python常用庫
編譯安裝github包
以MakeHuman為例
官網:
源碼:https://github.com/makehumancommunity/makehuman
貼吧:https://tieba.baidu.com/f?kw=makehuman
安裝步驟:
#初始化安裝環境
sudo apt-get install python3-numpy python3-opengl python3-pyqt5 python3-pyqt5.qtsvg #
#python3-pyqt5.opengl這個包找不到,這里先略過
#下載源代碼
git clone https://github.com/makehumancommunity/makehuman.git
cd makehuman/makehuman/
python3 download_assets_git.py
#安裝 git-lfs,參考:https://packagecloud.io/github/git-lfs/packages/ubuntu/vivid/git-lfs_2.5.1_amd64.deb
# wget --content-disposition https://packagecloud.io/github/git-lfs/packages/debian/jessie/git-lfs_2.5.1_amd64.deb/download.deb
# sudo dpkg -i git-lfs_2.5.1_amd64.deb
# git lfs install
python3 download_assets_git.py
python3 compile_models.py
python3 compile_proxies.py
python3 compile_targets.py
#啟動應用
./makehuman
#如果無法啟動,執行如下命令
# sudo apt-get install python python-numpy python-opengl python-qt4 python-qt4-gl
#sudo apt-get install python-opengl python3-opengl python3-qt*
#遺留問題:python3-pyqt5.opengl這個包找不到,opengl模式開啟失敗,但不影響基本使用。
以上注釋部分為安裝時遇到的依賴問題,如果遇到,就執行其中代碼。
- 安裝頂部擴展插件
用火狐打開https://extensions.gnome.org/
命令行版:gsettings list-recursively |grep "org.gnome.shell.extensions"
- 破解一些東東
- webstorm系列,數據庫,
雲服務器... - sublime http://xxx.com
- sudo cp winewrapper.exe.so /opt/cxoffice/lib/wine/
- wing
- webstorm系列,數據庫,
easyconnect配置
- 安裝前后可能遇到的問題
- 修復add-repository
- 開啟32位架構支持
sudo dpkg --add-architecture i386
- USB devices are not recognized in Virtualbox Linux host
sudo adduser $USER vboxusers
- dpkg 資源占用問題
sudo rm /var/lib/dpkg/lock
- 注意關機前一定要把lantern退出,不然再次開機聯網會出現非常奇怪的問題.有時間寫個關機監控腳本.
- chrome更新源問題
-apt-file search xx.so/aptitude search xxx
sudo rm /etc/apt/sources.list.d/chrome-remote-desktop.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt update
sudo apt upgrade
#In case you still have problems with the update process, check the /etc/apt/sources.list file and remove any Google entry that may exist by executing sudo nano /etc/apt/sources.list
六、參考資料
https://yq.aliyun.com/articles/233823#
https://www.ithome.com/html/it/353590.htm
https://www.linuxidc.com/Linux/2014-05/102206.htm
http://tieba.baidu.com/p/4348516267#