文件链接_rpm_yum

文件链接分为两种:一种是符号链接(也叫软链接);另外一种是硬链接

软链接其实依赖于源文件,也就是说在文件分配表当中;软链接其实是一个指针;它指向了另外一个文件;我们在使用软链接的时候,需要源文件存在,源文件不存在,链接文件也就无法创建;所谓的符号文件指的就是windows下的快捷方式;通过链接文件找到源文件;软链接可以节省空间,并且可以跨分区进行软链接,做软链接时要加上绝对路径,这样不容易出错。软链接可以是文件也可以是目录

一、符号链接软链接

[root@server ~]# echo 222 > /file222.txt

[root@server ~]#  ln -s /file222.txt /boot/s-file222.txt #符号链接位置,源链接位置

[root@server ~]# ll -i /file222.txt /boot/s-file222.txt

  18 lrwxrwxrwx 1 root root 12 Jun 11 08:14 /boot/s-file222.txt -> /file222.txt

9318 -rw-r--r-- 1 root root  4 Jun 11 08:14 /file222.txt

二、硬链接

硬链接相当于给某个文件做了一个替身类似于克隆,让他们同时指向同一个inode。硬链接只针对文件不可以对目录做硬链接,硬链接也不可以跨分区做。/proc是不可以硬链接的,因为它是一个内存文件系统

我们每次创建一个文件,其实都是创建一个硬链接;对于开发来讲,所谓的删文件就是降低文件的数量

[root@localhost ~]# echo 111 > /file111.txt

[root@localhost ~]# ln /file111.txt /etc

[root@localhost ~]# ln /file111.txt /etc/h-111.txt

[root@localhost ~]# ll -i /file111.txt /etc/file111.txt /etc/h-111.txt

17 -rw-r--r-- 3 ro

ot root 4 Jan 10 16:16 /etc/file111.txt

17 -rw-r--r-- 3 root root 4 Jan 10 16:16 /etc/h-111.txt

17 -rw-r--r-- 3 root root 4 Jan 10 16:16 /file111.txt

注:硬链接

1. 不能跨分区

2. 不支持目录做硬链接(否则出现死循环)

3. 系统可以给目录做硬链接

4. 上面红色数字:是硬链接的个数

 

==安装

[root@localhost ~]# rpm -ivh dos2unix-3.1-37.el6.x86_64.rpm 套件名

[root@localhost ~]# rpm -Uvh ntfs-3g-2011.4.12-5.el6.x86_64.rpm     套件名

参数:

-i          安装

-v         附加信息

-h         显示进度(以#号显示进度,一个#2%

-U         升级

-e         卸载

 

额外选项:

--nomd5 不检验软件包的签名

--force 强制安装软件包

--nodeps            不检查依赖关系直接安装

 

==查询   

(从本地的rpm数据库)(以下名称用的系统识别名)指已经装过了

[root@localhost ~]# rpm -q ntfs-3g -q:查询指定包是否安装

[root@localhost ~]# rpm -qa |grep ntfs            在所有以安装的软件包当中过滤想看的

[root@localhost ~]# rpm -ql ntfs-3g 查询ntfs-3g安装的文件   

[root@localhost ~]# rpm -qf /usr/bin/ntfs-3g     查询该文件属于哪个rpm包做反查询,丢了找回来

[root@localhost ~]# rpm -qi ntfs-3g 查询包的信息

[root@localhost ~]# rpm -qc ntfs-3g     查询某个包安装的配置文件

[root@localhost ~]# rpm -qd vsftpd 查安装的帮助文档

 

 

(rpm套件中查询)(以下名称用的包文件名称)就是文件名

扩展知识: 针对没有安装的包,直接从套件中查询

[root@localhost ~]# rpm -e ntfs-3g

[root@localhost ~]# rpm -qip ntfs-3g-2011.4.12-5.el6.x86_64.rpm   

[root@localhost ~]# rpm -qlp ntfs-3g-2011.4.12-5.el6.x86_64.rpm

[root@localhost ~]# rpm -qcp ntfs-3g-2011.4.12-5.el6.x86_64.rpm

[root@localhost ~]# rpm -qdp ntfs-3g-2011.4.12-5.el6.x86_64.rpm

 

==卸载

[root@localhost ~]# rpm -e ntfs-3g

[root@localhost ~]# rpm -e ntfs-3g --nodeps

额外选项:

--nodeps 忽略依赖关系

 

[root@uplooking ~]# yum clean all //清空缓存(rm -rf /var/cache/yum;sync用这个)

[root@uplooking ~]# yum repolist    //列出软件仓库中所有的软件包数量

[root@uplooking ~]# yum list    //列出软件仓库中所有的软件包

[root@localhost ~]# yum update          //更新以安装的软件包

第二种情况:自定义YUM源,例如下载的第三方rpm软件包,zabbixntfs-3g为例

1.创建软件仓库目录

#mkdir /yum_root

2.把下载的第三方软件(rpm包)放进去

3.建立RPM包依赖关系数据库(repodata)

[root@localhost soft]# yum -y install createrepo #该软件位于Server仓库

[root@localhost soft]# createrepo -v /yum_root #建立依赖关系数据库文件

[root@server ~]# yum localinstall xxx.rpm  #安装本地的rpm包,同时自动安装依赖包

[root@localhost soft]# yum repolist # 验证有没有出现新的 YUM

 

如果反复安装卸载,会造成系统不稳定

 

软件包组管理

[root@localhost ~]# yum grouplist #查询当前软件包组的安装情况

[root@localhost ~]# yum groupinstall "Develoment tools" #安装软件包组

[root@localhost ~]# LANG=C yum grouplist

[root@localhost ~]# LANG=C yum groupinstall "Develoment tools"

 

源码包tarball

其实源码包安装不是特别推荐的,源码包需要提供的支持比较多

源码包安装:

0.释放     tar

1.定制./configure --prefix=目录   autoinstall   setup #--prefix用来指定安装目录是参数

2.编译     make   && make install          注意:编译过程需要开发工具支持

3.安装     make  install           #安装

源码包解开之后会有一个定制脚本,这个定制脚本名字一般不固定;比如是:./configure   autoinstall或者是   setup

 

安装开发工具:

#yum groupinstall  "开发工具"

#LANG=C yum groupinstall "Development tools"

#yum install make* gcc*

 

这个是出现了问题以及解决的方法

其它的二进制软件

==bin格式软件包==

jdk-6u27-linux-i586.bin

[root@localhost software]# chmod a+x jdk-6u27-linux-i586.bin

[root@localhost software]# ./jdk-6u27-linux-i586.bin

 

 

 

源码安装错误示例:

error1:

checking for PCRE JIT support ... found

checking for system md library ... not found

checking for system md5 library ... not found

checking for OpenSSL md5 crypto library ... not found

checking for sha1 in system md library ... not found

checking for OpenSSL sha1 crypto library ... not found

checking for zlib library ... not found

 

./configure: error: the HTTP gzip module requires the zlib library.

You can either disable the module by using --without-http_gzip_module

option, or install the zlib library into the system, or build the zlib library

statically from the source with nginx by using --with-zlib=<path> option.

 

解决方案:

# yum -y install zlib-devel

 

 

error2:

./configure: error: SSL modules require the OpenSSL library.

You can either do not enable the modules, or install the OpenSSL library

into the system, or build the OpenSSL library statically from the source

with nginx by using --with-openssl=<path> option.

 

解决方案:

# yum -y install openssl-devel

 

 

error3:

# ./configure --prefix=/usr/local/pcre-8.31

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/root/pcre-8.31':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

 

解决方案:

# LANG=C yum -y groupinstall "Development tools"

posted @ 2017-06-12 11:00  青牛怪  阅读(262)  评论(0编辑  收藏  举报