zoukankan      html  css  js  c++  java
  • ubuntu软件安装

    1、软件安装的三种方式

    1)apt-get方法

    使用apt-get install来安装应用程序算是最常见的一种安装方法了,比如我要安装build-essential这个软件,使用以下,他会帮我把所有的依赖包都一起安装了;

    sudo apt-get install build-essential

    下面给出apt-get的的各种参数:

    apt-get install xxx         安装xxx  。如果带有参数,那么-d 表示仅下载 ,-f 表示强制安装  
    apt-get remove xxx          卸载xxx  
    apt-get update              更新软件信息数据库  
    apt-get upgrade             进行系统升级  
    apt-cache search            搜索软件包  
    Tips:建议您经常使用“apt-get update”命令来更新您的软件信息数据库 

    2)dpkg安装deb包

    Ubuntu软件包格式为deb,安装方法如下:

    sudo  dpkg  -i  package.deb

    dpkg的详细使用方法:

    dpkg -i package.deb    安装包
    dpkg -r package        删除包
    dpkg -P package        删除包(包括配置文件)
    dpkg -L package        列出与该包关联的文件
    dpkg -l package        显示该包的版本
    dpkg –unpack package.deb    解开 deb 包的内容
    dpkg -S keyword        搜索所属的包内容
    dpkg -l                列出当前已安装的包
    dpkg -c package.deb    列出 deb 包的内容
    dpkg –configure package  配置包

    使用apt-get方法安装的软件,所有下载的deb包都缓存到了/var/cache/apt/archives目录下了,所以可以把常用的deb包备份出来,甚至做成ISO工具包、刻盘,以后安装Ubuntu时就可以在没有网络环境的情况下进行了。下面的命令是拷贝archives这个目录到/var/cache/apt/目录下,替换原有的archives:

    enadmin@ubuntu-server:~/ftp$ sudo cp -r archives/ /var/cache/apt/

    3)make install源代码安装

    如果要使用make安装的话,那么必须得安装build-essential这个依赖包,安装方法已经在前面说过了。在安装完毕以后,我们就可以进行源码安装。源码安装大致可以分为三步骤:(./configure)–> 编译(sudo make) –> 安装(sudo make install)。

    1)配置:这是编译源代码的第一步,通过 ./configure 命令完成。执行此步以便为编译源代码作准备。常用的选项有 --prefix=PREFIX,用以指定程序的安装位置。更多的选项可通过 --help 查询。也有某些程序无需执行此步。

    2)编译:一旦配置通过,可即刻使用 make 指令来执行源代码的编译过程。视软件的具体情况而定,编译所需的时间也各有差异,我们所要做的就是耐心等候和静观其变。此步虽然仅下简单的指令,但有时候所遇到的问题却十分复杂。较常碰到的情形是程序编译到中途却无法圆满结束。此时,需要根据出错提示分析以便找到应对之策。

    3)安装:如果编译没有问题,那么执行 sudo make install 就可以将程序安装到系统中了。

    二、添加软件源

    安装完Ubuntu 16.04后第2件事就是更换为国内的软件源:

    sudo gedit /etc/apt/sources.list 

    在文件开头添加下面的阿里云的软件源:

    deb http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse

    更新软件源:

    sudo apt-get update

    三、将iso镜像作为本地源

    1)转到镜像的下载目录,挂载ISO镜像挂载至/media/cdrom下;

    sudo mount -o loop -t iso9660 update-i386-20080312-CD1.iso /media/cdrom

    2)手动添加ISO镜像至软件源列表,这样就可以在软件库里找到ISO上所有的软件包;

    sudo apt-cdrom -m -d=/media/cdrom add

    3)刷新软件库

    sudo apt-get update
    注意,执行完成后查看/etc/apt/sources.list文件,确保文件如下一行在文件顶部或者在网络源前面,否者,安装软件的时候系统还是优先从网络上下载【建议把除了dvd本地源之外的下面所有项注视掉,不建议删除,之后再用apt-get update命令更新下】
    deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release i386 (20090421.3)]/ jaunty main restricted
    之后就可以用apt-get install ** 来安装软件包了
  • 相关阅读:
    积水路面Wet Road Materials 2.3
    门控时钟问题
    饮料机问题
    Codeforces Round #340 (Div. 2) E. XOR and Favorite Number (莫队)
    Educational Codeforces Round 82 (Rated for Div. 2)部分题解
    Educational Codeforces Round 86 (Rated for Div. 2)部分题解
    Grakn Forces 2020部分题解
    2020 年百度之星·程序设计大赛
    POJ Nearest Common Ancestors (RMQ+树上dfs序求LCA)
    算法竞赛进阶指南 聚会 (LCA)
  • 原文地址:https://www.cnblogs.com/deny/p/10025680.html
Copyright © 2011-2022 走看看