openSUSE

openSUSE常用配置

smb服务

创建共享目录

1
mkdir ~/smbShareDir

赋予用户权限

有必要的话加个 chmod -R 777

1
chown $USER ~/smbShareDir/

设置密码

  • $USER(替换成你的实际用户名)
1
2
3
4
5
sudo smbpasswd -a $USER
[sudo] root 的密码:
New SMB password:
Retype new SMB password:
Added user xxxx.

设置共享目录

1
2
3
4
5
yast -->samba服务 -->Add
ShareName 共享名称: smb
Share Descriiption 共享说明
Share Type 选择Directory
Share Path 上面创建的目录`~/smbShareDir`

配置smb.conf

guest ok = Yes允许匿名登录

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
[global]
passdb backend = tdbsam
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
map to guest = Bad User
logon path = \\%L\profiles\.msprofile
logon home = \\%L\%U\.9xprofile
logon drive = P:
usershare allow guests = No
security = user
wins server =
wins support = No
workgroup =

[smb]
comment = smb
guest ok = Yes
inherit acls = Yes
path = /home/xxxx/smbShareDir
read only = No
Writable = Yes
Browsable = Yes
Valid users = xxxx//这里是上面$USER设置的用户名

smb.service

/usr/lib/systemd/system/smb.service

1
Type=notify改为Type=simple
  • 重载
    1
    systemctl daemon-reload

启动

systemctl start nmb
systemctl start winbind.service
systemctl start smb

Android手机链接

下载个ES文件浏览器 网络–局域网–新建…
服务器一行:填写smb服务器地址 用户名 密码:smbpasswd对应的用户名:密码

ios手机链接

下载个ES文件浏览器
首次启动允许链接本地网络
服务–SMB–新建URL:smb服务地址 用户名:密码 同上


info

neofetch

OS openSUSE Tumbleweed x86_64
Host B450 I AORUS PRO WIFI
Kernel 5.13.2-1-default
Uptime 4 hours, 55 mins
Packages 2906 (rpm)
Shell bash 5.1.8
Resolution 1920x1080
DE Plasma 5.22.3
WM KWin
Theme Breeze Light [Plasma], Breeze [GTK2/3]
Icons [Plasma], breeze [GTK2/3]
Terminal konsole
Terminal Font Hack 17
CPU AMD Ryzen 5 3400G (8) @ 3.700GHz
GPU AMD ATI 09:00.0 Picasso
Memory 3327MiB / 13913MiB

解码器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#!/bin/sh

echo "packman 软件源的媒体播放文件"
echo "添加packman源的国内镜像"
sudo zypper ar -f https://mirrors.ustc.edu.cn/packman/suse/openSUSE_Leap_15.0/ packman_ustc

set -v

echo “开始安装....”
sudo zypper --no-refresh install libavutil55-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install gstreamer-plugins-libav-1.12.5-lp150.3.2.x86_64
sudo zypper --no-refresh install libavcodec57-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libavformat57-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libswresample2-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libavfilter6-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libavresample3-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libpostproc54-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libswscale4-3.4.4-lp150.9.1.x86_64
sudo zypper --no-refresh install libavdevice57-3.4.4-lp150.9.1.x86_64

录屏 媒体

1
sudo zypper in -y kolourpaint simplescreenrecorder vlc smplayer

图片编辑

1
sudo zypper in -y kolourpaint 

KDE Connect

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
echo "KDE Connect 添加firewalld防火墙规则..."
sudo systemctl start firewalld.service

sudo firewall-cmd --zone=public --permanent --add-port=1714-1764/tcp
sudo firewall-cmd --zone=public --permanent --add-port=1714-1764/udp
sudo systemctl restart firewalld.service

# sudo systemctl stop firewalld.service
# https://community.kde.org/KDEConnect

### sendanywherw
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
sudo systemctl restart firewalld.service

设置语言

en_US.utf8

1
localectl set-locale LANG=en_US.utf8 

YouCompleteMe

1
2
3
4
5
sudo zypper in python38-devel
cd .vim/bundle/
git clone https://github.com/Valloric/YouCompleteMe.git
git submodule update --init --recursive #这里全部安装需要走代理
python3.8 install.py --go-completer --rust-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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
set nocompatible

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() "让vundle管理插件版本

Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'rust-lang/rust.vim'
Plugin 'Chiel92/vim-autoformat' "自动格式化https://github.com/Chiel92/vim-autoformat
call vundle#end() " 必须


filetype plugin indent on
" syntax on
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

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

let g:go_highlight_types = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:ycm_use_clangd = 0
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:rustfmt_autosave = 1


"golang自动导入
let g:gofmt_command = "goimports"
autocmd BufWritePre *.go :Fmt


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

系统备份

rsync-backup-system.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

echo " " >> /home/xxxx/logs/rsync-system-backup-info.log
echo "**********$(date)开始备份**********" >> /home/xxxx/logs/rsync-system-backup-info.log 2>&1

### -v參數去掉 避免在/var/spool/mail/root中輸出和log file重複信息
# -a 存档模式 等于-rlptgoD(没有-H,-A,-X);
# -X 保留扩展属性;
# -A 保留ACL(暗示--perms);
# -z 在传输过程中压缩文件数据
# -p 保留权限
# -t 保留修改时间
# -g 保留组
# -o 保留所有者(仅限超级用户)
# -r 递归目录
# -l 将符号链接复制为符号链接
# -H 保留硬链接
# -z 传输过程压缩
# -R 使用相对路径名称(从源目录的起始位置 保留路径 备份到目标目录)

sudo rsync -aptgovrlHAX --delete-excluded --partial --log-file=/home/xxxx/logs/rsync-system-backup.log / /mnt/sdcdata/system-backup/ --exclude={"/usr/src/*","/media/*","/sys/*","/proc/*","/mnt/*","/tmp/*","/run/*","/dev/*","/home/*","/var/tmp/*","/var/run/*","/var/log/*","/var/adm/*","/var/cache/*","/usr/share/doc/*"} && echo "**********$(date):系统备份完毕**********" >> /home/xxxx/logs/rsync-system-backup-info.log 2>&1
  • 只备份当前用户的home

    1
    2
    3
    #!/bin/bash

    rsync -aptgovrlHAX --delete-excluded /home/username/ /mnt/backup/home-backup/ --exclude={"go/pkg/mod/*","Android/Sdk/system-images/*",".cache/*","OSX-KVM/*","VirtualBox\ VMs/*",".gradle/*",".gradle/caches/*","USB/*",".android/avd/*",".*"}
  • 以下命令可用于了解两个文件系统上的文件是否相同(数据和属性):

    1
    rsync -axHAXnP /mnt/part1/ /mnt/part2/

远程备份

1
2
#!/bin/sh
rsync -aptgovrlHAXzP -e "ssh -p passwd" --delete-excluded --exclude={"/media/*","/sys/*","/proc/*","/mnt/*","/tmp/*","/home/*","/var/run/*","/var/tmp/*"} root@AA:AA:AA:AA:/ /run/media/AAA/data/rsync-vps-backup/

DNS静态解析

/etc/sysconfig/network/config

把 NETCONFIG_DNS_POLICY=”auto” 改为 NETCONFIG_DNS_POLICY=””

更改 resolv.conf 添加如下内容

nameserver 223.5.5.5

禁用KDE的baloo文件索引功能

1
balooctl disable

禁用akonadi服务

~/.config/akonadi

1
StartServer=false

修复grub方法

挂载顺序里面 / 在最前面

1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
set -v
mount /dev/sda4 /mnt
mount /dev/sda2 /mnt/boot/efi
mount /dev/sdb3 /mnt/var
mount /dev/sdb4 /mnt/opt
mount /dev/sdb5 /mnt/home
mount -t proc proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
chroot /mnt /bin/bash

重新安装grub

1
2
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda

proxychain4

用proxychain4实现firefox浏览器去插件全局走代理的方法

1
sudo echo "socks5 127.0.0.1 1080" >> /etc/proxychain4.conf

sudo免密输入

1
2
sudo -i
chmod u+w /etc/sudoers

编辑 /etc/sudoers

1
%wheel ALL=(ALL) ALL 取消前面的注释

设置免密命令

1
username ALL=(ALL) NOPASSWD:/usr/bin/zypper,/usr/sbin/privoxy,/usr/bin/rsync,/usr/sbin/cryptsetup,/usr/sbin/hdparm,/usr/bin/rpmbuild,/usr/bin/umount,/usr/bin/mount

添加用户到wheel组

1
usermod -a -G wheel username

还原文件属性

1
2
chmod u-w /etc/sudoers
visudo -c -f /etc/sudoers

联网

查看无线网卡的设备名

ip a

查看可用的NetworkManager连接

su
nmcli con show

1
2
3
4
nmcli con show
NAME UUID TYPE DEVICE
1101 909fe38a-b8e2-4b68-9c1c-431fae269514 wifi wlan0
Wired connection 1 2fbd9c16-aa4c-4885-a1bb-c6bd5d252d92 ethernet eth0

之前有过的连接 无线连网的命令就是

1
nmcli con up uuid 909fe38a-b8e2-4b68-9c1c-431fae269514

要是没有连接 新建无线连接用这个命令

1
nmcli dev wifi connect <SSID> password <password>

新建有线连接用这个命令

1
nmcli con add type ethernet con-name <SSID> ifname enp3s0

要是静态连接 在上面的命令后面添加

1
ip4 192.168.1.50/24 gw4 192.168.1.1

连接创建好后 假如要修改 dns

1
nmcli con mod <SSID> ipv4.dns “8.8.8.8 8.8.4.4”

然后 nmcli con down 再重新 up 一下就可以

添加开机启动服务

/etc/systemd/system/rc-local.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]  
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
PIDFile=/var/run/rc.local.pid
ExecStart=/etc/rc.local start
TimeoutSec=5
RemainAfterExit=yes
GuessMainPID=yes

[Install]
WantedBy=multi-user.target

systemctl enable rc-local.service

/etc/rc.local

1
2
#!/bin/sh
echo "$(date): 测试rc.local...." >> /var/log/test-rc.log

chmod +x /etc/rc.local

KDE自动登录

1
2
cat /etc/sysconfig/displaymanager |grep -i autologin
DISPLAYMANAGER_AUTOLOGIN="username" #username改为要自动登录的用户名

40_custom

/etc/grub.d/40_custom

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

### ubuntu
menuentry "Ubuntu 19.04 ISO" {
set isofile="/ubuntu-19.04-desktop-amd64.iso"
search --set -f $isofile
loopback loop (hd2,gpt7)/$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=${isofile} quiet splash
initrd (loop)/casper/initrd
}

### deeepin
menuentry "deepin_15.1" {
set isofile="/deepin-15.11-amd64.iso"
search --set -f $isofile
loopback loop (hd2,gpt7)/$isofile
linux (loop)/live/vmlinuz boot=live union=overlay live-config findiso=${isofile} locales=zh_CN.UTF-8 quiet splash nomodeset
initrd (loop)/live/initrd.lz
}

fsck

fsck-failed0.png

fsck-failed.png

进入救援CD
fsck-failed2.png


磁盘

清理

搜索


Xfce4桌面添加Ibus输入法

备用

ibus 输入中文

  1. 先确定当前语言环境

    1
    locale|grep -i lang
  2. sudo zypper in ibus-xkbc ibus-rime

  3. ibus status

  4. 配置

    1
    2
    ibus-daemon -x -d
    ibus-setup
  • 重启
    1
    ibus-daemon -x -d -R
  1. 配置开机启动
    cat .profile
    1
    2
    3
    4
    5
    #ibus input
    export GTK_IM_MODULE=ibus
    export XMODIFIERS=@im=ibus
    export QT_IM_MODULE=ibus
    ibus-daemon -d -x

更改默认登陆的DE

1
2
3
4
sudo zypper in xdm

sudo nano /etc/sysconfig/displaymanager
DISPLAYMANAGER="gdm"
  • 要列出替代系统知道的所有显示管理器,运行
    1
    sudo update-alternatives --list default-displaymanager
  • 要更改显示管理器
    1
    sudo update-alternatives --config default-displaymanager
    还有一个用于更新备选方案的YaST模块

yast2-alternative中的sudo zypper
这将通过YaST接口执行类似的功能。

1
2
3
4
5
6
7
8
9
sudo update-alternatives --display default-displaymanager
default-displaymanager - 手动模式
最佳链接版本为 /usr/lib/X11/displaymanagers/sddm
链接目前指向 /usr/lib/X11/displaymanagers/xdm
链接 default-displaymanager 指向 /usr/lib/X11/displaymanagers/default-displaymanager
/usr/lib/X11/displaymanagers/console - 优先级 5
/usr/lib/X11/displaymanagers/lightdm - 优先级 15
/usr/lib/X11/displaymanagers/sddm - 优先级 25
/usr/lib/X11/displaymanagers/xdm - 优先级 10

修复KDE登陆错误

登陆显示错误信息

2022-07-16_04-50.png

修复之后的日志

1
2
3
4
5
6
7
8
sudo journalctl --system |grep breeze

7月 16 04:37:25 liangzi.local sddm[1405]: Loading theme configuration from "/usr/share/sddm/themes/breeze-openSUSE/theme.conf"
7月 16 04:37:26 liangzi.local sddm-greeter[1553]: Loading theme configuration from "/usr/share/sddm/themes/breeze-openSUSE/theme.conf"
7月 16 04:37:26 liangzi.local sddm-greeter[1553]: Loading file:///usr/share/sddm/themes/breeze-openSUSE/Main.qml...
7月 16 04:37:50 liangzi.local sddm[1405]: Loading theme configuration from "/usr/share/sddm/themes/breeze-openSUSE/theme.conf"
7月 16 04:37:50 liangzi.local sddm-greeter[2967]: Loading theme configuration from "/usr/share/sddm/themes/breeze-openSUSE/theme.conf"
7月 16 04:37:50 liangzi.local sddm-greeter[2967]: Loading file:///usr/share/sddm/themes/breeze-openSUSE/Main.qml...

论坛上看到了一个类似的错误

forums.opensuse.org

根据这个思路 把所有libKF5软件从装一遍

sudo zypper in –force libKF5*
这个时候会提示有些软件因为源里面没有 无法完成重新强制安装
把没有的这些全部卸载
sudo zypper rm libKF5AlarmCalendar5
再次运行
sudo zypper in –force libKF5*

可能不需要的一个步骤
cd ~
mv .kde4/ .kde4-backup


一个系统备份软件

www.fsarchiver.org

备份efi-root

这里是备份了 /efi 和/分区 到一个独立文件

  • backup-openSUSE-efi.sh

    1
    2
    3
    #!/bin/sh
    T=`date +%Y-%m-%d-%H`
    fsarchiver savefs -c - -o /mnt/backup/backupSystem-openSUSE/backup-openSUSE-efi-$T.fsa /dev/sdb1 -v -j4 -A
  • backup-openSUSE-root.sh

    1
    2
    3
    4
    #!/bin/sh

    T=`date +%Y-%m-%d-%H`
    fsarchiver savefs -c - -o /mnt/backup/backupSystem-openSUSE/backup-openSUSE-root-amd64-$T.fsa /dev/sdb2 -v -j4-A -Z10 --exclude={"/tmp","/root/.cache","/var/cache","/var/log","/usr/src","/opt/android-studio"}

恢复efi-root

  • recuse-openSUSE-efi.sh

    1
    2
    #!/bin/sh
    fsarchiver restfs /mnt/backup/backupSystem-openSUSE/backup-openSUSE-efi-2022-08-11-07.fsa id=0,dest=/dev/sdb1 -c - -v
  • recuse-openSUSE-root.sh

    1
    2
    #!/bin/sh
    fsarchiver restfs /mnt/backup/backupSystem-openSUSE/backup-openSUSE-root-amd64-2022-08-11-07.fsa id=0,dest=/dev/sdb2 -c - -v

备份home分区

这里主要是备份/home/username/的隐藏文件

userName替换自己的用户名( -c -)交互式密码

1
2
3
4
5
#!/bin/sh

T=`date +%Y-%m-%d-%H`

fsarchiver savefs -c - -o /mnt/backup/backupSystem-openSUSE/backup-openSUSE-home-$T.fsa /dev/sdb3 -v -j4 -A --exclude={"/userName/go/pkg/mod","/userName/.npm","/userName/.config/Slack/Service\ Worker/CacheStorage","/userName/.config/Slack/Cache","/userName/.android/avd","/userName/tools/bilibili-down","/userName/tools/ximalaya","/userName/Data","/userName/iptv","/userName/Nextcloud","/userName/smbShareDir","/userName/VirtualBox\ VMs","/userName/sdk","/userName/Video","/userName/Android","/userName/nfs_share","/userName/src","/userName/Sync","/userName/Downloads","/userName/lazarus","/userName/dw","/userName/tftp","/userName/.cache"}

输入法

.profile

1
2
3
4
5
6
7
8
9
10
#ibus input
# export GTK_IM_MODULE=ibus
# export XMODIFIERS=@im=ibus
# export QT_IM_MODULE=ibus
# ibus-daemon -d -x

# wayland input
export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx

shell小文件传输

1
curl --upload-file ./二十四山向.md https://transfer.sh/24shan.md

推荐文章