ubuntu16.04换源 & 包管理
apt包管理
换了源,出现问题了,换回去,需要执行下面几句
sudo apt-get update
sudo apt-get -f install
sudo apt-get upgrade
添加的某个ppa源若有问题,删除可以直接 cd /etc/apt/sources.list.d,删除对应的文件即可。
apt包管理的一些常用命令:
apt-get install xxx
#install xxx packages to usr/bin/xxx or /usr/local/bin xxx
apt-get build-dep xxx
#install all dependent packages for build xxx to usr/bin/xxx or usr/local/bin/xxx
apt-get download xxx
#download xxx package to current directory
apt-get source xxx
#download source files of package xxx to current directory. If no version postfix, it download the newest source files. If with version postfix, it download exact version
1 For install and build-dep cmds, packages are download in directory /var/cache/apt/archives
2 For install, build-dep, download and source cmds, logs can be find in /var/log/apt/term.log
3 For build-dep, source, mannual says architecture can be specified by --host-architecture xxx, I tried with i386/ia64/armel,but only i386 can work
若安装软件包遇到版本依赖问题:
sudo aptitude install xxx #他会给出解决方案,若接受就y,否则就n让他再出其他的解决方案。一般版本依赖问题可能都需要降级软件包版本
apt-get update #总是失败,换源也是失败,date看下是否是系统时间不对!时间不对可能导致验签过期!date -s "mon/day/year 10:25"。遇到一些Hashes相关的错误,大多是网络环境不好导致的错误,尝试多次重新执行!
apt-get install xx #若提示/var/xx/cache没有剩余空间了,就要apt-get clean清理缓存了!
https://www.zhihu.com/question/291606128
dpkg包管理
安装deb包
dpkg -i xxx #with --instdir, default installation directory can be changed
#查看系统上安装了哪些软件包
dpkg -l
#查看某个软件包的安装路径:
dpkg -L xxx
#删除某个软件包
dpkg -P xxx
去 http://packages.debian.org,You can search packages with package names in search window, then download stable version with specific architecture。
分析deb包:
#创建文件夹extract,并在extract文件夹下创建DEBIAN文件夹(必须叫这个名字不然解压报错)
mkdir -p extract/DEBIAN
#将deb包解压到extract文件夹下。与dpkg -L xxx 对比看看他们都安装到哪里了
dpkg -X ./xxx.deb extract
#解压deb包中的control信息(包的依赖在这里面的control文件中,有个Depends字段,如果想忽略依赖信息暴力安装可以将其删去)
dpkg -e ./xxx.deb extract/DEBIAN
#重新打包
mkdir build
dpkg -b extract build/ #将解压到extract文件夹中所有的内容重新打包为deb包
可以直接
dpkg-deb -R xxx.deb ./extract
得到打包前的状态(包含DEBIAN和其他内容),修改完成后直接
fakeroot dpkg-deb --build ./tract xxx.deb
再打包回去
如何从0制作一个deb包:
https://blog.csdn.net/gk_wdnmd_/article/details/108287682
pkg-config
pkg-config --list-all |grep -i qt 过滤含有qt的内容, -i 使其对大小写不敏感
pkg-config --cflags --libs libavcodec
sudo gedit /etc/ld.so.conf.d/ffmpeg.conf(新建的),然后把so所在路径添加进去,多个目录就添加多行,eg. /usr/local/lib。最后 sudo ldconfig