很多时候, Linux 源里面的软件都不是最新版本,如果我们希望用上最新最酷的功能, 我们就需要自己去网上找安装包,但是一般情况下,我还是希望自己从源码编译,这样让人更为放心 .我将在本文记录下一些 Linux 软件的编译过程,
目前我所用的系统为 Ubuntu 16.04 x64,但是我一般编译系统都是另外开一个 Ubuntu Server 虚拟机, 然后使用 checkinstall 来生成 deb 安装包.如果有在其他平台编译,我会在软件编译之前, 说清楚的.
Ubuntu 下安装软件,最常用的莫过于 apt 了,这个命令为什么会自动安装软件呢? 因为我们给它配置了软件检索源.这些软件源的位置位于 /etc/apt/. 在 /etc/apt 目录下面有两个值得我们关注的地方:一个是 /etc/apt/sources.list 这个文件. 另一个是 /etc/apt/sources.list.d/ 这个目录.
通常的,我们可以直接编辑 source.list 这个文件,在里面加入我们的软件源. 为了加快软件下载速度,我们往往会使用国内的镜像源,比如中科大的. 这里面的软件源对应的系统版本一定要正确,否则安装的一些库什么的会导致系统不稳定. 比如我的系统是 xeninal 发行版,那么其中的中科大源如下:
#USTC source # 默认注释了源码仓库,如有需要可自行取消注释 deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse # deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse # deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse # deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse # deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse每一行为一个软件检索地址,格式暂时不介绍.
另一个目录 source.list.d,它下面存放的是一个个文件,后缀为 .list 的文件将会被 apt 一一读取, 然后进行软件的更新.另外你对应的看到 .list.save 文件,它们是.list的备份文件.
我们还可以通过 PPA 来安装软件,如何安装呢?使用命令 sudo add-apt-repository. 它的使用格式为:
add-apt-repository [OPTIONS] REPOSITORY如果 REPOSITORY 为单独可以添加到 sources.list 中的一行,那么将会被添加到 sources.list 文件中去. 如果 REPOSITORY 为 ppa:<user>/<ppa-name> 的形式,那么将会生成一个文件放到 sources.list.d 目录中.所以当我们通过 ppa 的方式添加了源,如果想移除这个源, 那么直接进到 sources.list.d 目录移除对应的文件即可.
已编译 2.8.20 成功! 2017-05-11
wget https://download.gimp.org/mirror/pub/gimp/v2.8/gimp-2.8.20.tar.bz2 tar -jxvf gimp-2.8.20.tar.bz2 sudo apt-get remove intltool sudo apt-get install intltool sudo apt-get install libbabl-dev libgegl-0.2-0 libgegl-dev libatk1.0-dev sudo apt-get install libgtk-3-dev # does not work sudo apt-get install libffi-dev #does not work sudo apt-get build-dep gtimer #解决Could not run GTK+ test program, checking why... sudo apt-get install libtiff5-dev #解决tiff库缺失问题 sudo apt-get install python-gtk2-dev #python文件头
sudo apt-get remove gettext wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.tar.xz tar -Jxvf gettext-0.19.8.tar.xz cd gettext-0.19.8/ ./configure sudo make && sudo make install
主要是为了解决configure: error: Package requirements (gegl-0.2 >= 0.2.0) were not met.
wget https://download.gimp.org/pub/gegl/0.2/gegl-0.2.0.tar.bz2 tar -jxvf gegl-0.2.0.tar.bz2 ./configure sudo make && sudo make install
它的安装目录为 /usr/local/lib/gegl-0.2 .
sudo apt install librsvg2-dev libwmf-dev libxpm-dev libexif-dev liblcms2-dev libgudev-1.0-dev libasound2-dev libmaa-dev
cd ../gimp-2.8.20/ ./configure --prefix=/opt/gimp #默认安装位置/opt/gimp sudo make && make install
将会安装在/opt/gimp目录下面.
sudo checkinstall
这个步骤请参考上面.安装完成后,执行下面命令,创建库的软连接.
sudo ln -s /usr/local/lib/libgegl-0.2.so /usr/lib/x86_64-linux-gnu/libgegl-0.2.so.0
dpkg -i xxx.deb
在 /usr/share/applications/下新建一个 gimp.desktop文件.如下:
[Desktop Entry] Version=1.0 Type=Application Name=gimp Exec=/opt/gimp/bin/gimp-2.8 %U Icon=/opt/gimp/share/icons/hicolor/256x256/apps/gimp.png
Building GIMP with prefix=/opt/gimp, datarootdir=${prefix}/share Desktop files install into ${datarootdir} Extra Binaries: gimp-console: yes Optional Features: D-Bus service: yes Language selection: yes Optional Plug-Ins: Ascii Art: no (AA library not found) Compressor: no Ghostscript: no (Ghostscript library not found) Help Browser: no (WebKit not found) LCMS: yes (lcms2) JPEG: yes JPEG 2000: no (JasPer library not found) MNG: no (MNG header file not found) PDF (import): Using PostScript plug-in (libpoppler not found) PDF (export): yes PNG: yes Print: yes PSP: yes Python 2: yes Script-Fu: yes SVG: yes TIFF: yes TWAIN (MacOS X): no TWAIN (Win32): no URI: yes (using GIO/GVfs) Webpage: no (WebKit not found) Windows ICO: yes WMF: yes XJT: yes X11 Mouse Cursor: yes XPM: yes Plug-In Features: EXIF support: yes Optional Modules: ALSA (MIDI Input): yes Linux Input: yes (GUdev support: yes) DirectInput (Win32): no Color Correction: yes (lcms2) Soft Proof: yes (lcms2) Tests: Use xvfb-run no (not found)
链接:http://pan.baidu.com/s/1hs5iYzy 密码:kpar
已编译 2.4.0 成功! 2017-07-20
已编译 2.4.5 成功! 2018-03-08
wget https://1.as.dl.wireshark.org/src/wireshark-2.4.0.tar.xz tar -Jxvf wireshark-2.4.0.tar.xz cd wireshark-2.4.0 sudo apt install build-essential pkg-config libglib2.0-dev libpcap-dev libgcrypt20-dev qt5-default qttools5-dev-tools libssl-dev ./configure --with-ssl --prefix=/opt/wireshark make && make install # 移除原来的文件(如果有的话) sudo rm /usr/bin/{capinfos,captype,dftest,dumpcap,editcap,idl2wrs,mergecap,randpkt,rawshark,reordercap,sharkd,text2pcap,tshark,wireshark} # 让非 root 用户可以抓包 sudo groupadd wireshark sudo usermod -a -G wireshark $YOUR_USER_NAME sudo chgrp wireshark /opt/wireshark/bin/dumpcap sudo chmod 755 /opt/wireshark/bin/dumpcap sudo setcap cap_net_raw,cap_net_admin=eip /opt/wireshark/bin/dumpcap sudo getcap /opt/wireshark/bin/dumpcap #------➢ ⚔ $ sudo getcap /opt/wireshark/bin/dumpcap #/opt/wireshark/bin/dumpcap = cap_net_admin,cap_net_raw+eip
安装完以后,我们需要在 ~/.bashrc 中更新一下系统的环境变量.
export PATH=${PATH}:/opt/wireshark/bin
为了方便使用,加入图标:
gvim ~/.local/share/applications/wireshark.desktop [Desktop Entry] Type=Application Version=1.0 Name=Wireshark Name[vi]=Wireshark GenericName=Network Analyzer GenericName[af]=Netwerk Analiseerder Icon=/opt/wireshark/share/icons/hicolor/128x128/apps/wireshark.png #TryExec=wireshark Exec=/opt/wireshark/bin/wireshark %f Terminal=false MimeType=application/vnd.tcpdump.pcap;application/x-pcapng;application/x-snoop;application/x-iptrace;application/x-lanalyzer;application/x-nettl;application/x-radcom;application/x-etherpeek;application/x-visualnetworks;application/x-netinstobserver;application/x-5view;application/x-tektronix-rf5;application/x-micropross-mplog;application/x-apple-packetlogger;application/x-endace-erf;application/ipfix;application/x-ixia-vwr; Categories=Network;Monitor;Qt;
当启动 Wireshark 的时候报错:
wireshark: error while loading shared libraries: libwscodecs.so.0: cannot open shared object file: No such file or directory
安装 libwscodecs 库:
sudo apt install libwscodecs1
创建链接:
sudo ln -s /usr/lib/x86_64-linux-gnu/libwscodecs.so.1 /usr/lib/x86_64-linux-gnu/libwscodecs.so.0
虽然用了要求使用的是 0.x 版本,但是上面使用 1.x 版本也是可以的.
6ZO+5o6l77yaaHR0cDovL3Bhbi5iYWlkdS5jb20vcy8xaHNMMUM1dSDlr4bnoIHvvJpnZTIyCg==