Debian

Debian

iso

可以在安装过程连接wifi的

添加网卡驱动

前提是可以插网线上网

添加non-free的安装源到系统中
更新 /etc/apt/sources.list,添加以下记录:

deb http://httpredir.debian.org/debian/ buster main contrib non-free
注意:如果你是 Debian 9 的系统,请把 buster 替换为 stretch,响应的 Debian 8 的系统用 jessie, Debian 7 的系统用 wheezy。

安装无线网卡驱动
在Debian.org 的 WiFi 页面中,我们可以查到,Intel Wireless-N 需要装的驱动为 firmware-iwlwifi。 我们在终端执行更新后,就可以安装 firmware-iwlwifi 了,

sudo apt-get update
sudo apt-get install firmware-iwlwifi
重新载入模块
iwlwifi 模块会自动加载支持的设备,我们重新加载此模块,让它自动加载支持的设备。在终端中执行:

modprobe -r iwlwifi
modprobe iwlwifi

联网

wifi联网

  • console模式
    cd /etc/network/
    vi interface
    1
    2
    3
    4
    allow-hotplug wlp6s0
    auto wlp6s0 # wlp6s0 无限网卡名称
    iface wlp6s0 inet dhcp
    wpa-conf /etc/wpa.conf #指定无线网配置文件位置

wpa_passphrase ssid password > /etc/wpa.conf
ssid要连接的无线网名称(比如 Danke111_5G)

网线

cat /etc/network/interfaces.d/enp8s0

1
2
3
4
5
6
7
8
9
10
11
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
# auto lo
# iface lo inet loopback
#
auto enp8s0
allow-hotplug enp8s0
iface enp8s0 inet dhcp
iface enp8s0 inet6 auto

sudo ifup enp8s0
sudo systemctl restart networking.service

sources

sudo sed -i ‘s/deb.debian.org/mirrors.ustc.edu.cn/g’ /etc/apt/sources.list

YCM

  • root

    1
    2
    3
    4
    5
    atp-get update
    apt install git gcc clang cmake vim-nox python3.9-dev build-essential

    wget -c https://dl.google.com/go/go1.19.linux-amd64.tar.gz /home/user/go1.19.linux-amd64.tar.gz
    tar xvf /home/user/go1.19.linux-amd64.tar.gz -C /usr/local/
  • home
    golang

    1
    2
    3
    4
    go env -w GO111MODULE="on"
    go env -w GOPROXY="https://goproxy.cn,direct"
    export PATH=$PATH:/usr/local/go/bin
    go version
1
2
3
4
5
6
7
8
mkdir -p .vim/bundle
cd .vim/bundle/
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

git clone https://github.com/Valloric/YouCompleteMe.git
cd YouCompleteMe/
git submodule update --init --recursive
python3.9 install.py --go-completer
  • vimrc
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    set nocompatible   " be iMproved, required
    filetype off " required
    " set the runtime path to include Vundle and initialize
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    Plugin 'Valloric/YouCompleteMe'
    Plugin 'https://github.com/Chiel92/vim-autoformat'
    call vundle#end() " required

    filetype plugin indent on " required
    set backspace=indent,eol,start
    set autowrite
    set number
    set mouse=nv
    set tabstop=4
    set encoding=utf-8
    set fencs=utf-8,GB18030,ucs-bom,default,latin1


    " jj 保存文件并留在插入模式 [插入模式]
    imap jj <ESC>:w<CR>li
    " kk 返回Normal模式 插入模式
    imap kk <ESC>l

    "F3格式化C#快捷键
    noremap <F3> :Autoformat<CR>

打开vim 输入 :PluginInstall

idevices(IOS)

1
2
3
4
5
6
7
8
9
apt-get update
apt install libimobiledevice-utils
ideviceinfo
mkdir /mnt/backup
mount /dev/sdc1 /mnt/backup/
cd /mnt/backup/IOS/
mkdir backup-from-idevices-ios14.7
idevice_id -l
idevicebackup2 -s 840acf8040d6f13c16c2d98b950922515f75d232 backup --full ./backup-from-idevices-ios14.7/

MariaDB

  • root
    创建
    mysql -u root -p123456
    source /path/create-databases.sql
    或者
    DROP DATABASE IF EXISTS fate;
    CREATE DATABASE fate DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;;

DROP DATABASE IF EXISTS mysql;
CREATE DATABASE mysql DEFAULT CHARACTER SET utf8mb4;

恢复数据库 实现普通用户不用输入sudo

  1. ~/.my.cnf
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    # The following options will be passed to all MariaDB clients
    [client]
    # of the '~/.my.cnf' configuration file with an access mode set to 400 or 600.
    user = userName
    port = 3306
    socket = /run/mysqld/mysqld.sock

    [mysqld]

    bind-address = 127.0.0.1
    innodb_file_format=Barracuda
    innodb_file_per_table=ON
    server-id = 1
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

    [mysqld_multi]
    mysqld = /usr/bin/mysqld_safe
    mysqladmin = /usr/bin/mysqladmin
  2. 复制备份文件到files目录内

mkdir files && cd files
cp /path/26-08-2022/*.gz .
for f in ls;do gzip -d $f;done

恢复
mysql -u root -p123456 mysql < mysql
查看
mysql -u root -p123456 -Bse ‘show databases’

mysql -u root -p123456

重启服务
systemctl status mysql.service
systemctl restart mysql.service
systemctl status mysql.service

备份

mysql-backup.bash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# A sample mysql backup script
# Must be run as the root user
# Written by Vivek Gite
# Last updated on : 23/Aug/2003
# ---------------------------------
# MySQL Login Info
MUSER="root" # MySQL user
MHOST="localhost" # MySQL server ip
MPASS="123456" # MySQL password

# format dd-mm-yyyy
NOW=$(date +"%d-%m-%Y")

# Backupfile path
BPATH=/home/userName/tftp/mysql/$NOW

# if backup path does not exists, create it
[ ! -d $BPATH ] && mkdir -p $BPATH

# get database name lists
DBS="$(/usr/bin/mysql -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
echo $DBS #测试链接是否成功

for db in $DBS
do
# Bakcup file name
FILE="${BPATH}/${db}.gz"

# skip database backup if database name is adserverstats or mint
[ "$db" == "adserverstats" ] && continue
[ "$db" == "mint" ] && continue

# okay lets dump a database backup
/usr/bin/mysqldump --single-transaction -u $MUSER -h $MHOST -p$MPASS $db | /bin/gzip -9 > $FILE
done

sleep 2
ls -lR ~/path/mysql/$NOW

echo "数据库已备份到$BPATH"

Xfce4

  • uninstall

root

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
apt purge libexo-2-0 libgarcon-1-0 libxfce4panel-2.0-4 libxfce4ui-2-0 libxfce4ui-common libxfce4ui-utils libxfce4util-bin libxfce4util-common libxfce4util7 libxfconf-0-3 mousepad ristretto task-xfce-desktop thunar xfburn xfce4 xfce4-appfinder xfce4-battery-plugin xfce4-clipman xfce4-clipman-plugin xfce4-cpufreq-plugin xfce4-cpugraph-plugin xfce4-datetime-plugin xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin xfce4-genmon-plugin xfce4-goodies xfce4-helpers xfce4-mailwatch-plugin xfce4-netload-plugin xfce4-notifyd xfce4-panel xfce4-places-plugin xfce4-power-manager xfce4-power-manager-data xfce4-power-manager-plugins xfce4-pulseaudio-plugin xfce4-screenshooter xfce4-sensors-plugin xfce4-session xfce4-settings xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal xfce4-timer-plugin xfce4-verve-plugin xfce4-wavelan-plugin xfce4-weather-plugin xfce4-whiskermenu-plugin xfce4-xkb-plugin xfconf xfdesktop4 xfdesktop4-data xfwm4 exo-utils libxfce4ui-common thunar xfce4-clipman xfce4-helpers xfce4-notifyd xfce4-panel xfce4-power-manager xfce4-session xfce4-settings xfce4-whiskermenu-plugin 

apt purge `dpkg --get-selections | grep gnome | cut -f 1`
apt -f install
apt purge `dpkg --get-selections | grep deinstall | cut -f 1`
apt -f install

dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs dpkg --purge

cd /home/userName/.local/share
rm -rf gvfs-metadata icc keyrings Mousepad nano recently-used.xbel recently-used.xbel.BE1DR1 ristretto systemd Trash

cd /home/userName/.config
rm -rf autostart dconf gtk-3.0 mimeapps.list pavucontrol.ini pluma pulse ristretto Thunar xarchiver
rm -rf bleachbit ibus libreoffice Mousepad pipewire-media-session procps QtProject.conf systemd VeraCrypt xfce4

cd /home/userName
rm -rf .Xauthority .ICEauthority .xsession-errors* .lesshst
rm -rf .cache

apt autoremove

MATE

  • install

    1
    2
    3
    4
    5
    6
    7
    8
    9
    apt install mate-tweak
    apt install mate-desktop-environment-core
    apt install mate-desktop-environment-extras
    apt install mate-desktop-environment

    # 到这里在tty startx 可以正常启动

    ##下面这个都是第三方的组件 比如NM任务栏网络管理模块libreoffice.....
    apt install task-mate-desktop
  • remove

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    #!/bin/bash
    apt purge mate-tweak
    apt purge mate-desktop-environment-core
    apt purge mate-desktop-environment-extras
    apt purge mate-desktop-environment

    ##下面这个都是第三方的组件 比如NM任务栏网络管理模块libreoffice.....
    apt purge task-mate-desktop


    apt purge `dpkg --get-selections | grep mate | cut -f 1`
    apt -f install
    apt purge `dpkg --get-selections | grep depurge | cut -f 1`
    apt -f install

    dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge

    cd /home/usrName
    rm -rf .gnupg/*
    rm -rf .sudo_as_admin_successful .selected_editor .pki/nssdb/ .lesshst .gphoto/ .dmrc
    rm -rf .cache
    cd .config
    rm -rf autostart/ caja/ fcitx ibus/ mate/ mimeapps.list procps/ user-dirs.* vlc/ atril/ dconf/ enchant/ gtk-3.0/ menus/ pluma/ pluma/
    rm -rf .xsession-errors .xsession-errors.old .Xauthority

KDE

  • install

wiki.debian.org

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

apt install task-kde-desktop
apt install kde-plasma-desktop
apt install kde-standard
apt install breeze-gtk-theme
apt install kde-config-sddm sddm-theme-debian-breeze
apt install plasma-workspace-wayland
apt install kde-config-tablet
apt install kde-config-screenlocker
apt install libreoffice-kde5

#################3
## cd ~/.config
## for j in plasma*; do mv -- "$j" "${j%}.bak"; done

系统迁移(rsync)

要排除的目录 –exclude={“/home/userName/.cache/“,”/home/userName/Sync/“,”/home/userName/flutter/.pub-cache/*”}
登入任意linux系统执行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mkdir src dest
cd src/
mkdir efi root
cd ../dest/
mkdir efi root
cd ../
mount /dev/sdd1 src/efi/ # 原系统efi
mount /dev/sdd2 src/root/ # 原系统根分区 这里home没有单独分

mount /dev/sdc1 dest/efi/ # 目标盘
mount /dev/sdc2 dest/root/ #目标盘

rsync -aptgovrlHAX --partial --log-file=src/root/home/userName/rsync.log src/efi/ dest/efi/

rsync -aptgovrlHAX --partial --log-file=src/root/home/userName/rsync.log src/root/ dest/root/

1
2
3
4
5
6
7
8
9
10
11
12
localhost:/home/linux # pwd
/home/linux
localhost:/home/linux # ls src/efi/
EFI
localhost:/home/linux # ls src/root/
bin dev home initrd.img.old lib32 libx32 media opt root sbin sys usr vmlinuz
boot etc initrd.img lib lib64 lost+found mnt proc run srv tmp var vmlinuz.old
localhost:/home/linux # ls dest/efi/
EFI
localhost:/home/linux # ls dest/root/
bin dev home initrd.img.old lib32 libx32 media opt root sbin sys usr vmlinuz
boot etc initrd.img lib lib64 lost+found mnt proc run srv tmp var vmlinuz.old

更新之前分区的时候最好把UUID指定为原系统的
不指定需要修复grub引导


nftables

Cortafuegos stateful simple

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
user@host:~$ sudo -i
root@host:~# nft list tables
root@host:~# vim /etc/nftables.conf
root@host:~# nft flush ruleset
root@host:~# nft add table inet filter
root@host:~# nft add chain inet filter input { type filter hook input priority 0 \; policy drop \; }
root@host:~# nft add chain inet filter forward { type filter hook forward priority 0 \; policy drop \; }
root@host:~# nft add chain inet filter output { type filter hook output priority 0 \; policy accept \; }
root@host:~# nft add chain inet filter TCP
root@host:~# nft add chain inet filter UDP
root@host:~# nft add rule inet filter input ct state related,established accept
root@host:~# nft add rule inet filter input iif lo accept
root@host:~# nft add rule inet filter input ct state invalid drop
root@host:~# nft add rule inet filter input ip protocol icmp icmp type echo-request ct state new accept
root@host:~# nft add rule inet filter input ip protocol udp ct state new jump UDP
root@host:~# nft add rule inet filter input ip protocol tcp tcp flags \& \(fin\|syn\|rst\|ack\) == syn ct state new jump TCP
root@host:~# nft add rule inet filter input ip protocol udp reject
root@host:~# nft add rule inet filter input ip protocol tcp reject with tcp reset
root@host:~# nft add rule inet filter input counter reject with icmp type prot-unreachable
root@host:~# nft add rule inet filter TCP tcp dport 80 accept
root@host:~# nft add rule inet filter TCP tcp dport 443 accept
root@host:~# nft add rule inet filter TCP tcp dport 22 accept
root@host:~# nft add rule inet filter TCP tcp dport 53 accept
root@host:~# nft add rule inet filter UDP udp dport 53 accept
root@host:~# nft list tables
table inet filter
  • 生成备份文件

    1
    root@host:~# nft list ruleset> /etc/simple.ntf
  • 从备份文件恢复

    1
    nft -f /etc/simple.ntf
  • 开机启动

    1
    2
    3
    4
    5
    root@host:~# cp /etc/nftables.conf /etc/nftables.conf.bak

    root@host:~# nft list ruleset>> /etc/nftables.conf

    root@host:~# systemctl enable nftables.service

DNS

1
2
3
sudo -s
echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone

resolv.conf
vim /etc/resolv.conf

1
2
nameserver 8.8.8.8
nameserver 223.5.5.5

推荐文章