当你作为non-root的Linux用户

当我作为普通用户使用服务器,软件环境却不符合要求时……

当我不能apt-get install

  1. 从源码编译安装,通常是configure --prefix xxx-make && make install的路线

  2. 下载包到本地,并放到对应的位置。为了实现这个目标我们应该熟悉一些命令。
    dpkg -L packagename 查看这个软件包安装到系统的文件们的路径(可以用tab键补全packagename)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    <details>
    <summary><mark><font color=darkred>点击查看详细内容</font></mark></summary>
    $ dpkg -L protobuf-compiler
    /.
    /usr
    /usr/bin
    /usr/bin/protoc
    /usr/share
    /usr/share/doc
    /usr/share/doc/protobuf-compiler
    /usr/share/doc/protobuf-compiler/CONTRIBUTORS.txt
    /usr/share/doc/protobuf-compiler/README.md
    /usr/share/doc/protobuf-compiler/copyright
    /usr/share/doc/protobuf-compiler/editors
    /usr/share/doc/protobuf-compiler/editors/README.txt
    /usr/share/doc/protobuf-compiler/editors/proto.vim
    /usr/share/doc/protobuf-compiler/editors/protobuf-mode.el.gz
    /usr/share/doc/protobuf-compiler/examples
    /usr/share/doc/protobuf-compiler/examples/AddPerson.java
    /usr/share/doc/protobuf-compiler/examples/CMakeLists.txt
    /usr/share/doc/protobuf-compiler/examples/ListPeople.java
    /usr/share/doc/protobuf-compiler/examples/Makefile
    /usr/share/doc/protobuf-compiler/examples/README.txt
    /usr/share/doc/protobuf-compiler/examples/add_person.cc
    /usr/share/doc/protobuf-compiler/examples/add_person.go
    /usr/share/doc/protobuf-compiler/examples/add_person.py
    /usr/share/doc/protobuf-compiler/examples/add_person_test.go
    /usr/share/doc/protobuf-compiler/examples/addressbook.proto
    /usr/share/doc/protobuf-compiler/examples/list_people.cc
    /usr/share/doc/protobuf-compiler/examples/list_people.go
    /usr/share/doc/protobuf-compiler/examples/list_people.py
    /usr/share/doc/protobuf-compiler/examples/list_people_test.go
    /usr/share/man
    /usr/share/man/man1
    /usr/share/man/man1/protoc.1.gz
    /usr/share/doc/protobuf-compiler/changelog.Debian.gz

    </details>

dpkg -l namepattern或者dpkg -l | grep namepattern查找符合namepattern的已安装的包
比如,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<details>
<summary><mark><font color=darkred>点击查看详细内容</font></mark></summary>

$ dpkg -l *protobuf*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================================================-===============================-===============================-=============================================================================================================
ii libprotobuf10:amd64 3.0.0-9.1ubuntu1 amd64 protocol buffers C++ library
ii protobuf-compiler 3.0.0-9.1ubuntu1 amd64 compiler for protocol buffer definition files
ii python3-protobuf 3.0.0-9.1ubuntu1 amd64 Python 3 bindings for protocol buffers

</details>

dpkg-deb -c package.deb查看某个deb包中的内容(其将要安装到的位置)

apt-get download package下载deb包

dpkg -i --force-not-root --root=$HOME package.deb可能会因为权限原因失败
dpkg -x package.deb dir解压该deb包到dir

一些资源

下载ubuntu package http://mirrors.edge.kernel.org/ubuntu/pool/universe/