最近在搭建RHEL服务器,有一些命令与ubuntu有区别,记录备忘。
1. 软件源配置
yum安装 (针对RHEL5,使用CentOS yum源)
1.1 yum 重新安装
rpm -aq|grep yum|xargs rpm -e –nodeps #卸载自带的yum
下载yum必备的四个文件,注意先uname -i 查看系统是32位还是64位
wget http://mirrors.163.com/centos/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
32 bit:
wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
64 bit:
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
安装顺序:
1. 安装python环境 rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm
2. 安装所有的yum包:
(64bit) rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
(32bit) rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
注意,如果位数版本不对,会出现ELF错误问题。参考 http://phped.sinaapp.com/?p=31
实验一下yum命令,此时可能出现无法导入yum python module的问题,
具体情况如下:
There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: /usr/lib/python2.4/site-packages/_sqlitecache.so: wrong ELF class: ELFCLASS32 Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
观察应该是Python解析器的问题,可以修改 /usr/bin/yum 的头部,将#!/usr/bin/python 改成 #!/usr/bin/python2.4 (参考 http://blog.sciencenet.cn/blog-400120-325780.html yum更新常见问题 http://hi.baidu.com/software_one/item/4a3c14e3f9485fb22f140bfa)
yum 软件源设置:
1. 修改 /etc/yum.repos.d/CentOS-Base.repo
教育网 yum源可以使用中科大或上海交大的,使用的时候务必到mirror网站看一下目录的位置,因为有可能有变化,上海交大的最新源如下:
CentOS-Base.repo
[base]
name=CentOS-5 – Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=CentOS-5 – Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
[addons]
name=CentOS-5 – Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-5 – Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 – Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#contrib – packages by Centos Users
[contrib]
name=CentOS-5 – Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
–end–
接下来导入密钥
64位:
rpm –import http://ftp.sjtu.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5
32位:
rpm –import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
最后 yum update
提示 更新yum源后,建议更新一下,使操作立即生效 yum makecache
相关资源:
科大centos主页:http://centos.ustc.edu.cn
上海交大CentOS: http://ftp.sjtu.edu.cn/centos/5/
http://louishan.com/articles/centos-cernet-yum-sources.html
http://blog.chinaunix.net/uid-23733724-id-290979.html
http://cicku.me/mirrors-mainland-china/
http://www.linuxidc.com/linux/2010-12/30554.htm
yum安装命令
http://blog.csdn.net/jinhill/article/details/7587840
2. 常用命令
查看系统: uname -i
3.常用软件安装
3.1 git yum install git
3.2 Django + Apache + Mysql + mod 环境安装
http://library.linode.com/frameworks/django-apache-mod-python/centos-5
http://momotor.iteye.com/blog/1576571
http://www.360doc.com/content/12/0322/18/6938655_196712249.shtml
http://www.adintr.com/article/blog/183
http://bbs.linuxtone.org/thread-9315-1-1.html
http://bbs.linuxtone.org/thread-9315-1-1.html
4. 常见问题
4.1 warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
解决方法: install 时,后面加入–nogpgcheck 参数