• [2]aptget的使用


    1.apt-get需要root的权限使用,普通用户如何使用apt-get呢?

    su -或su

    切换到root用户后,执行apt-get

    2.使用普通用户使用sudo执行

    sudo apt-get install package

    3.sudo不能使用,报如下错误

    $sudo test

    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

    解决方法是将该用户加入sudoers

    (1)Installing SUDO in Debian

    # apt-get install sudo
    # vim /etc/sudoers 

    (2)   add a line:

        user ALL=(ALL) ALL

    user就是你当前使用的普通用户。

    或者

    %adm ALL=(ALL) ALL
    然后执行 gpasswd -a username adm

    如果sudo时不想输入密码,可以把上句改成:

    %adm ALL=(ALL) NOPASSWD: ALL

    vim用命令wq!强制保存, 接着chmod 0440 /etc/sudoers

    另外一个方法使用visudo修改后不会保存,郁闷。

     


     

    4. apt-get 源

    (1) 可以编辑/etc/apt/sources.list ,手动将源添加进去,如添加

    deb http://http.us.debian.org/debian/ stable main
    其中stable的意思就是更新的是debian stable的源

    (2) 如何设置更快的源

    使用apt-spy

    在/etc/apt/sources.list 中添加
    deb http://http.us.debian.org/debian/ stable main
    (如果有源,就没必要做这一步)
    执行以下命令更新软件包列表:
    apt-get update
    然后执行以下命令安装 apt-spy:
    apt-get install apt-spy
    从源上下载一份源的镜像列表:http://http.us.debian.org/debian/README.mirrors.txt
    apt-spy update
    测试亚洲地区的源的速度,自动写入sources.list(有的时候不能自动写入,需要直接手动)
    apt-spy -d stable -a asia -t 5(stable源)

    apt-spy -d testing -a asia -t 5(一般使用这个)

     debian几种不同的源,这方面的知识可以搜索补充下。

  • 相关阅读:
    Android随笔使用ViewPager实现简单地图片的左右滑动切换
    简单地Android中图片的三级缓存机制
    Java中怎么遍历map中value值 (转载)
    创建可执行的jar包
    写出优秀的java代码(转载)
    [JS脚本]ajax status 错误定义
    jsonlib 之jsonConfig详细使用(转载写的不错)
    Driver not found Error when sonar server is just not running
    使用Maven生成manifest
    ECMAScript 面向对象技术
  • 原文地址:https://www.cnblogs.com/smartvessel/p/1897710.html
Copyright © 2020-2023  润新知