opensuse leap15安装配置
查看opensuse leap15 KDE安装完成后的基本配置
- 默认开启了防火墙
- 默认开启了Linux安全模块

SELinux和防火墙
关闭SELinux—无需执行
opensuse leap15默认不开启SELinux,可以跳过这步。
# 查看selinux的状态
sestatus
# 查看SELinux当前运行模式
getenforce
# 将SELinux临时切换为只警告模式
setenforce 0
# 永久修改SELinux的状态为disabled
## sed "s/原字符串/替换字符串/" filename
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
禁用AppArmor
openSUSE Linux 发行版默认不启用 SELinux,而是使用 AppArmor 来提供强制访问控制(MAC)功能。
sudo systemctl stop apparmor
sudo systemctl disable --now apparmor
关闭firewalld防火墙
在 openSUSE 15 中默认使用的是 firewalld 防火墙服务
# 查看防火墙状态
sudo systemctl status firewalld
# 禁用防火墙
sudo systemctl disable --now firewalld
关闭polki服务—无需执行
polkit 服务不能通过 systemctl enable 或 systemctl disable 命令来启用或禁用,因为它没有安装配置(如 WantedBy=、RequiredBy= 等)。
会影响tuned服务运行,不要禁用polkit服务。
# 现在停止polkit服务并禁用开机自启
systemctl disable --now polkit
# 屏蔽服务,防止启动
sudo systemctl mask polkit
配置国内源(默认rpm-md仓库类型)
opensuse的软件源配置目录是/etc/zypp/repos.d/
## ar: add repo(添加仓库)的缩写
## -f: 自动刷新这个仓库。
## -c: 自动接受仓库证书(信任 SSL 证书)。
## -g: 忽略 GPG 检查(通常用于测试或内部镜像,但不推荐在生产环境中禁用)。
## 'URL': 软件仓库的地址。
## 'Alias': 给仓库起一个容易识别的名字。
sudo zypper ar -fcg '<URL>' '<Alias>'
- 配置opensuse常用的源
# 添加官方主仓库的开源软件Open Source Software
## $releasever 会自动替换为当前系统的版本号(如 15.6)
sudo zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/distribution/leap/$releasever/repo/oss' 'OPEN-TUNA:LEAP:OSS'
# 添加非开源仓库(Non-OSS)
sudo zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/distribution/leap/$releasever/repo/non-oss' 'OPEN-TUNA:LEAP:NON-OSS'
# OSS 更新仓库,用于获取开源软件的安全更新和补丁
sudo zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/update/leap/$releasever/oss' 'OPEN-TUNA:LEAP:UPDATE-OSS'
# 添加 Non-OSS 更新仓库
sudo zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/update/leap/$releasever/non-oss' 'OPEN-TUNA:LEAP:UPDATE-NON-OSS'
# 添加 SUSE Linux Enterprise (SLE) 的更新仓库
sudo zypper ar -fcg https://mirrors.ustc.edu.cn/opensuse/update/leap/\$releasever/sle 'USTC:LEAP:UPDATE-SLE'
# 添加 backports(回溯移植)仓库---提供较新版本的软件包
sudo zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/update/leap/$releasever/backports/' 'USTC:LEAP:Backports'
# PackMan源
sudo zypper ar -fcg https://mirrors.ustc.edu.cn/packman/suse/openSUSE_Leap_\$releasever/ 'USTC:LEAP:PACKMAN'
# 添加 openSUSE_zh 源
sudo zypper ar -fcg https://download.opensuse.org/repositories/home:/opensuse_zh/\$releasever/ LEAP:openSUSE_zh
# 添加 m17n obs 源:https://build.openSUSE.org/repositories/M17N
sudo zypper ar -fcg https://download.opensuse.org/repositories/M17N/\$releasever LEAP:m17n
# 查看已添加的所有仓库及其状态
zypper lr -d

# 手动刷新软件源
sudo zypper ref
安装必备软件
https://eternalcenter.com/macbook-air-2017-install-opensuse-15/
# 加载手机USB共享网络模块功能
modprobe rndis_host
# 更新系统到最新
zypper dup
# 安装语言包
zypper install-new-recommends
# 安装chrome浏览器
zypper install -y chromium
# fat32
zypper install -y fuse-exfat
# 中文输入法
zypper in -y fcitx fcitx-googlepinyin
# 安装网络工具
zypper install -y mosh telnet net-tools-deprecated curl wget rsync tcpdump iperf bind-utils proxychains-ng
# 安装常用工具
zypper install -y htop mlocate bash-completion git vim lrzsz tree screen socat lsof qrencode traceroute jq sysstat
# 选装
zypper install -y lsb-release wireguard-tools
# 性能自动优化
zypper in -y tuned tuned-utils tuned-utils-systemtap
# ssh防护
zypper in -y fail2ban ipset
# 安装glibc-i18ndata包
## glibc-i18ndata 国际化语言数据库
zypper in -y glibc-i18ndata glibc-locale glibc-locale-base
## wqy-zenhei-fonts wqy-bitmap-fonts wqy-microhei-fonts 安装文泉驿正黑字体
zypper in -y wqy-zenhei-fonts wqy-bitmap-fonts wqy-microhei-fonts
安装虚拟机驱动—非虚拟机跳过执行
# openSUSE使用zypper来管理软件包--非虚拟机不装
zypper in -y open-vm-tools
# 安装桌面版vm驱动
zypper in -y open-vm-tools-desktop
安装博通网卡驱动
# 配置m17n软件源
# 安装博通网卡驱动
zypper install -y broadcom-wl
# old
zypper install -y b43-fwcutter
# 运行驱动安装
sudo install_bcm43xx_firmware
opensuse系统优化
tuned服务
# 现在启动并开机自启
systemctl enable --now tuned
# 使用系统推荐的优化方案
tuned-adm recommend
# 使用桌面优化方案
tuned-adm profile desktop
修改本地化设置信息
# 编辑locale.conf
vim /etc/locale.conf
配置内容如下:
# 设置默认语言
LANG=zh_CN.UTF-8
# 覆盖系统所有语言设置
LC_ALL=zh_CN.utf8
配置sudo免密
# 配置admin用户的sudo 免密权限
echo "admin ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/admin
# 配置admin的sudo配置文件权限
sudo chmod 0440 /etc/sudoers.d/admin
# 检查sudoers配置文件
visudo -c

PS1美化
# 下载ps1.sh美化配置文件到 /etc/profile.d
sudo wget -cP /etc/profile.d https://raw.gitcode.com/liqiaofei/profile.d/raw/main/ps1.sh
# 使ps1变量生效
source /etc/profile.d/ps1.sh
美化vim
# 下载vim配置文件
wget -cP $HOME/ https://raw.gitcode.com/liqiaofei/vim-config/raw/main/.vimrc
配置git命令自动补全
# 下载git-completion.sh
wget -cP /etc/profile.d/ https://raw.github.com/git/git/master/contrib/completion/git-completion.bash
# 国内
wget -cP /etc/profile.d/ https://raw.gitcode.com/liqiaofei/profile.d/raw/main/git-completion.bash
配置/etc/motd.d/00-welcome系统欢迎语
tee /etc/motd.d/00-welcome <<-'EOF'
【法律警告】
本系统仅供授权人员访问。所有登录尝试和系统内的操作行为都将被实时监控、记录和审计。未经授权的访问、使用、修改或传播系统信息属于非法行为,将承担严厉的法律责任,包括但不限于民事赔偿、行政处罚乃至刑事起诉。继续登录表示您已阅读、理解并同意接受上述条款和相关信息安全策略的约束。
EOF
安装常用软件
安装vscoe
# 导入vscode的GPG 公钥
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# 添加 VS Code 官方仓库源
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/vscode.repo'
vscode仓库源内容如下:
/etc/zypp/repos.d/vscode.repo
# 仓库名称
[code]
# 仓库描述
name=Visual Studio Code
# 仓库地址
baseurl=https://packages.microsoft.com/yumrepos/vscode
# 仓库启用状态
enabled=1
# 表示这是一个使用元数据的 RPM 仓库(YUM 格式)
type=rpm-md
# 检查 GPG 签名
gpgcheck=1
# GPG签名文件地址
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
- 从源中安装code软件包
# 刷新软件源
sudo zypper refresh
# 从源中安装code软件包
sudo zypper install code
安装wpsOffice
https://www.wps.cn/product/wpslinux#
# 安装rpm包
sudo zypper install -y wps-office-11.1.0.10161-1.x86_64.rpm
# 系统自带了libreoffice
# 安装libreoffice中文语言包
zypper in libreoffice-l10n-zh-CN
常见问题
kde卡顿时,可以尝试:
- 禁用 CPU 的 C6 状态(idle=nomwait)
# 查看当前 CPU 的 idle 模式
# 查看当前使用的内核参数
cat /proc/cmdline
# 查看当前 C-state 状态
cat /sys/devices/system/cpu/cpu0/cpuidle/current_driver
- 将
混成器从OpenGL3.1调成2.0

1990

被折叠的 条评论
为什么被折叠?



