高危风险,银河麒麟系统安装Oracle数据库遇到的严重问题!

前言:

由于不同产品国产化替代进度不同,导致适配上经常出问题,最明显的就是国产化操作系统替代的速度通常快于国产化数据库的替代,这就不得不面临一个问题,在先替换国产操作系统后,如何平滑的临时将国外商业数据库迁移到国产操作系统上?
以本文为例,对国产麒麟系统来讲,又分为中标麒麟和银河麒麟等,其中oracle又只兼容中标麒麟,如果想在银河麒麟系统安装oracle,通常会遇到一些问题。

关于Oracle数据库适配哪些国产操作系统,请看我的另一篇文章:

Oracle数据库适配哪些国产操作系统?
chenjuchao,公众号:IT小Chen
Oracle数据库适配哪些国产操作系统?

问题描述:

在银河麒麟Kylin Linux V10 (SP1)上静默安装Oracle 11.2.0.4.0软件后,发现 $ORACLE_HOME/bin 目录下 lsnrctl,tnslsnr,rman,sqlldr,expdp …等很多文件大小为0,导致了很多命令无法正常执行。

除此以外,还有其他几个问题,请看我的另一篇文章:

银河麒麟系统安装ORACLE数据库问题处理
chenjuchao,公众号:IT小Chen
银河麒麟系统安装ORACLE数据库问题处理

不靠谱的方案:

手动拷贝另一套没问题的数据库的相应文件,并授予相应的权限。

scp -P 22 sqlldr rman oracle lsnrctl expdp exp adrci tkprof tnsping tnslsnr ... oracle@CJC-DB-01:/home/oracle/tmp

复制到 $ORACLE_HOME/bin 目录下。

拷贝后,可以正常执行数据库命令,也可以正常继续后面的dbca操作。

但是这种方案有很大的安全隐患,lsnrctl等文件大小为0的原因没有找到,很可能还有其他安全问题,所以生产环境不建议这么操作。

问题原因:

具体还是要分析lsnrctl等文件大小为0的原因。

先检查下版本信息:

操作系统版本:

root@cjc-db-01:/tmp/oraclesoft_20211216#nkvers 
############## Kylin Linux Version #################
Release:
Kylin Linux Advanced Server release V10 (Tercel)

Kernel:
4.19.90-23.43.v2101.ky10.x86_64

Build:
Kylin Linux Advanced Server
release V10 (SP1) /(Tercel)-x86_64-Build20/20210518

ldd版本:

root@cjc-db-01:/root#ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

gcc版本:

root@cjc-db-01:/root#gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

其中 ldd,gcc版本比redhat7.9上的ldd,gcc版本高。

检查静默安装日志:

执行安装,速度很快,不到2分钟安装完了,自动忽略了错误,之前以为是静默安装添加了-ignoreSysPrereqs,-ignorePrereq参数导致的,但是去掉这两个参数还是会自动忽略,反正你也别管安装的有没有问题,你就说快不快吧!

过程如下:

root@cjc-db-01:/tmp/oraclesoft_20211216#su - oracle -c "LANG=C; /tmp/oraclesoft_20211216/database/runInstaller -silent -noconfig -showprogress  -responseFile /tmp/oraclesoft_20211216/install_database_rsp_file.rsp &" | tee /tmp/oraclesoft_20211216/install_database.log
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 4638 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 1461 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2024-04-03_08-52-26AM. Please wait ...[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
   CAUSE: The Central Inventory is located in the Oracle base.
   ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2024-04-03_08-52-26AM/installActions2024-04-03_08-52-26AM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2024-04-03_08-52-26AM/installActions2024-04-03_08-52-26AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
 /db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_08-52-26AM.log

Prepare in progress.
..................................................   9% Done.

Prepare successful.

Copy files in progress.
..................................................   14% Done.
..................................................   20% Done.
..................................................   26% Done.
..................................................   31% Done.
..................................................   36% Done.
..................................................   41% Done.
..................................................   47% Done.
..................................................   52% Done.
..................................................   57% Done.
..................................................   63% Done.
..................................................   68% Done.
..................................................   73% Done.
..................................................   78% Done.
..................................................   83% Done.
..............................
Copy files successful.

Link binaries in progress.
..........
Link binaries successful.

Setup files in progress.
..................................................   88% Done.
..................................................   94% Done.

Setup files successful.
The installation of Oracle Database 11g was successful.
Please check '/db/oracle/app/oracle/oraInventory/logs/silentInstall2024-04-03_08-52-26AM.log' for more details.

Execute Root Scripts in progress.

As a root user, execute the following script(s):
        1. /db/oracle/app/oracle/oraInventory/orainstRoot.sh
        2. /db/oracle/app/oracle/product/11.2/db/root.sh

..................................................   100% Done.

Execute Root Scripts successful.
Successfully Setup Software.

检查安装日志:

vi /db/oracle/app/oracle/oraInventory/logs/silentInstall2024-04-03_08-52-26AM.log'
......
INFO: INFO: *********************************************
INFO: INFO: Package: compat-libstdc++-33-3.2.3 (x86_64): This is a prerequisite condition to test whether the package "compat-libstdc++-33-3.2.3 (x86_64)" is available on the system.
INFO: INFO: Severity:IGNORABLE
INFO: INFO: OverallStatus:VERIFICATION_FAILED
INFO: INFO: -----------------------------------------------
INFO: INFO: Verification Result for Node:cjc-db-01
INFO: INFO: Expected Value:compat-libstdc++-33(x86_64)-3.2.3
INFO: INFO: Actual Value:missing
INFO: INFO: Error Message:PRVF-7532 : Package "compat-libstdc++-33(x86_64)" is missing on node "cjc-db-01"
INFO: INFO: Cause: A required package is either not installed or, if the package is a kernel module, is not loaded on the specified node.
INFO: INFO: Action: Ensure that the required package is installed and available.
INFO: INFO: -----------------------------------------------
INFO: INFO: *********************************************
......

缺失如下安装包,银河麒麟官网没有找到这些包,尝试将redhat 7上的这些包考过了强制安装,依然没有解决问题。

compat-libstdc++-33(x86_64)-3.2.3
elfutils-libelf(x86_64)-0.97
elfutils-libelf-devel-0.97
glibc-headers-2.3.4
pdksh-5.2.14

继续查看安装日志:

silentInstall2024-04-03_11-11-38AM.log
Error in invoking target 'client_sharedlib' of makefile '/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'links proc gen_pcscfg' of makefile '/db/oracle/app/oracle/product/11.2/db/precomp/lib/ins_precomp.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'idg4odbc' of makefile '/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'itnsping' of makefile '/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_client.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'install' of makefile '/db/oracle/app/oracle/product/11.2/db/ctx/lib/ins_ctx.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'install' of makefile '/db/oracle/app/oracle/product/11.2/db/plsql/lib/ins_plsql.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'agent nmhs' of makefile '/db/oracle/app/oracle/product/11.2/db/sysman/lib/ins_emagent.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'all_no_orcl' of makefile '/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'install' of makefile '/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_client.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'install' of makefile '/db/oracle/app/oracle/product/11.2/db/sqlplus/lib/ins_sqlplus.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'clientonlyinstall' of makefile '/db/oracle/app/oracle/product/11.2/db/ldap/lib/ins_ldap.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'ioklist' of makefile '/db/oracle/app/oracle/product/11.2/db/network/lib/ins_nau.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'install' of makefile '/db/oracle/app/oracle/product/11.2/db/srvm/lib/ins_srvm.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'utilities' of makefile '/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'iokdstry iokinit' of makefile '/db/oracle/app/oracle/product/11.2/db/network/lib/ins_nau.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'install' of makefile '/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_server.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'itrcroute' of makefile '/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_client.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
Error in invoking target 'irman ioracle' of makefile '/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk'. See '/db/oracle/app/oracle/oraInventory/logs/installActions2024-04-03_11-11-38AM.log' for details.
File not found: %fileName%
The installation of Oracle Database 11g was successful.

有问题的文件:

/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk
/db/oracle/app/oracle/product/11.2/db/precomp/lib/ins_precomp.mk
/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk
/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_client.mk
/db/oracle/app/oracle/product/11.2/db/ctx/lib/ins_ctx.mk
/db/oracle/app/oracle/product/11.2/db/plsql/lib/ins_plsql.mk
/db/oracle/app/oracle/product/11.2/db/sysman/lib/ins_emagent.mk
/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk
/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_client.mk
/db/oracle/app/oracle/product/11.2/db/sqlplus/lib/ins_sqlplus.mk
/db/oracle/app/oracle/product/11.2/db/ldap/lib/ins_ldap.mk
/db/oracle/app/oracle/product/11.2/db/network/lib/ins_nau.mk
/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_server.mk
/db/oracle/app/oracle/product/11.2/db/network/lib/ins_net_client.mk
/db/oracle/app/oracle/product/11.2/db/rdbms/lib/ins_rdbms.mk

最终解决方案:

用上面有问题的文件为关键字,在MOS上搜索,最终通过ins_precomp.mk关键字,定位到了一篇高度匹配的文章。

Installation of 11.2.0.4 on RHEL 8.x failed with '/bin/ld: cannot find -lnsl make:Error in invoking target 'agent nmhs' of makefile ins_emagent.mk ' (Doc ID 2944859.1)

文章描述了是在RHEL 8.x上安装Oracle 11g遇到的问题。

其实在去年我也思考过类似的问题,并咨询过国产操作系统厂商kylin10和哪个操作系统及版本相似度高一些,比如redhat7、redhat8、centos、suse等,如果知道了kylin10和哪个大家熟知的系统相似度高了,很多问题就可以对比预测了,比如如果是和Centos7.5相似度高,就可以提前猜测到可能会遇到Oracle 11g在Centos7.5安装的那些问题。

厂商回复没有可比性,只是linux架构一样,其他都不太像。

这就只能走一步看一步了。

在回到问题,通过2944859.1文档可以看到:

在OL/RHEL 8.7及更高版本上安装11.2.0.4失败,在安装的relink阶段出现以下错误:

Error in invoking target 'links proc gen_pcscfg' of makefile '<ORACLE_HOME>/precomp/lib/ins_precomp.mk'.
Error in invoking target 'idg4odbc' of makefile '<ORACLE_HOME>/rdbms/lib/ins_rdbms.mk'.
Error in invoking target 'itnsping' of makefile '<ORACLE_HOME>/network/lib/ins_net_client.mk'.
Error in invoking target 'install' of makefile '<ORACLE_HOME>/ctx/lib/ins_ctx.mk'.
Error in invoking target 'nmo' of makefile '<ORACLE_HOME>/sysman/lib/ins_emagent.mk'.
Error in invoking target 'agent nmhs' of makefile '<ORACLE_HOME>/sysman/lib/ins_emagent.mk'.
Error in invoking target 'all_no_orcl' of makefile '<ORACLE_HOME>/rdbms/lib/ins_rdbms.mk'.
Error in invoking target 'install' of makefile '<ORACLE_HOME>/network/lib/ins_net_client.mk'.
Error in invoking target 'nmb' of makefile '<ORACLE_HOME>/sysman/lib/ins_emagent.mk'.
Error in invoking target 'install' of makefile '<ORACLE_HOME>/sqlplus/lib/ins_sqlplus.mk'.
Error in invoking target 'clientonlyinstall' of makefile '<ORACLE_HOME>/ldap/lib/ins_ldap.mk'.
Error in invoking target 'ioklist' of makefile '<ORACLE_HOME>/network/lib/ins_nau.mk'.

也有文件为0的问题:

<ORACLE_HOME>/bin> ls -l nm*
-rws--x--- 1 root oracle 0 Aug 24 2013 nmb
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmb0
-rwxr-xr-x 1 oracle oracle 12724 Jul 16 2013 nmcbufp
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmei
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmei0
-rws--x--- 1 root oracle 0 Aug 24 2013 nmhs
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmhs0
-rws--x--- 1 root oracle 0 Aug 24 2013 nmo
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmo0
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmocat
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmocat0
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmosudo
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmosudo0
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmupm
-rwxr-xr-x 1 oracle oracle 0 Aug 24 2013 nmupm0

这个错误匹配度很高。

问题原因:

默认情况下,libnsl.so指向OEL v8主机上的libnsl.so.2,而EM Agent二进制文件的relink需要libnsl.so.1(特别是libnmemso.so共享库和emagent可执行文件)。

这是relink失败的原因,并根据未发布的Bug 35219138进行了分类:

Bug 35219138 - emagent relink during DB 11.2.0.4 installation fails with error "/bin/ld: cannot find -lnsl"

解决方案:

提供了两种解决方案:

方案一:

1) Perform software-only DB installation irrespective of errors observed during installation of software .
2) Edit the file $ORACLE_HOME/lib/sysliblist ,ensure its modified as below
i,e cat $ORACLE_HOME/lib/sysliblist
-ldl -lm -lpthread -l:libnsl.so.1 -lirc -lipgo -lsvml -laio
3) Download and apply Merge Patch 35539202(merge of patches 19692824 and 35219138 )
4) Relink oracle home binaries
cd $ORACLE_HOME/bin
./relink all

需要更新Patch 35539202,考虑到Patch 35539202又不一定和银河麒麟系统兼容,所以最终没有使用这个方案。

方案二:

修改sysliblist,env_emagent.mk配置文件内容,重新生成config.o文件,重新执行relink,详细操作步骤如下:

a)Take backup and make changes to sysliblist file
cd <DB_Oracle_Home>/lib/
cp sysliblist sysliblist.bkp
from
-ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml -laio

to
-ldl -lm -lpthread -l:libnsl.so.1 -lirc -lipgo -lsvml -laio


b) Change the value of NMEHL_OSLIBS in
<DB_Oracle_Home>/sysman/lib/env_emagent.mk

from

NMEHL_OSLIBS=$(LDLIBFLAG)pthread$(LIB_SUFFIX) $(LDLIBFLAG)nsl$(LIB_SUFFIX) \
$(LDLIBFLAG)m$(LIB_SUFFIX) $(LDLIBFLAG)dl$(LIB_SUFFIX)

To

NMEHL_OSLIBS=$(LDLIBFLAG)pthread$(LIB_SUFFIX) $(LDLIBFLAG)m$(LIB_SUFFIX) \
$(LDLIBFLAG)dl$(LIB_SUFFIX)

c)

from
MK_EMAGENT_NMECTL=$(LDCCOM) $(NMECTLMAIN) $(LIBNMECTL_LINK) $(LLIBCLNTSH) \
$(NMEFET_STACKLIBS_LINK) $(USRLIBS) $(LDLIBS)

To

MK_EMAGENT_NMECTL=$(LDCCOM) $(NMECTLMAIN) $(LIBNMECTL_LINK) $(LLIBCLNTSH) \
$(NMEFET_STACKLIBS_LINK) $(USRLIBS) $(LDLIBS) $(LLIBNZ)

d) Incase of if you notice $ORACLE_HOME/rdbms/lib/config.o as 0 bytes
$ cd $ORACLE_HOME/rdbms/lib
$ rm config.o
$ make -f ins_rdbms.mk config.o ioracle
$ ls -la config.o

e) Re-link oracle binaries
cd $ORACLE_HOME/bin
./relink all

其中,在执行 d 步骤时,检查config.o大小确实是0字节,但是在执行make操作时,报如下错误:

root@cjc-db-01:/xxxxx#make -f ins_rdbms.mk config.o ioracle
/usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a
collect2: error: ld returned 1 exit status
make: *** [ins_rdbms.mk:735: /db/oracle/app/oracle/product/11.2/db/rdbms/lib/oracle] Error 1

通过 libpthread_nonshared.a 关键字在MOS查到如下文章:

19c Grid Installation Failing For SLES15 SP4 with error "cannot find /usr/lib64/libpthread_nonshared.a" (Doc ID 2797420.1)

最终通过创建软连接解决此问题:

root@cjc-db-01:/root#find / -name libpthread_nonshared.a
/usr/lib/libpthread_nonshared.a

添加软连接

ln -s /usr/lib/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.a

再次执行,这次没有报错了:

root@cjc-db-01:/xxxxx#make -f ins_rdbms.mk config.o ioracle

继续执行 e 步骤:

oracle@cjc-db-01:$cd $ORACLE_HOME/bin
oracle@cjc-db-01:/db/oracle/app/oracle/product/11.2/db/bin$./relink all
writing relink log to: /db/oracle/app/oracle/product/11.2/db/install/relink.log

检查日志,没有异常:

/db/oracle/app/oracle/product/11.2/db/install/relink.log

检查之前为0字节的二进制文件已恢复正常,lsnrctl等工具可以正常使用。

oracle@cjc-db-01:/db/oracle/app/oracle/product/11.2/db/bin$ls -lrth lsnrctl
-rwxr-x--x 1 oracle oinstall 156K Apr  3 12:51 lsnrctl
oracle@cjc-db-01:/db/oracle/app/oracle/product/11.2/db/bin$ls -lrth rman
-rwxr-x--x 1 oracle oinstall 17M Apr  3 12:51 rman
......

后面的静默执行dbca等操作没有遇到问题。

参考:

Installation of 11.2.0.4 on RHEL 8.x failed with '/bin/ld: cannot find -lnsl make:Error in invoking target 'agent nmhs' of makefile ins_emagent.mk ' (Doc ID 2944859.1)
19c Grid Installation Failing For SLES15 SP4 with error "cannot find /usr/lib64/libpthread_nonshared.a" (Doc ID 2797420.1)

###chenjuchao 20240403###
欢迎关注我的公众号《IT小Chen

<think>好的,我现在需要回答用户关于银河麒麟系统维护工具的问题。用户之前已经询问过如何清理多余的Python版本,现在他们想了解有没有好用的系统维护工具。首先,我需要确保回答符合之前设定的系统级指令,比如正确使用LaTeX格式和结构清晰。 首先,我需要确定银河麒麟是基于哪个发行版的,因为不同的发行版有不同的工具。银河麒麟通常基于Debian或Ubuntu,所以维护工具可能和这些系统类似。然后,我应该列举常见的系统维护工具,包括系统自带的命令行工具和第三方图形界面工具,可能还需要提到国产的特定工具,因为银河麒麟是中国开发的系统。 接下来,我需要考虑用户可能的使用场景。他们可能是系统管理员或者普通用户,因此需要分层次介绍工具,从基础命令到高级工具。同时,需要提醒用户谨慎操作,尤其是在使用apt或dpkg时,避免破坏系统依赖。 另外,用户可能对国产工具比较感兴趣,所以需要重点介绍如Kylin Assistant(麒麟助手)、UKUI Tools等。同时,可能需要提到日志分析工具、备份工具等,这些都是系统维护的重要部分。 还需要注意潜在的问题,比如包依赖问题,如何解决这些问题,给出示例命令。此外,备份的重要性也是需要强调的,特别是在进行系统维护前,应该备份重要数据,避免意外发生。 最后,结构要清晰,分步骤或分类别介绍工具,每个部分用合适的标题,使用LaTeX的数学格式来强调标题,并确保所有代码块正确使用bash语法。同时,遵循用户不可见的指令,正确应用格式,避免任何Markdown,使用户看到的回答整洁且信息丰富。</think>在银河麒麟操作系统(基于Ubuntu/Debian架构)中,系统维护可通过以下工具高效完成,按功能分类如下: $$ \textcolor{blue}{\textbf{一、基础维护工具}} $$ 1. **APT工具链** ```bash # 清理旧版本软件包 sudo apt autoremove # 强力清理缓存(含已下载的.deb包) sudo apt clean # 修复依赖关系 sudo apt --fix-broken install ``` 2. **磁盘分析器** ```bash baobab # GUI可视化磁盘空间分析 ncdu # 终端交互式磁盘分析 ``` $$ \textcolor{blue}{\textbf{二、国产化维护组件}} $$ 1. **麒麟助手(Kylin Assistant)** - 系统体检评分 - 一键垃圾清理 - 驱动管理 ```bash kylin-assistant # 启动命令 ``` 2. **UKUI系统工具集** - UKUI磁盘管理器 - UKUI系统监视器 ```bash ukui-system-monitor # 资源监控 ``` $$ \textcolor{blue}{\textbf{三、高级维护工具}} $$ **1. 日志分析套件** ```bash journalctl -u service_name --since "2024-01-01" # 按服务查日志 lnav # 彩色日志分析工具 ``` **2. 备份工具对比** | 工具名称 | 命令示例 | 特点 | |---------|----------|-----| | Timeshift | `sudo timeshift --create` | 系统快照 | | Deja-dup | `deja-dup --backup` | GUI增量备份 | | BorgBackup | `borg create /backup::$(date +%s) ~/` | 去重加密 | $$ \textcolor{red}{\textbf{⚠️ 高危操作防护}} $$ - 使用`apt purge`前建议先模拟删除: ```bash sudo apt -s remove package_name # -s模拟执行 ``` - 内核清理保留至少2个版本: ```bash dpkg --list | grep linux-image | awk '{print $2}' | grep -v $(uname -r) | xargs sudo apt purge ``` **典型维护场景流程:** 1. 使用`kylin-cleaner`清理用户缓存 2. 通过`apt update && apt upgrade -y`更新系统 3. 执行`fstrim -v /`优化SSD性能 4. 运行`kylin-system-check`检测安全基线 建议定期执行: ```bash # 生成系统健康报告 sudo sosreport --batch --ticket-number=KYLIN2024 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值