最近一段時間都在折騰Docker,發現一件很有意思的事情,在Docker Hub中,很多鏡像(image)的Dockerfile的FROM寫的都是debian:jessiebuildpack-deps:jessie。結合目前的外文資料,都是以Ubuntu作爲實驗系統,綜合考慮,準備開始學習使用Debian,最新釋出的是Debian 8.5(Jessie)。

因此前沒有使用過Debian系的發行版,此次安裝略帶 吃螃蟹 的意味。本文主要分爲3部分:系統安裝,系統配置,軟件安裝。

Preparation

  1. Debian官網下載系統鏡像
  2. U盤(通過U盤安裝系統)
  3. 查看安裝文檔——Debian GNU/Linux Installation Guide

Create Bootable USB Drive

因本人之前使用的是CentOS7,無法安裝諸如UltraISO,PowerISO之類的刻錄軟件,印象中dd命令可用於系統刻錄。

參考 * Writing an image onto the USB key * How do I write a CD/DVD/BD image to a USB flash drive? * Creating Debian Wheezy Installation USB Stick

fdisk

查看分區

[root@raxtone lemp]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048      4196351      2G  EFI System      EFI System Partition
 2      4196352     12584959      4G  Microsoft basic
 3     12584960    555294719  258.8G  Linux LVM       
 4    555294720    974723071    200G  Microsoft basic Basic data partition

Disk /dev/mapper/centos-root: 273.6 GB, 273569284096 bytes, 534315008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/centos-swap: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 16.1 GB, 16131293184 bytes, 31506432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xcad4ebea

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb4   *         256    31506431    15753088    7  HPFS/NTFS/exFAT

注意: 此處的U盤所在分區是/dev/sdb,而非/dev/sdb4,燒錄時需指定U盤分區路徑/dev/sdb

dd

使用dd命令燒錄

[root@raxtone lemp]# dd if=/home/lemp/Downloads/debian-8.5.0-amd64-DVD-1.iso of=/dev/sdb bs=4M;sync
952+0 records in
952+0 records out
3992977408 bytes (4.0 GB) copied, 320.076 s, 12.5 MB/s
[root@raxtone lemp]# umount /dev/sdb4
[root@raxtone lemp]# umount /dev/sdb
umount: /dev/sdb: not mounted
[root@raxtone lemp]#

X11 Forwarding Vis SSH

通過ssh調用遠程主機中的GUI圖形化界面

Remote Host

目標主機(Remote)配置

# /etc/ssh/sshd_config
AllowTcpForwarding yes
X11Forwarding yes

重啓sshd服務後,建議再執行一次命令

startx

Local Host

本地主機(Local)配置

在用戶家目錄~/.bashrc中添加

export DISPLAY=:0.0

注意:如果目標主機(Remote)的~/.bashrc中存在該指令,須註釋掉,否則無法正常啓用GUI。

使用方法

ssh -Y remoteUser@remoteHost -p remotePort

初次連接時會提示

/usr/bin/xauth: file /home/remoteUser/.Xauthority does not exist

該文件會自動創建,無須擔心。

Rsync Synchronizing

通過rsync命令進行文件同步、備份,分別在本機和遠程主機中進行。命令使用參考Rsync(Remote Sync): 10 Practical Examples of Rsync Command in Linux

通過計劃任務(cron)進行定時操作,備份用戶家目錄/home/flying。注意目標路徑的owner,使用ssh進行文件傳輸時須指定ssh key。

# 備份至本機目錄 /opt/Backup/
*/10 * * * * rsync --bwlimit=1024 -avz --delete /home/flying /opt/Backup/

# 備份至遠程主機ThinkPad的目錄 /usr/local/src/Backup/
*/30 */2 * * * rsync --bwlimit=800 --delete -avze "ssh -i /home/flying/.ssh/id_ed25519" /home/flying ThinkPad:/usr/local/src/Backup/

System Installation

系統安裝過程中,可利用Debian提供的截圖功能截圖,圖片存儲路徑爲/var/log/installer

分區過程與CentOS7不太一樣,每一個參數項都需自行設置。

安裝過程截圖已存儲在Google Drive中,訪問鏈接

System Configuration

鎖屏快捷按鈕

Desktop Command
Cinnamon Ctrl + Alt + L
GNome Command(Win) + L

sudo privileges

爲普通用戶(如sudo)添加sudo權限,且不需要密碼

lemp@LempStacker:~$ su root
Password:
root@LempStacker:/home/lemp# which sudo
/usr/bin/sudo
root@LempStacker:/home/lemp# file /etc/sudoers
/etc/sudoers: C source, ASCII text
root@LempStacker:/home/lemp# vi /etc/sudoers
root@LempStacker:/home/lemp# ls -lh /etc/sudoers
-r--r----- 1 root root 694 Jun 14 17:31 /etc/sudoers
root@LempStacker:/home/lemp#

在文件/etc/sudoers添加如下信息:

lemp    ALL=NOPASSWD:ALL

退出重新登錄即可。

change timezone

更改系統時區,此處設置爲Asia/Shanghai

sudo timedatectl set-timezone Asia/Shanghai
#or
sudo bash -c 'echo "Asia/Shanghai" > /etc/timezone'
sudo dpkg-reconfigure -f noninteractive tzdata &> /dev/null

/etc/hosts

修改hosts文件,數據來自racaljk/hosts,如何從GitHub下載單個文件,可參考本人的Use Script Download Single File From GitHub

lemp@LempStacker:~$ sudo cp -pv /etc/hosts{,.bak}
‘/etc/hosts’ -> ‘/etc/hosts.bak’
lemp@LempStacker:~$ sudo vi /etc/hosts
lemp@LempStacker:~$ service network restart
bash: service: command not found
lemp@LempStacker:~$ sudo service network restart
Failed to restart network.service: Unit network.service failed to load: No such file or directory.
lemp@LempStacker:~$ sudo /etc/init.d/networking restart
[ ok ] Restarting networking (via systemctl): networking.service.
lemp@LempStacker:~$

重啓network服務也可使用

sudo systemctl restart networking.service
#or
sudo systemctl restart NetworkManager

網絡相關設置可閱讀官方文檔 Chapter 5. Network setup

repository

Debian使用Apt作爲包管理工具,而包的列表信息存儲在文件/etc/apt/sources.list中。此處使用163的Debian镜像

先備份該文件

sudo cp -pv /etc/apt/sources.list{,.bak}

然後在文件/etc/apt/sources.list中寫入如下信息

deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib

保存後,執行

sudo apt-get update

即可更新包列表信息。

Software Installation

系統安裝完成後結合自己之前使用CentOS7的經驗,安裝一些常用的應用程序

Update System

更新/etc/apt/sources.list信息後,執行如下命令更新系統

sudo apt-get update
sudo apt-get dist-upgrade

bash-completion

Debian默認未安裝Tab命令自動補全功能,日常操作較爲不便,可通過安裝bash-completion解決。

apt-cache search -n bash-completion
apt-cache show bash-completion

sudo apt-get install -y bash-completion

Vim Editor

安裝Vim文本編輯器,執行如下操作

sudo apt-get install vim

注意: vim配置文件在CentOS7中是/etc/vimrc,而在Debian Jessie中是/etc/vim/vimrc

在文件/etc/vim/vimrc中添加配置參數,對全局用戶生效

sudo tee -a /etc/vim/vimrc <<-'EOF'

" lempstacker custom configuration

set encoding=utf-8    " specify encoding
set fileformats=unix,dos,mac    " specify file formats
syntax enable    " enable syntax highlighting
syntax on     " syntax highlight

set ai    " set autoindent ,set auto indent
set si    " set smartindent, set smart indent
set wrap
set smarttab    " be smart when using tabs

" 1 tab == 4 spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4

set backspace=2

" disable auto backup
set nobackup
set nowb
set noswapfile

set autoread    "auto read when file is changed from the outside
set ignorecase    "ignore case when searching
set smartcase    "enable smart-case search

"set fileformat    " check file format
"set list/nolist    " check hidden character

"set hlsearch/nohlsearch    "highlight search results
"set incsearch    " make search act like search in modern browsers

set paste "turning off auto indent when pasting text into vim
EOF

具體配置過程參見本人Blog VIM Editor Configuration

Chrony

chrony用於設置計算機時鐘,與互聯網上的時鐘服務器同步。

執行如下命令安裝

apt-cache search -n chrony
sudo apt-get install chrony
systemctl start chrony
systemctl enable chrony

命令timedatectl可查看系統時間信息

lemp@LempStacker:~$ timedatectl
      Local time: Sat 2016-06-18 08:57:31 CST
  Universal time: Sat 2016-06-18 00:57:31 UTC
        RTC time: Sat 2016-06-18 00:57:30
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
lemp@LempStacker:~$

Input Method

安裝中文輸入法可通過ibusfcitx框架實現。

Via ibus

使用ibus(Intelligent Input Bus)作為輸入法框架。可通過如下命令查看相關軟件包的名稱

sudo apt-cache search -n ^ibus | awk '{print $1}'

查詢結果如下

flying@lempstacker:~$ apt-cache search -n ^ibus | awk '{print $1}'
ibus
ibus-dbg
ibus-doc
ibus-gtk
ibus-gtk3
ibus-wayland
ibus-anthy
ibus-anthy-dev
ibus-array
ibus-cangjie
ibus-chewing
ibus-chewing-dbg
ibus-clutter
ibus-hangul
ibus-input-pad
ibus-kkc
ibus-kkc-dbg
ibus-libpinyin
ibus-libthai
ibus-libzhuyin
ibus-libzhuyin-dbg
ibus-m17n
ibus-pinyin
ibus-qt4
ibus-rime
ibus-sharada-braille
ibus-skk
ibus-sunpinyin
ibus-table
ibus-table-array30
ibus-table-cangjie
ibus-table-cangjie-big
ibus-table-cangjie3
ibus-table-cangjie5
ibus-table-cantonese
ibus-table-cantonhk
ibus-table-easy
ibus-table-easy-big
ibus-table-erbi
ibus-table-erbi-qs
ibus-table-jyutping
ibus-table-quick
ibus-table-quick-classic
ibus-table-quick3
ibus-table-quick5
ibus-table-scj6
ibus-table-stroke5
ibus-table-wu
ibus-table-wubi
ibus-table-yong
ibus-table-extraphrase
ibus-table-cns11643
ibus-table-compose
ibus-table-emoji
ibus-table-ipa-x-sampa
ibus-table-latex
ibus-table-rustrad
ibus-table-thai
ibus-table-translit
ibus-table-translit-ua
ibus-table-viqr
ibus-table-yawerty
ibus-tegaki
ibus-unikey
ibus-mozc
flying@lempstacker:~$

推薦使用RIME | 中州韻輸入法引擎,具體安裝說明見RimeWithIBus

也可選擇ibus-pinyinibus-cangjieibus-sunpinyin等輸入法。

執行如下命令進行安裝

sudo apt-get install -y ibus-rime ibus-pinyin ibus-cangjie ibus-sunpinyin

安裝完成後執行如下命令配置ibus


sudo ibus-setup

出現提示信息 >The IBus daemon is not running. Do you wish to start it?

選擇Yes後出現如下提示信息 >IBus has been started! If you cannot use IBus, add the following lines to your $HOME/.bashrc; then relog into your desktop. export GTK_IM_MODULE=ibus export XMODIFIERS=@im=ibus export QT_IM_MODULE=ibus

IBus Preferences窗口中選Input Method選項卡,點擊Add按鈕,選擇Chinese,可看到已經安裝的輸入法,選擇需要的輸入法,點擊Add添加。

在窗口左上角的Applications中找到Settings(通常在System Tools中),打開All Settings窗口後,找到Region&Language圖標點擊進去,在Input Reources下方點+(加號),點擊More(三個豎點那欄),在其中搜索chinese,可列出已安裝的中文輸入法。

此處選擇Chinese(Rime),點擊窗口右上角的Add按鈕進行添加。操作完成後即可在桌面右上角看到輸入法圖標,可點擊進行切換。也可通過按鍵Super+Space(Win鍵+空格鍵)進行輸入法的切換。

Rime輸入法支持多種輸入方案,可通過如下方式進行切換 1. 功能鍵F4 2. 組合按鍵Ctrl+` (鍵盤左上角的反引號)

:可能需要退出重新登入系統才能使用。

Via Fcitx

參考Fcitx官方文檔,依次執行如下操作

# 安裝fcitx及rime
sudo apt-get install fcitx fcitx-rime -y

# 選擇input method
im-config

# 點符號 + 添加rime,取消勾選 Only Show Current Language後查詢
fcitx-config-gtk3

# 重啓fcitx
fcitx -r

退出當前登錄狀態,重新登錄。通過組合按鍵Ctrl+Space啓用Rime輸入法,通過按鍵L Shift臨時切換輸入法。

Mplayer

安裝視頻播放器

# 移除默認的播放器
sudo apt-get purge totem

# 搜索安裝包
sudo apt-cache search -n mplayer

# 安裝Mplayer播放器
sudo apt-get install mplayer2

Google Chrome Browser

Google Chrome官方網站下載.deb的安裝包。下載連接爲https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

使用dpkg命令安裝

lemp@LempStacker:~/Downloads$ sudo dpkg -i google-chrome-stable_current_amd64.deb
(Reading database ... 141502 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (51.0.2704.84-1) over (51.0.2704.84-1) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
 google-chrome-stable depends on libappindicator1; however:
  Package libappindicator1 is not installed.
 google-chrome-stable depends on libcurl3; however:
  Package libcurl3 is not installed.

dpkg: error processing package google-chrome-stable (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
 google-chrome-stable
lemp@LempStacker:~/Downloads$

提示缺少libappindicator1libcurl3,執行apt-get dist-upgrade解決依賴關係

lemp@LempStacker:~$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 google-chrome-stable : Depends: libappindicator1 but it is not installed
                        Depends: libcurl3 but it is not installed
E: Unmet dependencies. Try using -f.
lemp@LempStacker:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libappindicator1 libcurl3 libdbusmenu-glib4 libdbusmenu-gtk4 libindicator7
Recommended packages:
  indicator-application
The following NEW packages will be installed:
  libappindicator1 libcurl3 libdbusmenu-glib4 libdbusmenu-gtk4 libindicator7
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 558 kB of archives.
After this operation, 1,238 kB of additional disk space will be used.
Do you want to continue? [Y/n]

再次安裝嘗試

lemp@LempStacker:~$ sudo dpkg -i /home/lemp/Downloads/google-chrome-stable_current_amd64.deb
(Reading database ... 141544 files and directories currently installed.)
Preparing to unpack .../google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (51.0.2704.84-1) over (51.0.2704.84-1) ...
Setting up google-chrome-stable (51.0.2704.84-1) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for man-db (2.7.0.2-5) ...
lemp@LempStacker:~$

在GNome Desktop環境中,/usr/bin/x-www-browser用於設置系統默認瀏覽器,以下是Google Chrome在安裝過程中的配置記錄

update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode

Google Chrome的配置文件(如登錄信息、設置、插件等)目錄爲

~/.config/google-chrome

安裝成功後,即可在Menu菜單中找到Google Chrome應用程序(通常是Applications->Internet)。

Atom Editor

代碼編輯器使用Atom,在官網首頁或GitHub Release頁面下載.deb安裝包。

lemp@LempStacker:~$ ls -lh ~/Downloads/atom-amd64.deb
-rw-r--r-- 1 lemp lemp 76M Jun 14 21:58 /home/lemp/Downloads/atom-amd64.deb
lemp@LempStacker:~$ sudo dpkg -i ~/Downloads/atom-amd64.deb
(Reading database ... 144657 files and directories currently installed.)
Preparing to unpack .../lemp/Downloads/atom-amd64.deb ...
Unpacking atom (1.8.0) over (1.8.0) ...
dpkg: dependency problems prevent configuration of atom:
 atom depends on git; however:
  Package git is not installed.
 atom depends on gvfs-bin; however:
  Package gvfs-bin is not installed.

dpkg: error processing package atom (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Errors were encountered while processing:
 atom
lemp@LempStacker:~$

報錯提示缺少gitgvfs-bingit手動安裝,待git安裝完成後,再執行如下命令:

sudo apt-get dist-upgrade
sudo dpkg -i ~/Downloads/atom-amd64.deb

Atom安裝完成後的配置及插件安裝,參見本人Blog —— Install and Configure Atom Editor

Git

具體安裝及配置,可參考本人Blog —— Compile Install And Configure Git On CentOS7

VirtualBox

虛擬機軟件,在官網https://www.virtualbox.org/下載Debian 8 ("Jessie").deb安裝包,使用dpkg命令安裝。

lemp@LempStacker:~$ ls -lh ~/Downloads/virtualbox-5.0_5.0.20-106931-Debian-jessie_amd64.deb
-rw-r--r-- 1 lemp lemp 60M Jun 14 22:45 /home/lemp/Downloads/virtualbox-5.0_5.0.20-106931-Debian-jessie_amd64.deb
lemp@LempStacker:~$ sudo dpkg -i ~/Downloads/virtualbox-5.0_5.0.20-106931-Debian-jessie_amd64.deb
Selecting previously unselected package virtualbox-5.0.
(Reading database ... 147151 files and directories currently installed.)
Preparing to unpack .../virtualbox-5.0_5.0.20-106931-Debian-jessie_amd64.deb ...
Unpacking virtualbox-5.0 (5.0.20-106931~Debian~jessie) ...
dpkg: dependency problems prevent configuration of virtualbox-5.0:
 virtualbox-5.0 depends on libqt4-opengl (>= 4:4.7.2); however:
  Package libqt4-opengl is not installed.

dpkg: error processing package virtualbox-5.0 (--install):
 dependency problems - leaving unconfigured
Processing triggers for systemd (215-17+deb8u4) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Errors were encountered while processing:
 virtualbox-5.0
lemp@LempStacker:~$

參考Debian官方文檔VirtualBox,執行如下命令:

sudo apt-get update
sudo apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox-dkms

再次進行安裝嘗試

lemp@LempStacker:~$ sudo dpkg -i ~/Downloads/virtualbox-5.0_5.0.20-106931-Debian-jessie_amd64.deb
(Reading database ... 161932 files and directories currently installed.)
Preparing to unpack .../virtualbox-5.0_5.0.20-106931-Debian-jessie_amd64.deb ...
Unpacking virtualbox-5.0 (5.0.20-106931~Debian~jessie) ...
Setting up virtualbox-5.0 (5.0.20-106931~Debian~jessie) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modules ...done.
Removing old VirtualBox pci kernel module ...done.
Trying to register the VirtualBox kernel modules using DKMS ...done.
Starting VirtualBox kernel modules ...done.
Processing triggers for systemd (215-17+deb8u4) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
lemp@LempStacker:~$

注意: 在文檔中有如下文字

VirtualBox can now be started. To not load the VirtualBox modules at system startup, edit /etc/default/virtualbox and set LOAD_VBOXDRV_MODULE to 0.

如果不想在系統啓動時加載VirtualBox模塊,可對指定文件進行參數設置。

Vagrant

Vagrant是一款可創建(build)完整開發環境的工具,具體使用可參考本人的Blog —— LempStacker - Vagrant

下載頁面 https://www.vagrantup.com/downloads.html

lemp@LempStacker:~$ ls ~/Downloads/vagrant_1.8.4_x86_64.deb
/home/lemp/Downloads/vagrant_1.8.4_x86_64.deb
lemp@LempStacker:~$ sudo dpkg -i ~/Downloads/vagrant_1.8.4_x86_64.deb
Selecting previously unselected package vagrant.
(Reading database ... 162706 files and directories currently installed.)
Preparing to unpack .../vagrant_1.8.4_x86_64.deb ...
Unpacking vagrant (1:1.8.4) ...
Setting up vagrant (1:1.8.4) ...
lemp@LempStacker:~$

Docker

Docker是一款基於Linux Lernel的容器產品,具體安裝步驟見Docker官方文檔Debian

以下是相關操作命令

sudo apt-get install apt-transport-https ca-certificates

sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

sudo tee /etc/apt/sources.list.d/docker.list <<-'EOF'
deb https://apt.dockerproject.org/repo debian-jessie main
EOF

sudo apt-get update
sudo apt-get install docker-engine

sudo service docker start
或
sudo systemctl status docker
sudo systemctl start docker

sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo systemctl restart docker

sudo apt-get upgrade docker-engine

Docker的具體使用,可參考本人Blog —— LempStacker-Docker

Remove Unneeded Packages

桌面GNome中默認安裝了多款遊戲,需將其移除。在Debian Stretch中安裝了如下遊戲

gnome-taquin gnome-tetravex gnome-sudoku gnome-mahjongg gnome-nibbles gnome-robots gnome-klotski lightsoff gnome-chess quadrapassel swell-foop four-in-a-row hitori gnome-mines five-or-more iagno tali

操作命令如下

# method 1
grep Game /usr/share/applications/*.desktop | awk -F: '{!a[$1]++}END{for(i in a) print i}' | while read -r line;do sed -r -n '/Exec/{s@.*=([^[:space:]]+).*@\1@g;p}' "${line}" | awk '{!a[$0]++}END{print}'; done | xargs -- sudo apt-get purge -yq

# method 2, $packlist切勿用雙引號包裹
packlist=$(grep Game /usr/share/applications/*.desktop | awk -F: '{!a[$1]++}END{for(i in a) print i}' | while read -r line;do sed -r -n '/Exec/{s@.*=([^[:space:]]+).*@\1@g;p}' "${line}" | awk '{!a[$0]++}END{print}'; done | sed ':a;N;s@\n@ @g;t a;')

sudo apt-get purge -yq $packlist

在OpenSUSE中,執行

# sol --> aisleriot
grep Game /usr/share/applications/*.desktop | awk -F: '{!a[$1]++}END{for(i in a) print i}' | while read -r line;do sed -r -n '/Exec/{s@.*=([^[:space:]]+).*@\1@g;p}' "${line}" | awk '{if($0=="sol"){$0="aisleriot"};!a[$0]++}END{print}'; done | xargs -- sudo zypper rm -yu

References

Input Method

Change Logs

  • 2016.06.17 11:30 Fri Asia/Shanghai
    • 初稿完成
  • 2016.06.18 08:58 Sat Asia/Shanghai
    • 添加Chrony
  • 2016.08.27 12:23 Sat Asia/Shanghai
    • 更新Docker安裝命令、添加Mplayer
  • 2016.12.29 10:17 Thu Asia/Shanghai
    • 更新輸入法Input Method的操作過程
  • 2017.01.31 13:39 Tue America/Boston
    • 添加Google Chrome自動配置x-www-browser過程
  • 2017.02.01 11:02 Wed America/Boston
    • 添加bash-completion實現終端命令自動補全
  • 2017.02.10 13:43 Fri Asia/Shanghai
    • 添加通過fcitx安裝輸入法
  • 2017.07.10 10:32 Mon Asia/Shanghai
    • 添加Rsync Synchronizing進行目錄備份
  • 207.07.10 11:26 Mon Asia/Shanghai
    • 添加Remove Unneeded Packages移除GNome遊戲