apt的那些事

http://pkgs.repoforge.org/apt/


-----------------------------------------------------------


 安装APT工具:
  # wgethttp://redhat.uni-klu.ac.at/el3/apt.i386.rpm
 # rpm -Uvh apt.i386.rpm
  其它的主要就 是设置sources.list的问题了。进入/etc/apt/sources.list.d/目录下设置一些源就OK了。
  网上找的一些源如下:
#dag.list
rpmhttp://afs.caspur.it/ afs/italia/project/linux/cern/slc302/i386/apt os updates extras
rpmhttp://redhat.uni-klu.ac.at redhat/dag/el3/i386 dag
rpm-srchttp://redhat.uni-klu.ac.at redhat/dag/el3/i386 dag
rpmhttp://apt.sw.be redhat/el3/en/i386 dag
rpm-srchttp://apt.sw.be redhat/el3/en/i386 dag
如果是KDE的一些软件,下面的源比较有用:
#kde.list
rpmhttp://apt.kde-redhat.org apt/fedora/3.0 stable
rpmhttp://apt.kde-redhat.org apt/fedora/all stable
rpmhttp://apt.kde-redhat.org apt/kde-redhat/3.0 stable unstable
rpmhttp://apt.kde-redhat.org apt/kde-redhat/all stable unstable
如果需要更多Java相关软件,则:
#vi /etc/apt/sources.list.d/jpackage.list
rpmhttp://redhat.uni-klu.ac.at redhat/jpackage/redhat-es-3/i386 free devel
rpm-srchttp://redhat.uni-klu.ac.at redhat/jpackage/redhat-es-3/i386 free devel
rpmhttp://redhat.uni-klu.ac.at redhat/jpackage/redhat-es-3/generic free devel
rpm-srchttp://redhat.uni-klu.ac.at redhat/jpackage/redhat-es-3/generic free devel
比较好用的是CERN的linux站点,如下:
rpmhttp://linuxsoft.cern.ch cern/slc30X/i386/apt os updates extras
rpm-srchttp://linuxsoft.cern.ch cern/slc30X/i386/apt os updates extras
rpmhttp://ftp.kddilabs.jp Linux/packages/scientificlinux/30x/i386/apt-rpm os updates
rpm-srchttp://ftp.kddilabs.jp Linux/packages/scientificlinux/30x/i386/apt-rpm os updates
rpmhttp://ftp.ne.jp Linux/distributions/scientificlinux/30x/i386/apt-rpm os updates
rpm-srchttp://ftp.ne.jp Linux/distributions/scientificlinux/30x/i386/apt-rpm os updates
rpmhttp://mirror.switch.ch ftp/mirror/scientificlinux/30x/i386/apt-rpm os updates
rpm-srchttp://mirror.switch.ch ftp/mirror/scientificlinux/30x/i386/apt-rpm os updates
rpm ftp://linux.fnal.gov /linux/scientific/30x/i386/apt-rpm os updates
rpm-src ftp://linux.fnal.gov /linux/scientific/30x/i386/apt-rpm os updates
保存退出后
#apt-get update
#apt-get upgrade
#apt-get check //检查依赖性
#apt-get -f install // 解决依赖性问题
然后apt-get install XXX 就可以安装需要的软件包啦。
如果要安装某工具,比如说iftop,可以这样:
#apt-cache search iftop   
#apt-get install iftop
apt自动解决依赖性问题,方便得很。


----------------------------------------------------------------------------------------------------



apt-rpm的套件可以在这找你OSArch的版本

http://packages.sw.be/apt/


CentOS 5i386的版本为例

wget http://packages.sw.be/apt/apt-0.5.15lorg3.94a-4.el5.rf.i386.rpm

安装套件

rpm -Uvh apt-0.5.15lorg3.94a-4.el5.rf.i386.rpm

然后去改一下 sources.list

cp /etc/apt/sources.list.d/os.list /etc/apt/sources.list

vi /etc/apt/sources.list

 

  

repomd ftp://ftp.isu.edu.tw/pub/Linux/CentOS $(VERSION)/os/$(ARCH)

repomd ftp://ftp.isu.edu.tw/pub/Linux/CentOS $(VERSION)/updates/$(ARCH)

repomd ftp://ftp.isu.edu.tw/pub/Linux/CentOS $(VERSION)/extras/$(ARCH)

repomd ftp://ftp.isu.edu.tw/pub/Linux/CentOS $(VERSION)/fasttrack/$(ARCH)

repomd ftp://ftp.isu.edu.tw/pub/Linux/CentOS $(VERSION)/addons/$(ARCH)

repomd ftp://ftp.isu.edu.tw/pub/Linux/CentOS $(VERSION)/centosplus/$(ARCH)

repomd ftp://ftp.twaren.net/Linux/CentOS $(VERSION)/os/$(ARCH)

repomd ftp://ftp.twaren.net/Linux/CentOS $(VERSION)/updates/$(ARCH)

repomd ftp://ftp.twaren.net/Linux/CentOS $(VERSION)/extras/$(ARCH)

repomd ftp://ftp.twaren.net/Linux/CentOS $(VERSION)/fasttrack/$(ARCH)

repomd ftp://ftp.twaren.net/Linux/CentOS $(VERSION)/addons/$(ARCH)

repomd ftp://ftp.twaren.net/Linux/CentOS $(VERSION)/centosplus/$(ARCH)


安装一下 GPG keys

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*   ---安装证书

apt-get update

apt-get upgrade


第一次跑可能需要先这样一下

apt-get –fix-broken install

完成!



apt是Debian系列的Linux发行版所采用的软件包管理工具,可能因为我接触的第一个管理器就是apt-get,所以我对他一直情有独钟,就算后来把系统换成了Fedora也一直想用apt来替代系统自带的yum。在RHEL和Fedora6下我曾经尝试过这样作,但是结果并不理想。现在好了,Fedora 8的官方源里面已经加入了apt,现在可以随心所欲的使用这个强大的工具了。

1.apt的安装
apt的安装需要以下软件包:

apt-devel-0.5.15lorg3.93-2.fc8
apt-0.5.15lorg3.93-2.fc8
fedora-package-config-apt-8-1

但是在实际安装的时候,如果已经设置好了yum的源,可以直接输入:
yum install apt
这样就可以了,很简单。

2.apt的使用
很喜欢使用apt-get时候系统的那句提示:This APT has Super Cow Powers(本apt具有超级牛力!),很有意思。

主要命令如下:

update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.rpm)
remove - Remove packages
source - Download source archives
build-dep - Configure build-dependencies for source packages
dist-upgrade - Distribution upgrade, see apt-get(8)
clean - Erase downloaded archive files
autoclean - Erase old downloaded archive files
check - Verify that there are no broken dependencies


在 Fedora 上安装 APT 系统

目录

  [隐藏]
  • 1 下载和安装 apt 的 rpm 套件包
    • 1.1 转换下载服务器
  • 2 相关页面
  • 3 相关连结
[ 编辑]

下载和安装 apt 的 rpm 套件包

到 Fedora Extras 下载 APT 的 RPM 套件包。


  • Fedora 10
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Everything/i386/os/Packages/apt-0.5.15lorg3.94-4.fc10.i386.rpm
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Everything/i386/os/Packages/fedora-package-config-smart-9.89-14.i386.rpm


  • Fedora 9
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Everything/i386/os/Packages/apt-0.5.15lorg3.94-3.fc9.i386.rpm
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Everything/i386/os/Packages/fedora-package-config-apt-8.92-1.noarch.rpm
  • Fedora 8
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Everything/i386/os/Packages/apt-0.5.15lorg3.93-2.fc8.i386.rpm
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-package-config-apt-7.89-8.noarch.rpm
  • Fedora 7
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/i386/os/Fedora/apt-0.5.15lorg3.2-9.fc7.i386.rpm
wget http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/i386/os/Fedora/fedora-package-config-apt-6.89-6.noarch.rpm
  • Fedora Core 6 - 打以下命令:
wget http://fedoraproject.org/extras/6/i386/apt-0.5.15lorg3.2-9.fc6.i386.rpm
wget http://fedoraproject.org/extras/6/i386/fedora-package-config-apt-6-5.noarch.rpm
  • Fedora Core 5 - 打以下命令:
wget http://fedoraproject.org/extras/5/i386/apt-0.5.15lorg3.2-9.fc5.i386.rpm
  • Fedora Core 4 - 打以下命令:
wget http://fedoraproject.org/extras/4/i386/apt-0.5.15lorg3.2-9.fc4.i386.rpm
  • Fedora Core 3 - 打以下命令:
wget http://fedoraproject.org/extras/3/i386/apt-0.5.15cnc7-1.i386.rpm

安装下载了的apt rpm套件包:

su -c 'rpm -Uvh apt-X.X.XX-X.i386.rpm'
[ 编辑]

转换下载服务器

使用「apt-get mirror-select」转换下载服务器:

# apt-get mirror-select

Fetching list of repositories/mirrors...

Choose the repositories you want to use from the list below:
1       Fedora Core
2       Fedora Extras
3       Macromedia

When finished choose 'c' to continue or choose 'q'
to quit repository selector without changing anything.
Enter your selection(s) in a comma-separated list:
1	<--输入 '1','2' 或 '3' 选择上述的分类。

Choose the repositories you want to use from the list below:
1 (x)   Fedora Core
2       Fedora Extras
3       Macromedia

When finished choose 'c' to continue or choose 'q'
to quit repository selector without changing anything.
Enter your selection(s) in a comma-separated list:
c	<--输入 'c' 进入下一选项。

Choose the geographically nearest mirror(s)for use with:

  Fedora Core
1       University of Southern California, USA
2       Kernel.org, San Francisco California, USA
3       University Aachen, Germany
4       Technical University Chemnitz, Germany
5       University of Applied Sciences Esslingen, Germany
6       Multikabel N.V. Alkmaar, The Netherlands
7       SdV Plurim蒙dia, Strasbourg, France
8       SunSite RedIRIS, Madrid, Spain
9       University of Hawaii Honolulu, Hawaii, USA

When finished choose 'c' to continue or choose 'q'
to quit repository selector without changing anything.
Enter your selection(s) in a comma-separated list:
2	<--输入 '1' 至 '9' 选择上述的分类。

Choose the geographically nearest mirror(s)for use with:

  Fedora Core
1       University of Southern California, USA
2 (x)   Kernel.org, San Francisco California, USA
3       University Aachen, Germany
4       Technical University Chemnitz, Germany
5       University of Applied Sciences Esslingen, Germany
6       Multikabel N.V. Alkmaar, The Netherlands
7       SdV Plurim dia, Strasbourg, France
8       SunSite RedIRIS, Madrid, Spain
9       University of Hawaii Honolulu, Hawaii, USA

When finished choose 'c' to continue or choose 'q'
to quit repository selector without changing anything.
Enter your selection(s) in a comma-separated list:
c	<--输入 'c' 进入下一选项。

Writing source list entries...
Done.


下载服务器资料会纪录在 /etc/apt/sources.list.d/mirror-select.list 如下

# DO NOT EDIT ME!  Use "apt-get mirror-select" instead.
# Fedora Core (Kernel.org, San Francisco California, USA)
rpm http://mirrors.kernel.org/fedora.us/fedora fedora/6/i386 os updates

您亦可以直接修改档案 /etc/apt/sources.list 改变下载服务器。



Debian 增加 add-apt-repository 命令

   注意:使用该命令有可能导致Debian系统出现不稳定情况。

   对于Ubuntu用户来说,安装一些PPA上的软件是一件简单的事情,然而对于Debian用户来说你经常会碰到如下情况“add-apt- repository: command not found, then you cannot add them … it is possible, although not recommended”。因此对于Debian或类Debian系统的用户,如果想要从PPA上面安装或更新软件包,可能需要下列脚本:

#!/bin/sh
if [ $# -eq 1 ]      then
    ppa_name=`echo "$1" | cut -d ":" -f2-`

     if [ -z "$ppa_name" ]      then
         echo "PPA name not found"
          echo "Utility to add PPA repositories in your debian machine"
          echo "$0/ppa ppa: user-name"
     else
          echo "$ppa_name"
          echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu maverick main" >> /etc/apt/sources.list
          apt-get update > /dev/null 2>> /tmp/apt_add_key.txt                                                     
          key=`cat /tmp/apt_add_key.txt | cut -d ""-f6 | cut -d"" -f3`
          apt-key adv-keyserver keyserver.ubuntu.com-recv-keys $key
           rm -rf /tmp/apt_add_key.txt
     fi
else
     echo "Utility to add PPA repositories in your debian machine"
     echo "$0/ppa ppa: user-name"
fi

保存这个脚本到/usr/bin目录下,名称为add-apt-repository,然后执行下列命令即可:
  $ sudo chmod +x /usr/bin/add-apt-repository 
  $ sudo chown root:root /usr/bin/add-apt-repository

现在我们也可以使用 add-apt-repository 命令进行软件安装了。

  $ sudo add-apt-repository ppa: name




File :add-apt-repository

[javascript]  view plain copy
  1. #!/bin/bash  
  2. if [ $# -eq 1 ]  
  3. NM=`uname -a && date`  
  4. NAME=`echo $NM | md5sum | cut -f1 -d" "`  
  5. then  
  6.     ppa_name=`echo "$1" | cut -d":" -f2 -s`  
  7.     if [ -z "$ppa_name" ]  
  8.     then  
  9.         echo "PPA name not found"  
  10.         echo "Utility to add PPA repositories in your debian machine"  
  11.         echo "$0 ppa:user/ppa-name"  
  12.     else  
  13.         echo "$ppa_name"  
  14.         echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list  
  15.         apt-get update >> /dev/null 2> /tmp/${NAME}_apt_add_key.txt  
  16.         key=`cat /tmp/${NAME}_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3`  
  17.         apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key  
  18.         rm -rf /tmp/${NAME}_apt_add_key.txt  
  19.     fi  
  20. else  
  21.     echo "Utility to add PPA repositories in your debian machine"  
  22.     echo "$0 ppa:user/ppa-name"  
  23. fi  

Install Fcitx

你可能感兴趣的:(apt的那些事)