Linux install software
三种安装方式:
网上下载安装,类似windows补丁
源代码包安装
1. 压缩与解压缩:
后缀为gz:gzip压缩。解压:gunzip 文件名 压缩:gzip
后缀bz2:bzip2压缩。解压:bunzup2 文件名 压缩:bzip2
直接使用tar解压。解压:tar xvf 文件名
打包:tar cvf 文件名文件夹
打包加bzip2压缩:tar cvfj 文件名 -C 文件夹
打包加gzip压缩:tar cvfz 文件名 -C 文件夹
Recommendation: target folder /usr/src
2. 运行configure
如果有readme,按照其中要求运行,否则使用:
./configure --prefix=指定安装路径
Recommendation: target folder /usr/local/<software name>
3. 安装过程中报错
例如:显示缺少ncurses-devel
yum search ncurses-devel
yum install ncurses-devel.i386
4. 如果还有其他报错,查看软件帮助,可能需要安装时带参数
5. 输入命令:make
6. 输入命令:make install
7. 到指定安装路径,运行程序
Additional
If error happen, run command "make clear" to clean the files and redo configure.
rpm安装
rpm command to install
rpm -ivh <rpm file>: install application
rpm -uvh <rpm file>: update application
rpm -qf <file>: check file belong to which rpm file
rpm -qpl <rpm file>: check rpm file context
rpm -qpi <rpm file>: check rpm application description
rpm -Vf <rpm file>: verify the rpm file
rpm -k <rpm file>: verify the rpm file
rpm -e <rpm file>: uninstall application
(use command to find out the package name and delete
Example:
rpm -qa|grep -i mysql
rpm -e MySQL-devel-advanced-5.6.20-1.rhel5)
rpm --import RPM-GPG-KEY...: import key file
rpm-build <rpm file>: configure the application
rpm --force <rpm file>: force install
rpm --nodeps <rpm file>: ignore the dependent
rpm --test <rpm file>: test install
rpm file: devel --> head file *.h(system head file /usr/include)
if file end with ".src.rpm", need to use "rpm --recompile <rpm file>" to install
rpm database broken, rebuild rpm database:
1. rpm --initdb
2. rpm --rebuilddb
yum install
默认的RHEL配置的是网络安装,首先需要手工配置。
1. 将RHEL安装光盘mount到文件系统中:
mount /dev/cdrom /mnt/cdrom
2. 检查其中是否有Server和VT两个文件夹,这两个中存放rpm安装包
3. 修改配置文件:/etc/yum.repos.d/rhel-debuginfo.repo
原文:
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
RHEL5 修改:
[Server]
name=Server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
[VT]
name=VT
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=0
name=Server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
[VT]
name=VT
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=0
RHEL 6 修改:
[Package]
name=Package
baseurl=file:///mnt
enabled=1
gpgcheck=0
name=Package
baseurl=file:///mnt
enabled=1
gpgcheck=0
RHEL 7:
[rhel-package]
name=rhel-package
baseurl=file:///mnt
enable=1
gpgcheck=0
4. 验证:yum list
(Linux 6.0) yum grouplist
正常结果能显示出一大堆软件列表。
5. 安装:yum install 安装软件名
yum groupinstall 安装软件系列
例如:yum install gcc
yum groupinstall "X Window System"
CentOS 6.5: yum groupinstall "X Window System" "Desktop"
配置本地yum库(可以自动分析依赖关系)
1. 安装createrepo包
yum install createrepo
2. 将下载的rpm放置到统一的文件夹中
例如:mkdir /yum
cp *.rpm /yum
3. 创建report
cd /
createrepo /yum
4. 修改yum配置文件
vi /etc/yum.repos.d/rhel-debuginfo.repo
添加如下内容:
添加如下内容:
[yum]
name=yum
baseurl=file:///yum
enabled=1
gpgcheck=0
name=yum
baseurl=file:///yum
enabled=1
gpgcheck=0
5. 清空yum记录
yum clean all
6. 新建yum记录
yum list
后续:
直接删除指定安装路径的文件夹即可
yum查询
查看文件来自哪个包:yum whatprovide XXXX
例如:yum whatprovide ld-linux.so.2
搭建FTP的yum
将光盘复制在服务器的/var/ftp/pub下
修改/etc/yum.repos.d/rhel.repo文件
[Server]
name=Server
baseurl=ftp://<ip address>/pub/Server
enabled=1
gpgcheck=0
Yum related parameters
yum clean all = 1. yum clean package + 2. yum clean headers
yum list install: check installed packages
yum install <package name>: install
yum remove <package name>: uninstall
yum search <package name>: check package
yum info <package name>: check the dependency of the package
yum check-update: check update
yum update: install update
Install rpm module (NTFS)
1. download www.linux-ntfs.org
2. install: rpm -ivh kernel-module-ntfs...rpm
3. check the location: rpm -qpl kernel-module-ntfs...rpm
4. If the kernel version is different from the system, copy the ko file into system kenerl folder
mkdir /lib/module/.../ntfs
cp /lib/module/.../ntfs/ntfs.ko /lib/module/.../ntfs/ntfs.ko
5. insert the module:
a. insmod <module>
or b. modprobe ntfs
6. check the module list: lsmod
7. check the dependency of module: modinfo <module>
8. delete module: rmmod <module> or modprobe -r <module>
RHEL7 check yum package: yum whatprovides <item>
enable epel
## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -ivh epel-release-7-5.noarch.rpm
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
## RHEL/CentOS 5 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
## RHEL/CentOS 4 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm
## RHEL/CentOS 4 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/x86_64/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm
When you want to downgrade the package: yum downgrade <package name>
Example
system already installed libstdc++-4.4.7-16.el6.x86_64
but other package need libstdc++-4.4.7-11.el6.x86_64
input command: yum downgrade libstdc++-4.4.7-11.el6.x86_64
Comments
Post a Comment