zoukankan      html  css  js  c++  java
  • [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几种不同的源,这方面的知识可以搜索补充下。

  • 相关阅读:
    压测 linux + jexus + mono + asp.net mvc
    System.TypeInitializationException: The type initializer for 'Mono.Unix.Native.Stdlib' threw an exception.
    IIS配置文件路径
    服务号(已认证)与订阅号(已认证)权限区别
    解决:jquery ajax非首次请求Server端获取cookie值中文乱码问题
    解决:新版火狐浏览器3d打不开
    java中的 json 处理包
    GroupId和ArtifactId
    java环境变量完整版
    POJ-3258
  • 原文地址:https://www.cnblogs.com/smartvessel/p/1897710.html
Copyright © 2011-2022 走看看