小Q:温故而知新,可以为师矣;今天看的不少了,回头看几遍。
==========================快速更换国内yum源===========================
1.删除/etc/yum.repos.d目录所有的repo文件
2.下载CentOS-Base-163.repo, 放入/etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS-Base-163.repo -O /etc/yum.repos.d/CentOS-Base-163.repo
//说明,如果163的镜像失效,可以尝试更换为搜狐的镜像 http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
3. rm -rf /var/cache/yum/* 运行yum makecache生成缓存
4.yum search softwarename 查找软件
5.yum list softwarename 列出已装软件
6.yum install softwarename 安装软件
7.yun remove softwarename 卸载软件
--------------------------------------------------------------------------------------
CentOS-Base-163.repo源文件如下:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
====================安装卸载图形界面====================
命令行模式安装图形界面
yum grouplist 检查已安装的组
yum groupinstall "X Window System"
yum groupinstall "GNOME Desktop Environment"
startx
或者init 5
就OK。
如果你的机子设置了中文模式,需要先LANG=en
重新安装了带图形界面模式的centos系统,来实验yum方式卸载图形界面
图形界面想要卸载:
yum groupremove "GNOME Desktop Environment"
yum groupremove "X Window System"
以图形界面安装的linux 卸载图形界面之后会提示错误
init: Id "x" respawning too fast: disabled for 5 minutes
解决的办法是
vi /etc/inittab
找到这段文字 把这段文字中id后面的数字改为3 id:3:initdefault 让系统以文本界面启动
找到这段文字x:5:respawn:/etc/X11/prefdm -nodaemon注释掉!