# DNF安装和回滚操作 ### 起因 一直使用的fedora xfce桌面环境,从38安装后一路升级到41,鉴于windows11的糟糕体验,准备尝试迁移到linux办公。回到linux桌面,发现一个问题,升级上来的桌面版,壁纸单独放置,升级跳过的版本壁纸没有,默认壁纸还是38的小老鼠。这对于想要展示使用fedora历史版本的人来说,想要集全版本壁纸。 #### 想法一 首先想到的是,将38以后的版本安装一遍,然后在把壁纸文件复制出来。 虽然我已经打开pve,打开镜像网站,准备下载镜像。 ~~~但是,我还是感觉这个方法太苯了。开始寻找更方便的方法 #### 想法二 搜索,解决问题的一种方法是:你遇到的问题,一定有人也遇到过。搜索到的方法是安装壁纸包。 ## 操作 安装与回滚 ### 安装 ```shell # 搜索安装包,xfce是限定xfce桌面,还有GNOME,KDE等 sudo dnf search f*backgrounds*xfce # 查看本地已有版本 ls /usr/share/backgrounds default-dark.png default.png default.xml f38 f40 f41 images xfce # 安装40以后版本,40以后已经存在,无需安装 sudo dnf install f4*backgrounds*xfce # 安装30以后版本 sudo dnf install f3*backgrounds*xfce ``` 安装后转移壁纸文件到xfce下 ```shell # 批量转移文件 for i in {png,jpg}; do find /usr/share/backgrounds/f3* -name *.$i -exec sudo mv {} /usr/share/backgrounds/xfce/ \; ; done # 解决软连接问题 find /usr/share/backgrounds/xfce/ -type l -exec sudo unlink {} \; ``` ### 回滚 获取到需要的壁纸文件后,为了减少存储占用,把之前的安装包卸载。使用回滚的方式 ```shell # 查询安装执行的id sudo dnf history list ID Command line Date and time Action(s) Altered 2 dnf install f3*backgrounds*xfce 2024-11-27 03:23:52 39 1 dnf update -y 2024-11-26 08:14:55 164 # 确认安装执行ID为2,进行回滚 sudo dnf history undo 2 # 确认安装包后输入y确认 ```