首页 > 代码库 > Centos小白学习

Centos小白学习

以前用ubuntu比较多,但服务器要求,决定开始学习Centos

1.安装完Centos后桌面宽度不能自适应

 如果使用的是 gnome, 点击菜单 "System -> Preferences -> Display,调整分辨率

2.Centos安装FireFox,原装的反应很慢

解压

# cd /usr/local
# su -c "tar zxvf /home/wandering/firefox-2.0.0.5.tar.gz"

替换

# which firefox
/usr/bin/firefox
# mv /usr/bin/firefox /usr/bin/firefox-1.5.0.9
# ln -s /usr/local/firefox/firefox /usr/bin/firefox

命令行下:firefox

小知识:

.tar.gz     格式解压为          tar   -zxvf   xx.tar.gz

.tar.bz2   格式解压为          tar   -jxvf    xx.tar.bz2

3.yum更新源

Centos软件安装工具yum,系统默认使用的是国外的centos更新源,导致默认更新源安装或者更新软件时速度很慢的问题,需要将默认的yum更新源配置为国内的更新源。yum更新源配置文件位于centos目录  /etc/yum.repos.d/ 下。

国内速度较快的常用更新源如下:
http://mirrors.163.com/centos/ 163-网易
http://mirrors.ta139.com/centos/ 中国移动通信(山东移动)
http://centos.ustc.edu.cn/centos/ 中国科学技术大学
http://mirror.neu.edu.cn/centos/ 东北大学

编辑yum配置文件: 
#vi /etc/yum.repos.d/CentOS-Base.repo

[base]name=CentOS-$releasever - Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/http://mirrors.ta139.com/centos/$releasever/os/$basearch/http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/http://mirror.neu.edu.cn/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-$releasever - Updatesmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/http://mirrors.ta139.com/centos/$releasever/updates/$basearch/http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/http://mirror.neu.edu.cn/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/http://mirrors.ta139.com/centos/$releasever/extras/$basearch/http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/http://mirror.neu.edu.cn/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/http://mirrors.ta139.com/centos/$releasever/centosplus/$basearch/http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/http://mirror.neu.edu.cn/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/http://mirrors.ta139.com/centos/$releasever/contrib/$basearch/http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/http://mirror.neu.edu.cn/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

从以上配置文件可以看出,需要根据各家源情况 有选择的配置 [base]  [updates]  [addons]  [extras]  [centosplus]   这几项。

每一项只要修改baseurl 和gpgkey 为相应源地址即可。

然后使用如下命令更新到最新系统:

#rpm –import /etc/pki/rpm-gpg-key*

#yum upgrade

以上配置结束之后,要清空yum 缓存,并重建yum缓存,执行以下命令:

yum clean all && yum clean metadata && yum clean dbcache && yum makecache && yum update

 

Centos小白学习