|
|

楼主 |
发表于 2005-2-7 18:03:35
|
显示全部楼层
接上
三、源代码分发软件包的安装与卸载
Linux软件的源代码分发是指提供了该软件所有程序源代码的发布形式,需要用户自己编译成可执行的二进制代码并
进行安装,其优点是配置灵活,可以随意去掉或保留某些功能/模块,适应多种硬件/操作系统平台及编译环境,缺点是
难度较大,一般不适合初学者使用。
(1)、*.src.rpm形式的源代码软件包
说明:
rpm --rebuild *.src.rpm命令将源代码编译并在/usr/src/dist/RPMS下生成二进制的rpm包,然后再安装该二进制包即可。
packgename如前所述。
安装:
# rpm -rebuild *.src.rpm
# cd /usr/src/dist/RPMS
# rpm -ivh *.rpm
卸载:
# rpm -e packgename
(2)、*.tar.gz/*.tgz、*.bz2形式的源代码软件包
说明:
强烈建议解压后先阅读说明文件,可以了解安装有哪些需求,有必要时还需改动编译配置。有些软件包的源代码在
编译安装后可以用make install命令来进行卸载,如果不提供此功能,则软件的卸载必须手动删除。由于软件可能将文件
分散地安装在系统的多个目录中,往往很难把它删除干净,那你应该在编译前进行配置,指定软件将要安装到目标路径
:./configure --prefix=目录名,这样可以使用“rm -rf 软件目录名”命令来进行干净彻底的卸载。与其它安装方式相比,
需要用户自己编译安装是最难的,它适合于使用Linux已有一定经验的人,一般不推荐初学者使用。
安装:
# tar zxvf *.tar.gz 或 tar yxvf *.bz2
//执行该命令后,安装文件按路径,解压缩在当前目录下。用ls命令可以看到解压缩后的文件。通常在解压缩后产生的
//文件中, 有“Install”的文件。该文件为纯文本文件,详细讲述了该软件包的安装方法。
//执行解压缩后产生的一个名为configure的可执行脚本程序。它是用于检查系统是否有编译时所需的库,以及库的版本
//是否满足编译的需要等安装所需要的系统信息。为随后的编译工作做准备。命令为: ./configure
# cd /解压后的目录
# ./configure
// 如果您想把软件安装到指定目录,应该用#./configure --prefix=/您自己指定的目录,比如我想把一个mlterm安装
//到/opt/mlterm目录中,应该如下输入: ./configure --prefix=/opt/mlterm
// 检查通过后,将生成用于编译的MakeFile文件。此时,可以开始进行编译了。编译的过程视软件的规模和计算机性能的
//不同,所耗费的时间也不同。命令为:make。
# make
// 成功编译后,键入如下的命令开始安装:
# make install
//安装完毕,应清除编译过程中产生的临时文件和配置过程中产生的文件。键入如下命令:
# make clean
// make clean是用来清除make install编译时留下的无用文件。建议安装完后马上做好清理工作
# make distclean
卸载:
# make uninstall 或 手动删除
//彻底的删除只好查看安装脚本,看看文件都装到哪里了。不知道有没有可以监视记录安装过程且可以反安装的软件。
//可以试试CleanDisk这个运行在Linux下清理硬盘垃圾文件的工具(下载参考):
//http://www.linuxeden.com/download/s....php?softid=620
** 有人问怎么知道一个tar.gz/bz2包是二进制文件包呢还是源代码包?如果你用过压缩工具就会明白,压缩包未必就是软件,
它也可能是备份的许多图片,也可能是打包在一起的普通资料,要分辨它到底是什么最好的办法就是查看包里的文件清单,使
用命令tar ztvf *.tar.gz / tar ytvf *.bz2或者在X-Window下使用图形化的ArK压缩档案管理工具都可以,源代码包里的文件往往
会含有种种源代码文件,头文件*.h、c代码源文件*.c、C++代码源文件*.cc/*.cpp等;而二进制包里的文件则会有可执行文件
(与软件同名的往往是主执行文件),标志是其所在路径含有名为bin的目录(仅有少数例外)。
补充(一):
-----------------------------------------
兄弟,你是以什么方式安装的?
先谈谈rpm吧。。一般我安装rpm的话,我通常先不着急着安装,我先会看一下rpm里的文件列表,运行命令rpm -qpl *.rpm,就可以知道文件将要安装的路径了。。
原码方式安装的话,在make install的那一步,系统也会显示文件会复制到那个文件夹下去的,如果想更改软件的安装路径,在./configure的时候加上参数profix来定义新路径。。
至于兄弟想知道新安装的程序的可执行文件在那里的话,我在这里介绍一下我的方法,一般我得到一个新的rpm或者新的源码包的话,我会注意安装文件也就是rpm或者源码压缩包的文件名,比如兄弟上面提到的realplay,具体的应该是realplay*.*.rpm或者realplay*.*.tgz等等,我一般等安装好以后,利用bash的tab键自动补全功能查找程序启动的命令,比如realplay的话,我只要输入rea然后按tab,系统就会把realplay程序列出来了。。哈哈。。
还有很多种方法,比如还是用rpm的查询文件列表功能rpm -qpl观察文件列表,一般可执行程序一般在/bin、/sbin、/usr/sbin、/usr/bin、/usr/local/bin等目录下,仔细观察就一目了然了。。哈哈。。希望对兄弟能有所帮助。。哈
------------------------------------------------------------------------------------
驱动程序的模块应该是在/etc/modules/$kernelversion/kernel/drivers下.
man find!
whereis 名称
你的realplayer8是什么安装格式的?我的是bin的,安装起来和在windows下一样,也可自己改变路径!
rpm的话,用rpm -qpi ****.rpm来查看路径!
readme或install文件中一般会告诉你的.
我安装两个软件后,都给加到setup里去了。我不知道如何删除它们啊。
查看/usr/share/applications
/usr/share/apps
******************************************
补充(二): 软件包管理软件介绍
---------------------------------------------------------
源代码包(如tar.gz包)的卸载软件make_uninstall介绍
请大家看看这个,,那么没有make uninstall(注意这个不是make_uninstall)的源代码安装软件的卸载可以用make_uninstall
这里有下载http://www.ibiblio.org/pub/Linux/ut...ll-2.0.8.tar.gz
下面是它的说明文件,很简单的,不想翻译啦.希望大家看得懂.不懂可以问..下面再介绍另一个源代码卸载软件.
===========================================================================
Make uninstall v2.0.8 Kent Robotti <robotti@godmail.com> 2/27/2002
This script is used to monitor a command like 'make install',
so a record of the install can be created, which will allow
you to completely remove the package from your system later.
Usually when you compile a package you do './configure ; make ; make install'.
Instead of the 'make install' step do 'mku', and choose
'Monitor' from the menu.
Example: ./configure ; make ; mku
You can see a listing for each installed package in
/var/log/uninstall/packages/package_name.
You can also create a database in "/var/log/uninstall/configure" with
the configure and make rules you want for a particular source package.
Run 'mku' and choose 'Cconfigure' then 'Create' from the menu, to create
the configure rules file.
For example, these are the configure and make rules i want
for the 'fetchmail' source package.
# Configure and make rules for 'fetchmail'.
./configure --prefix=/usr --disable-nls --enable-SDPS \
--enable-RPA --enable-NTLM --with-ssl=/usr/lib
make CFLAGS="-Os -march=i386 -Wall" LDFLAGS="-s"
# http://www.foo.com/home_page_for_package_source
# ftp://ftp.foo.com/pub/ftp_directory_for_package_source
Put a '\' at the end of each configure and make line if there's more than
one, except the last. You can put some notes after '#' if you want.
Then when you want to configure and make a package start 'mku',
and choose 'Configure' then 'Run' from the menu.
You'll have the option of creating a slackware tgz, debiam deb, rpm, or
generic x.mku.tgz package of the install, after the install or later
using /var/log/uninstall/packages/package_name as the guide.
The Monitor option isn't needed if you create a configure rules
file, and use the Configure option to Run it.
To install 'mku' run './INSTALL'.
If you want to compile installwatch.so, do this.
installwatch-0.6.2# make
Then you can put that installwatch.so in /usr/lib.
ATTENTION! If you have a "static" /bin/ln move it to /bin/sln, and
put a non static version in it's place.
# ldd /bin/ln
statically linked
If you have a freebsd system this means the same thing as "static".
# ldd /bin/ln
not a dynamic executable
The source for the installwatch.so program v0.6.3
used with make_uninstall, can be found here.
http://asic-linux.com.mx/~izto
The license for make_uninstall is GNU GPL.
===========================================================================
nstallation Utility (instutil)这个也是为了那些源代码包中没有自带make uninstall(非make_uninsta)而做?
具体方法如下有说明:
更具体请看http://freshmeat.net/projects/instutil/
下载地址:http://freshmeat.net/redir/instutil...il-0.0.7.tar.gz
其实呢?大家可以多看看freshmeat.net里面的软件,有好多的是关于源代码包的卸载软件的!
Installation Utility (instutil) is a little Python script with
which you can keep track of software that you want to install
from source. Since version 0.0.4 instutil can install packages
with InstallWatch. If the package doesn't have a "make uninstall"
script or you have deleted the source directory, instutil will
check if you have installed the package with InstallWatch; in this
case the package can be removed using the file list created by
parsing the log file of InstallWatch.
Since version 0.0.7 instutil has a config file in ~/.instutil/config
and installwatch 0.6.3 is included in the package, for more information
read INSTALL file.
* Options List *
This is the complete list options
--help
Print a list of available options
--version
Print the instutil version
-d [FILE] or --data=[FILE]
FILE is used as package database instead of
the default $HOME/.instutil.data
-u or --user=[NAME]
with this option you can use instutil using
the config file and database of user NAME, but
only if you have permissions. However you cannot
create a new config file even if you are root.
-T or --test [PACK]
check the file list of PACK and check if the files still
exist; if no argument is given instutil will check all
files in database
-t or --tracelevel=[0~3]
Set the output level:
0: silent
1: only errors are printed
2: important events
3: all
-l or --list
Print a list of packages installed with instutil
print name and version.
-L or --long-list
Print a list of packages installed with instutil
print name, version, description, installation time and
source directory.
-o [FILE] or --owner [FILE]
Find in database the package that has in its list FILE and
print its name. I wrote this function thinking to the rpm option:
# rpm -qf [FILE]
-s or --sources
Install a compiled package with "make install" or a custom
command if given.
Instutil will check if the package is already installed and
if it's a newer or older version
-c or --complete configure-options
Install with configure, make, make install. To use configure
options append it to command line without "--". For example:
# instutil -c prefix=/usr disable-feature
-C [CMD] or --custom [CMD]
With this option you can choose a command to use to install
the package. Example:
# instutil -s -C "./install"
-u [PACKAGE] or --uninstall [PACKAGE]
With this option you can choose to unistall PACKAGE. You have to
use the name present in database. If you don't give a PACKAGE
name instuil will give you a promt to type the name
-i or --with-instwatch
Giving this option, the installation will be made by InstallWatch
and a file list will be created.
-f [PACK_NAME] or --file--list [PACK_NAME]
Print the file list of PACK_NAME; it works only if you have
installed the package with InstallWatch
-r [PACK_NAME] or --rm-entry [PACK_NAME]
Remove from database the entry PACK_NAME; useful if instutil
has encountered some error during uninstallation
------------------------------------------------
git,checkinstall,itrace,install-watch,install-log.
------------------------------------------------
*软件包卸载和管理工具 git
Linux From Scratch: 版本 20021030
前一页 Chapter 10. 我们中国人的 LFS 后一页
这是 tram 安装 LFS 中使用的包管理工具。在 LFS 中,有很多的包管理工具可以选择,更多的尝试还有待进行。如果你有新的尝试,不妨把它充实到这个文档里来。
git的设置和使用
安装 LFS 的一个大问题是怎么管理和卸载软件包。LFS 中没有 rpm,那么是不是就不能卸载了呢?用git可以做到这个。git的全名是Guarded Installation Tool,是一个单纯的 shell 脚本,它具有下列特点:
*
使用很方便
*
为每一个软件包创建一个卸载脚本
*
不需要其它软件的支持
*
可以设置不监视的目录
*
能告诉你安装了多次的文件的信息
*
可以找出某个安装的文件属于哪一个软件包
下面就说说怎么来安装,设置,和使用 git。当然一开始是要下载,在这里:http://home.wtal.de/ib/download/git-2.14.tar.gz
由于 git 是一个脚本,它的安装简单极了,把包解开,然后拷贝到 /usr/sbin 目录里就行了。
设置 git 。它的设置都保存在脚本的本身中,以 root 身份打开它:
vi /usr/sbin/git
你会看到下面这样:
#!/bin/bash
#
# Guarded Installation Tool, by Ingo Brueckl (ib@wupperonline.de) 14.11.1996
# modified: 06.08.2002
#
# Method for coping with arbitrary filenames that may contain newlines
# and some other stuff were supplied by Rainer Fischer.
# configuration section
#--------------------------------------------------------------------------
SHOWRESULT=yes # default answer to 'Show it?'
FINDCASE=-i # will cause --find to ignore case
PROFILEVAR=*default* # empty, *default*, or individual variable name
PRESERVE=yes # preserve the de-installation script's timestamps
EXPERT=no # non-experts get some additional help
VIEWPROG="less -c" # program used to show results
LSPROG="ls -dC" # program used to list de-installation scripts
EDITPROG=${EDITOR:-vi} # program used to edit de-installation scripts
WATCHDIRS="/bin /boot /dev /etc /lib /opt /sbin /usr /var"
IGNOREDIRS="/var/tmp"
#--------------------------------------------------------------------------
# end of configuration section
这一部份就是我们要修改的设置。我只改了一个地方:
IGNOREDIRS="/var/tmp /usr/src"
这是把 /usr/src 目录排除在它的监视范围。因为我们在安装 LFS 的时候,/usr/src目录里都是源代码,不用卸载。其它的参数都用缺省的就行了。WATCHDIRS 就是它的监视范围。如果一个目录在这个范围内,而它的某个子目录却在 IGNOREDDIRS 里,那么 git 也能正常地工作,它会监视这个目录下除了在 IGNOREDDIRS 里的目录之外的其它目录。
还有一个要设置的地方,把下面这句话加到你的 /etc/profile 里。
eval "$(git --profile)"
这样才能使用git --cd 命令和 $git 环境变量。下面我们会讲到。
git 的使用。第一次使用的时候,它会问你是不是能创建一个目录来放卸载脚本,你应该回答是,如果不这样的话,就不能用 git。这样安装一个包:
./configure --prefix=/usr &&
make &&
git package name &&
make install &&
git package name
也就是在 make install 的前后各运行一次 git。其中 package name 要换成你所安装的包名,名字是随便起的(但不能有斜线),不过为了管理方便,最好起成包的名称加上版本号。比如:textutils-4.2 。
在这些命令之后,它会问你要怎么处理 git 得到的监视信息。你有四个选择:
*
f:结束监视,并创建卸载脚本。
*
s:给出得到的安装信息,比如安装了哪些文件,删除了哪些文件。注意:这时 git 还在监视,所以如果有新的文件变化,它也会记录下来。
*
q:什么也不做,退出监视。
*
r:退出监视,并把 git 内部的准备工作取消。
一般情况下,用 f 来结束监视,可以生成一个名字是 package name 的卸载脚本。所有的卸载脚本都放在 /var/state/git 目录下。你要卸载一个软件的时候:
git --cd &&
./package name
把 package name 换成你要卸载的脚本。你可以打开卸载脚本看看,但不要修改它的头部份,要不然就不能正常工作了。如果有一个文件被安装了两次,在卸载的时候,git 会告诉你它的名字。
下面的命令可以查出某个文件是在安装哪个包的时候装上去的:
git --find /usr/bin/cc
可以把后面换成你要查的文件的路径加上文件名。
git 还有一些高级用法。比如 --depends-on 和 --support-for ,详细的可以看看它的 README 。
git 的缺点是它是根据文件的时间印记来判断这个文件是不是新安装的。所以它不能记录下用 touch 命令创建的文件。不过这也没关系,用 touch 来创建的文件很少,而且 git 也不会错误地把它们删除掉。至少我用到现在,所有的工作都是很正常的,没有错删过文件。在比较大的系统中,用 git 就有点力不从心了。我在 redhat 8里用它,虽然也能工作,不过很慢,这时候可能用 apt-get 和dpkg 会好些。用过 Debian 的人都知道这两个软件是 Debian 的核心,在 LFS 中也能使用,有一篇提示是专门讲它们的。不过到目前为止,我对 git 很满意,安装 Gnome2 的时候也全靠它,所以我还没有尝试过 apt-get 和 dpkg 。
前一页 首页 后一页
用 GRUB 来引导你的系统 上一级 编译内核时的注意事项 |
|