dnf install or yum install is run.ping mirrors.tencentyun.com -c 3
cat /etc/resolv.conf# Ensure that the nameserver configuration is correct
# Check the local firewallfirewall-cmd --list-all# Check HTTP accesscurl -I http://mirrors.tencentyun.com/tlinux/
dnf repolistdnf makecache
dnf makecache or dnf repolist is run to synchronize the software repository cache:Error: Failed to synchronize cache for repo '...'
ls /etc/yum.repos.d/
System Version | Standard repo File |
TencentOS Server 3 | TencentOS.repo,epel.repo |
TencentOS Server 4 | TencentOS.repo,epol.repo |
# Back up existing repo filesmkdir -p /etc/yum.repos.d/backupmv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/# View the system versioncat /etc/os-release# Reconfigure the standard repository (TencentOS Server 4, consistent with the system default configuration)cat > /etc/yum.repos.d/TencentOS.repo << 'EOF'[BaseOS]name=TencentOS Server $releasever - BaseOSbaseurl=http://mirrors.tencentyun.com/tlinux/$releasever/BaseOS/$basearch/os/http://mirrors.tencent.com/tlinux/$releasever/BaseOS/$basearch/os/gpgcheck=1enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-TencentOS-4[AppStream]name=TencentOS Server $releasever - AppStreambaseurl=http://mirrors.tencentyun.com/tlinux/$releasever/AppStream/$basearch/os/http://mirrors.tencent.com/tlinux/$releasever/AppStream/$basearch/os/gpgcheck=1enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-TencentOS-4[extras]name=TencentOS Server $releasever - extrasbaseurl=http://mirrors.tencentyun.com/tlinux/$releasever/extras/$basearch/os/http://mirrors.tencent.com/tlinux/$releasever/extras/$basearch/os/gpgcheck=1enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-TencentOS-4EOF
dnf clean alldnf makecache
<package-name> is the actual package name:No match for argument: <package-name>Error: Unable to find a match
cat /etc/os-release
# Search for software packages (fuzzy match)dnf search <keyword># Find which package provides a command or filednf provides /usr/bin/curldnf provides "*/libssl.so*"
# TencentOS Server 4: Enable EPOL (the TencentOS adaptation of EPEL, installed by default in standard images)dnf install -y epol-release# Confirm that the EPOL source configuration file existsls /etc/yum.repos.d/epol.repo# For third-party software (such as Docker), you can add the official repodnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf or yum command is run, an error similar to the following occurs, or the command cannot be executed at all:SyntaxError: invalid syntax
/usr/bin/python symlink), causing the dnf/yum scripts to use an incorrect Python interpreter.# Check the shebang line of /usr/bin/dnfhead -1 /usr/bin/dnf# It should be #!/usr/bin/python3# If it is incorrect, fix itsed -i '1s|.*|#!/usr/bin/python3|' /usr/bin/dnf
head -1 /usr/bin/dnf# It should be #!/usr/bin/python3
python3 command, and do not modify the /usr/bin/python symlink. To manage multiple Python versions, use pyenv:# Use pyenv to manage Python versions (without affecting the system Python)curl https://pyenv.run | bashpyenv install 3.11.0pyenv global 3.11.0
Error: Problem: package X requires Y, but none of the providers can be installed
# View dependenciesdnf deplist <package-name># View the cause of the conflictdnf install --best <package-name># Skip broken dependencies (not recommended, as it may cause system instability)dnf install --skip-broken <package-name># Try to directly download and install the RPM (ignoring repo dependencies)dnf download <package-name>rpm -ivh --nodeps <package>.rpm
GPG key retrieval failed
# Temporarily skip GPG verification (for debugging)dnf install --nogpgcheck <package-name># Import the official Tencent GPG key (built into the system)rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-TencentOS-4# Permanently skip GPG in the repo file (not recommended, as it reduces security)# gpgcheck=0
dnf-related operations are performed:OSError: [Errno 28] No space left on device
# View disk usagedf -h# Clear the dnf cachednf clean all# Cache location: /var/cache/dnf/# Clean up old kernels (keep the current and previous versions)dnf remove $(dnf repoquery --installonly --latest-limit=-2 -q)# View large filesdu -sh /var/cache/dnf/
# Install a software packagednf install -y <package-name># Update all software packagesdnf update -y# Update a single software packagednf update -y <package-name># Remove a software packagednf remove <package-name># Search for software packagesdnf search <keyword># View software package informationdnf info <package-name># List installed software packagesdnf list installed# View software package update historydnf history# Roll back to the last dnf operationdnf history undo last# Clear cachesdnf clean all# Download only without installingdnf download <package-name>dnf download --resolve --alldeps <package-name> # Includes all dependencies
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan