推荐阅读:
[AI-人工智能]免翻墙的AI利器:樱桃茶·智域GPT,让你轻松使用ChatGPT和Midjourney - 免费AIGC工具 - 拼车/合租账号 八折优惠码: AIGCJOEDISCOUNT2024
[AI-人工智能]银河录像局: 国内可靠的AI工具与流媒体的合租平台 高效省钱、现号秒发、翻车赔偿、无限续费|95折优惠码: AIGCJOE
[AI-人工智能]免梯免翻墙-ChatGPT拼车站月卡 | 可用GPT4/GPT4o/o1-preview | 会话隔离 | 全网最低价独享体验ChatGPT/Claude会员服务
[AI-人工智能]边界AICHAT - 超级永久终身会员激活 史诗级神器,口碑炸裂!300万人都在用的AI平台
一、使用更新源的国内镜像
CentOS 安装完毕,首先应该修改更新源,并升级到最新的系统。
国内速度较快的常用更新源:
http://centos.ustc.edu.cn/centos/
http://Mirrors.163.com/centos/
http://mirrors.sohu.com/centos/
首先备份CentOS-Base.repo,然后再编辑 yum 的配置文件:
[piaoyun@piaoyun-pc ~] sudo vi /etc/yum.repos.d/CentOS-Base.repo
[base] name=CentOS-releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=releasever−Basemirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=os baseurl…releasever/os/basearch/ http://centos.ustc.edu.cn/centos/basearch/http://centos.ustc.edu.cn/centos/releasever/os/basearch/ http://mirrors.163.com/centos/basearch/http://mirrors.163.com/centos/releasever/os/basearch/ http://mirrors.sohu.com/centos/basearch/http://mirrors.sohu.com/centos/releasever/os/ParseError: KaTeX parse error: Expected 'EOF', got '#' at position 83: …-KEY-CentOS-5 #̲released update…releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲arch=basearch&repo=updates baseurl=http://mirror.centos.org/centos/releasever/updates/releasever/updates/basearch/ http://centos.ustc.edu.cn/centos/releasever/updates/releasever/updates/basearch/ http://mirrors.163.com/centos/releasever/updates/releasever/updates/basearch/ http://mirrors.sohu.com/centos/releasever/updates/releasever/updates/basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-releasever - Addons mirrorlist=http://mirrorlist.centos.org/?release=releasever−Addonsmirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=addons bas…releasever/addons/basearch/ http://centos.ustc.edu.cn/centos/basearch/http://centos.ustc.edu.cn/centos/releasever/addons/basearch/ http://mirrors.163.com/centos/basearch/http://mirrors.163.com/centos/releasever/addons/basearch/ http://mirrors.sohu.com/centos/basearch/http://mirrors.sohu.com/centos/releasever/addons/ParseError: KaTeX parse error: Expected 'EOF', got '#' at position 83: …-KEY-CentOS-5 #̲additional pack…releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲arch=basearch&repo=extras baseurl=http://mirror.centos.org/centos/releasever/extras/releasever/extras/basearch/ http://centos.ustc.edu.cn/centos/releasever/extras/releasever/extras/basearch/ http://mirrors.163.com/centos/releasever/extras/releasever/extras/basearch/ http://mirrors.sohu.com/centos/releasever/extras/releasever/extras/basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=releasever−Plusmirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=centosplus…releasever/centosplus/basearch/ http://centos.ustc.edu.cn/centos/basearch/http://centos.ustc.edu.cn/centos/releasever/centosplus/basearch/ http://mirrors.163.com/centos/basearch/http://mirrors.163.com/centos/releasever/extras/basearch/ http://mirrors.sohu.com/centos/basearch/http://mirrors.sohu.com/centos/releasever/extras/ParseError: KaTeX parse error: Expected 'EOF', got '#' at position 93: …-KEY-CentOS-5 #̲contrib - packa…releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲arch=basearch&repo=contrib baseurl=http://mirror.centos.org/centos/releasever/contrib/releasever/contrib/basearch/ http://ftp.sjtu.edu.cn/centos/releasever/contrib/releasever/contrib/basearch/ http://mirrors.163.com/centos/releasever/extras/releasever/extras/basearch/ http://mirrors.sohu.com/centos/releasever/extras/releasever/extras/basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
repositoryid:用于指定一个仓库
name:用于指定易读的仓库名称
baseurl:用于指定本仓库的URL,可以是以下的3种类型,如http,ftp,file
mirrorlist:用于指定仓库的镜像站点
enable:用于指定是否使用本仓库,默认值为1,即可用。
gpgcheck:用于指定是否检查软件包的GPG签名。
gpgkey:用于指定GPG签名文件的URL。
执行命令:
[piaoyun@piaoyun-pc ~]$ sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
二、使用非官方更新源
下面以安装rpmforge和DAG软件包为例添加非官方更新源
I、添加rmpforge软件库
1)到http://dag.wieers.com/rpm/packages/rpmforge-release/查找适用于RHEL5/CentOS5的软件包。
2)下载适用于RHEL5/CentOS5的软件包。
[piaoyun@piaoyun-pc ~] sudo rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[piaoyun@piaoyun-pc ~]$ sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-*
安装rpmforge-release软件包之后,就可以看到/etc/yum.repos.d/rpmforge.repo文件,以后yum就可以使用这个更新源了。
三、使用如下命令更新到最新系统:
yum check-update
yum -y update
yum upgrade
使用yum update更新时,默认会升级内核。但有些服务器硬件(特别是组装的机器)在升级内核后,新的内核可能会认不出某些硬件,要重新安装驱动,很麻烦。所以在生产环境中不要轻易的升级内核,除非你确定升级内核后不会出现麻烦的问题。
CentOS使用yum update升级时,默认包含升级内核!比如从CentOS 6.2升级到CentOS 6.4
如果不想升级内核而只更新其他软件包,有两种方法:
1、修改yum的配置文件 vim /etc/yum.conf,在[main]的最后添加
exclude=kernel* centos-release*
2、直接在yum的命令后面加上如下的参数:
yum --exclude=kernel* centos-release* update
四、安装必要的软件工具
yum -y install --skip-broken yum-fastestmirror build-essential gcc gcc-c++ bzip2 make vixie-cron flex ncurses-devel wget patch ntp libxml2 libxml2-devel libevent m4 autoconf zip unzip libjpeg libjpeg-devel gd gd-devel freetype freetype-devel libpng libpng-devel openssl openssl-devel file libtool libtool-libs libtool-ltdl-devel gmp-devel pspell-devel parted zlib mod_perl-devel ftp readline-devel apr apr-util curl-devel pam pam-devel lynx libmcrypt-devel libmhash-devel sudo glibc glibc-devel perl perl*
宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取
本文标签属性:
CentOS:centos与ubuntu哪个好