Debian/Ubuntu === ###### tags: `debian` `ubuntu` `linux` `installation` ### 0.About UEFI and legacy BIOS - [Check if Your Computer Uses UEFI or BIOS](https://itsfoss.com/check-uefi-or-bios/) - [UEFI安装Win10/Ubuntu16.04双系统记录](https://medium.com/caesars-study-review-on-web-development/win10-and-ubuntu-雙系統安裝筆記-bc824bef7fb4 ) - [EFI partition](https://askubuntu.com/questions/1128810/no-efi-system-partition-option-for-ubuntu-18-10) [Linux磁區配置從頭開始 搞定MBR、GPT與UEFI](https://www.netadmin.com.tw/netadmin/zh-tw/technology/23D09E63D4CD46349410CDA0E36FC465?page=1) - [No EFI System Partition option for Ubuntu 18.10](https://askubuntu.com/questions/1128810/no-efi-system-partition-option-for-ubuntu-18-10 ) - [What does it mean to make a bootable LiveUSB?](https://askubuntu.com/questions/1125710/what-does-it-mean-to-make-a-bootable-liveusb/1125721#1125721) - [How to solve no efi partition was found error](https://linux-tips.com/t/how-to-solve-no-efi-partition-was-found-error/354) - [ubuntu diskspace](https://help.ubuntu.com/community/DiskSpace) - [No EFI System Partition option for Ubuntu 18.10](https://askubuntu.com/questions/1128810/no-efi-system-partition-option-for-ubuntu-18-10) - [Isohybrid](https://wiki.syslinux.org/wiki/index.php?title=Isohybrid) ### A. Debian Installaion [1.reference](https://www.debian.org/releases/stable/installmanual) [2.reference](https://www.debian.org/releases/stable/amd64/ch04s03.html.en#usb-copy-easy) [3.reference](https://www.youtube.com/watch?v=bB-gmnvYDao) 1. download a iso file and https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/ 2. insert USB FLASH DISK and cp the iso file ``` # cp debian.iso /dev/sdX # sync ``` 3. enter bios (Asus: press F2) and change the boot order ### B. Driver and Application(packages) Installation [reference](https://wiki.debian.org/DebianEzGo) - #### source list ``` deb http://ftp.debian.org/debian buster main contrib non-free deb-src http://ftp.debian.org/debian buster main contrib non-free ``` - #### fcitx [1.reference](https://www.itread01.com/p/1372099.html) [2.reference](https://www.cnblogs.com/OneFri/p/8308340.html) [3.reference](https://blog.csdn.net/wu58430/article/details/81117721) [4.debian official reference](https://wiki.debian.org/gnome-chinese-input#using_Fcitx) - fcitx相關packages基本上都已經預先安裝了 - sudo apt-get install fcitx-chewing - dpkg-reconfigure locales - 加入zh_TW.UTF-8 UTF-8 - ![](https://i.imgur.com/hmXnF1h.png) - 可以在application裡面找到企鵝圖示 - 新增chewing - apt-get remove fcitx-module-kimpanel 似乎一定要做? - im-config - 選fcitx - 登出再登入 &nbsp; &nbsp; &nbsp; - #### wifi [1.reference](https://blog.csdn.net/ACxlm/article/details/78249021) [2.reference](http://forums.debian.net/viewtopic.php?f=30&t=136212) - edit /etc/apt/sources.list ![](https://i.imgur.com/I1a3zWY.png) - sudo apt-get install firmware-iwlwifi - sudo apt-get install firmware-atheros &nbsp; &nbsp; &nbsp; - #### sublime [debian official reference](https://wiki.debian.org/SublimeText) - 執行 "wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -" 要記得wget要安裝 [reference](https://itsfoss.com/sublime-text-3-linux/) &nbsp; &nbsp; &nbsp; - #### beyond compare [reference](https://www.scootersoftware.com/download.php?zz=kb_linux_install) &nbsp; &nbsp; &nbsp; - #### shutter - sudo apt-get install shutter - 在debian9.9 shutter有太多dependencies或許太老舊了,無法安裝,直接使用xfce4-screenshooter - 全螢幕:xfce4-screenshooter -f - 區域:xfce4-screenshooter -r - 在setting->keybooard->application shortcuts頁籤,加入上述指令並選擇快捷鍵 - ![](https://i.imgur.com/lDpoq9K.png) - #### KolourPaint - sudo apt-get install kolourpaint &nbsp; &nbsp; &nbsp; - #### google chrome - [reference](https://linuxize.com/post/how-to-install-google-chrome-web-browser-on-debian-9/) &nbsp; &nbsp; &nbsp; - #### zoom [reference](https://support.zoom.us/hc/en-us/articles/204206269-Linux-Installation) 1. download .deb file 2. sudo dpkg -i xxx.deb &nbsp; &nbsp; &nbsp; - #### line - chrome plugin - https://chrome.google.com/webstore/detail/line/ophjlpahpchlmihnnnihgmmeilfjmjjc &nbsp; &nbsp; &nbsp; - #### telegram - chrome plugin - https://chrome.google.com/webstore/detail/desktop-messenger-for-tel/dafiggkhlbbhfcpgggcfeeoliillkabn - 缺點:無法顯示動畫,chrome要開著 - chrome app - https://chrome.google.com/webstore/detail/telegram/clhhggbfdinjmjhajaheehoeibfljjno/related - 缺點:無法顯示動畫 &nbsp; > 以下都是有問題的嘗試 > https://blog.mojxtang.com/121/ https://blog.xuite.net/rice.king/wretch/105402021-%E5%AE%89%E8%A3%9Ddebian+%E4%B8%AD%E6%96%87%E5%AD%97%E5%9E%8B https://blog.mojxtang.com/121/ https://justhodl.blogspot.com/2018/02/ubuntu-fedora-telegram-gcin-ibus.html https://www.pkstep.com/archives/13832 https://stackoverflow.com/questions/13046624/how-to-permanently-export-a-variable-in-linux https://www.addictivetips.com/ubuntu-linux-tips/use-and-install-flatpak/ 1. download from website and extract with command ``` tar xvf tsetup*.tar.xz ``` 2. download chinese fonts ``` sudo apt-get install fonts-arphic-* ``` 2. export FONTCONFIG_FILE=/etc/fonts/ > set the variable globally in /etc/profile or by creating a script for your variable in /etc/profile.d. 4. ./Telegram > 亂碼... &nbsp; &nbsp; &nbsp; - #### git - sudo apt-get install git - ssh key - [reference](https://help.github.com/en/articles/connecting-to-github-with-ssh) &nbsp; &nbsp; &nbsp; - #### calculator - sudo apt-get install gnome-calculator &nbsp; &nbsp; &nbsp; - #### vi+nerdtree+taglist+srcexpl - #### vim source insight [referece](https://www.itread01.com/p/168382.html) [referece](https://eeepage.info/tag-vim-source-insight/) [referece](https://ivan7645.github.io/2016/07/12/vim_to_si/) [SZ Lin](https://szlin.me/2016/03/15/%E6%89%93%E9%80%A0-vim-%E4%B8%8A%E7%9A%84-sourceinsight/) [referece](http://wiki.csie.ncku.edu.tw/vim/vimrc) [referece](https://magiclen.org/vimrc/) [referece](http://stenlyho.blogspot.com/2013/05/ctagsvim.html) [referece](http://yanbin.is-programmer.com/posts/84084.html) [referece](https://binresist.github.io/%E5%B7%A5%E5%85%B7%E5%AD%A6%E4%B9%A0/2017/06/28/vim-cscope.html) [referece](https://juejin.im/post/5c1fa6e4f265da6167205011) [referece](https://www.jianshu.com/p/3066b3191cb1) [referece](http://wen00072.github.io/blog/2018/02/15/vim-setup-for-trace-c-code/) [referece](http://yuanfarn.blogspot.com/2013/02/srcexpl-vim-source-explorer.html) - 安裝ctags ``` $sudo apt- get install ctags ``` - 找vimrc,在/etc/vim/vimrc(ubuntu16.04和debian9皆相同),這是for all user ![](http://imgur.com/8O15w4el.png) - 針對特定user的設定,手動touch ~/.vimrc,然後加入以下內容 ``` " ------ Vundle Settings ------- let iCanHazVundle=1 let vundle_readme=expand('~/.vim/bundle/vundle/README.md') if !filereadable(vundle_readme) echo "Installing Vundle.." echo "" silent !mkdir -p ~/.vim/bundle silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle let iCanHazVundle=0 endif set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " ---------- Plugins ---------- Bundle 'MarcWeber/vim-addon-mw-utils' Bundle 'garbas/vim-snipmate' Bundle 'wesleyche/SrcExpl' Bundle 'scrooloose/nerdtree' Bundle 'vim-scripts/taglist.vim' Bundle 'wesleyche/Trinity' "Bundle 'vivien/vim-addon-linux-coding-style' set foldmethod=marker " Open and close all the three plugins on the same time nmap <f6> :TrinityToggleAll<CR> " Open and close the srcexpl.vim separately nmap <f7> :TrinityToggleSourceExplorer<CR> " Open and close the taglist.vim separately nmap <f8> :TrinityToggleTagList<CR> " Open and close the NERD_tree.vim separately nmap <f9> :TrinityToggleNERDTree<CR> " Back to last modified line " Kaiden: enable color syntax on ``` - 執行vim 若沒安裝vundle會自動安裝 - :PluginInstall &nbsp; ``` $ctags -R ``` ``` $cscope -Rbqk ``` &nbsp; - #### ifconfig 如何配置让 Debian 非特权用户也可以使用 ifconfig 。 ifconfig 在 /sbin 目录下,新建一个用户时, Debian 默认从 /etc/skel/ 复制配置文件, /sbin 并不在 $PATH 中,所以导致默认非特权用户无法使用 ifconfig (terminal 会提示说找不到该命令)。 解决方法: ``` $sudo apt-get install net-tools $sudo ifconfig ``` 如果命令前不想加sudo 在 .bashrc 文件中添加 export PATH=$PATH:/sbin 1. 修改 IP address (先用ifconfig -a⋯⋯看系統可用的網路 device, 假如是 eth0 的話) 及時生效: ``` $ifconfig eht0 192.168.0.20 netmask 255.255.255.0 ``` 啟動時生效: ``` $vi /etc/sysconfig/netowrk-scripts/ifcfg-eth0 ``` DEVICE=eth0 BOOTPROTO=none BROADCAST=192.168.0.255 IPADDR=192.168.0.30 <== 改成新 IP NETMASK=255.255.255.0 <== 改為新的 netmask GATEWAY=192.168.0.254 <== 改為新的 gateway` 2. 修改 default gateway 及時生效 ``` $route add default gw 192.168.0.1 ``` 啟動生效: ``` $vi /etc/sysconfig/network-scripts/ifcfg-eth0 ``` GATEWAY=192.168.0.254 3. 修改 DNS ``` $vi /etc/resolv.conf (修改後可及時生效, 重新啟動也有效) ``` search nameserver 168.95.1.1 4. 重新啟動網路服務 ``` $/etc/init.d/network restart ``` - 自製網路設定shell script - 其中的4、5兩行,不能直接用sudo echo ...的原因,主要是redirect這邊是由shell來handle,請參考[stack overflow](https://stackoverflow.com/questions/84882/sudo-echo-something-etc-privilegedfile-doesnt-work) ```bash= #!/bin/bash sudo ifconfig enp2s0 172.31.6.75 netmask 255.255.255.0 sudo route add default gw 172.31.6.254 sudo sh -c "echo 'search' >> /etc/resolv.conf" sudo sh -c "echo 'nameserver 168.95.1.1' >> /etc/resolv.conf" ``` &nbsp; &nbsp; &nbsp; ### C. Other Settings #### shortcuts [1.reference](https://www.youtube.com/watch?v=gQleM0DrLvQ) [2.reference](https://askubuntu.com/questions/68962/how-to-drag-a-folder-to-the-launcher-from-nautilus) 1. application->utilities->tweak tool 2. check the **Desktop page** page and set **icons on desktop** to "on" 3. create a .desktop file in /home/kaiden/Desktop/ - .desktop file template for folder ``` #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=nautilus /home/kaiden/Myspace/ Name=Myspace Icon=folder Comment=Myspace!!! ``` - .desktop file template for application(e.g. terminal) ``` #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=gnome-terminal Name=Myspace Icon=/var/lib/app-info/icons/debian-stretch-main/64x64/gnome-terminal_utilities-terminal.png Comment=terminal!!! ``` #### volume control 1. use "pavucontrol" 2. settings -> keyboard,add the followings command to application shortcuts ``` amixer set Master 5%+ amixer set Master 5%- ``` #### terminal shortcut 2. settings -> keyboard,add the followings command to application shortcuts ``` xfce4-terminal ``` #### xfce Workspace hotkey 1. [reference](https://defkey.com/xfce-shortcuts) #### apt-get install i386 packages https://stackoverflow.com/questions/58681718/intstalling-android-studio-on-64-bit-version-of-lubuntu-fails-installing-some-32 First verify the architectures configured in your system; ``` sudo dpkg --print-architecture //amd64 ``` Second look for any other foreign architectures ``` sudo dpkg --print-foreign-architectures //response should be nothing ``` Now proceed to add 32-bit architecture ``` sudo dpkg --add-architecture i386 ``` Verify 32-bit is added ``` sudo dpkg --print-foreign-architectures //i386 ``` Then update your packages ``` sudo apt-get update Now you can install your 32-bit packages sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 ``` ![](https://i.imgur.com/vmatO8I.png) ### virtualbox #### 共用資料夾 - 權限問題解決 1. sudo usermod -a -G vboxsf $USER 2. reboot後即可 #### 不在sudoers list - chmod u+w /etc/sudoers - vi /etc/sudoers - 加入下方kaiden那行 ``` # User privilege specification root ALL=(ALL:ALL) ALL kaiden ALL=(ALL:ALL) ALL ``` #### apt source list ``` deb http://deb.debian.org/debian/ buster main deb-src http://deb.debian.org/debian/ buster main deb http://security.debian.org/debian-security buster/updates main deb-src http://security.debian.org/debian-security buster/updates main # buster-updates, previously known as 'volatile' deb http://deb.debian.org/debian/ buster-updates main deb-src http://deb.debian.org/debian/ buster-updates main ``` #### 使用USB3.0(隨身硬碟) - 安裝virtual box的extension https://iqmore.tw/oracle-vm-virtualbox-extension-pack-windows-10-usb-3-0 #### 安裝samba(網路分享資料夾) - 參考網址 [samba](https://bryceknowhow.blogspot.com/2013/10/virtualbox-samba-ubuntu-host-onlywin7.html) [samba2](https://www.itread01.com/content/1550441893.html) [samba3](https://hollyqood.wordpress.com/2016/12/08/virtualbox%E8%99%9B%E6%93%AC%E6%A9%9Fubuntu%E4%BD%BF%E7%94%A8samba%E5%9C%96%E6%96%87%E6%95%99%E5%AD%B8/) [samba4](https://zhuziicafe.me/2019/03/16/jobs-%E5%88%A9%E7%94%A8-samba-%E5%BB%BA%E7%AB%8B%E8%99%9B%E6%93%AC%E6%A9%9F%E8%88%87%E6%9C%AC%E6%A9%9F%E5%85%B1%E4%BA%AB%E8%B3%87%E6%96%99%E5%A4%BE/) [Will a EXT4 Samba Share be readable by Windows/Mac OS X users?](https://superuser.com/questions/621852/will-a-ext4-samba-share-be-readable-by-windows-mac-os-x-users) - 加入介面卡2, 設定如下圖 ![](https://i.imgur.com/gUMo1EC.png) - 需設定/etc/network/interfaces ![](https://i.imgur.com/cRC7K4C.png) 此步驟目的是要跟host設定同網域, 但如果不設定, 在加入介面卡2後會不能上網 - 安裝samba ```bash sudo apt-get install samba cifs-utils smbclient ``` - 配置samba(這裡分享的是整個跟目錄) ```bash sudo subl /etc/samba/smb.conf ``` ![](https://i.imgur.com/V0lrkj8.png) ```bash # Kaiden's share folder [Share] comment = Shared Folder with username and password path = / public = yes writable = yes read only = no valid users = kaiden force directory mode = 777 force create mode = 777 force security mode = 777 force directory security mode = 777 hide dot file = no create mask = 0777 directory mask = 0777 delete readonly = yes guest ok = yes available = yes browseable = yes ``` - 設置密碼 ```bash sudo smbpasswd -a kaiden ``` - 確認設定 ```bash testparm ``` ![](https://i.imgur.com/PYnsR2R.png) ![](https://i.imgur.com/LBGlxcs.png) - 重啟samba ```bash sudo /etc/init.d/smbd restart ``` - host client互相ping確認連線 - 連線網路磁碟機 - 在本機點右鍵可以看到 ![](https://i.imgur.com/VFwjAGu.png) - 輸入client的ip`(//xxx.xxx.xxx.xxx)`並點瀏覽 ![](https://i.imgur.com/q1DDKTt.png) ![](https://i.imgur.com/g6fog7y.png) - 點選確定, 點選完成, 就OK了 ![](https://i.imgur.com/BLpRtWC.png) #### 產生以及掛載新虛擬硬碟 - 參考網址: https://www.itread01.com/p/1390106.html - 先產生vdi虛擬硬碟 - 進入Linux使用fdisk做分割,(假設叫/dev/sdb) ```bash sudo fdisk /dev/sdb n p [Enter] [Enter] w ``` - format分割 ```bash sudo mkfs.ext4 /dev/sdb1 ``` - 建立資料夾以供掛載 ```bash mkdir /home/kaiden/new_disk ``` - 開機自動掛載(不使用/etc/fstab, 使用/home/kaiden/.bashrc) ![](https://i.imgur.com/IZsSuLw.png) ```bash # Kaiden: mount /dev/sdb1 to new_disk/ kaiden_check_new_disk=$(df | grep 'sdb1') if [ x"${kaiden_check_new_disk}" = x"" ]; then sudo mount /dev/sdb1 /home/kaiden/new_disk sudo chown kaiden:kaiden /home/kaiden/new_disk else echo "/dev/sdb1 already mounted" fi ```