Debian Configurations

本文姊妹篇:Windows 系统配置

R.I.P.

Ian Ashley Murdock (28 April 1973 – 28 December 2015) was an American software engineer, known for being the founder of the Debian project and Progeny Linux Systems, a commercial Linux company.

Murdock died on 28 December 2015 in San Francisco. As of 1 January 2016, no details of his cause of death have been officially released.

The last tweets from Murdock’s Twitter account first announced that he would commit suicide, then said he would not. He reported having an altercation (争执) with police, and finally declared an intent to devote his life to opposing police abuse. His Twitter account was taken down shortly afterwards.

The San Francisco police confirmed he was detained (被扣留), saying he matched the description in a reported attempted break-in and that he appeared to be drunk. The police stated that he became violent and was ultimately taken to jail on suspicion of four misdemeanor ([,mɪsdɪ'minɚ] n. 轻罪;品行不端) counts. They added that he did not appear to be suicidal and was medically examined prior to release. Later, police returned on reports of a possible suicide. The city medical examiner’s office confirmed Murdock was found dead.

refs and see also

/etc/apt/sources.list

adduser gnat                                # userdel gnat
visudo                                      # add "gnat ALL=(ALL:ALL) ALL"

使用国内的镜像可以加快软件的下载(apt-get install 之类),可以 配置到中科大(USTC)

修改 /etc/apt/sources.list

推荐 USTC 的生成器:LUG’s repo file generator

Debian
deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

可以看到格式是 deb <url> <dist> <节点1> <节点2> <节点3>,节点 1..3 是 /dists/ 下的三个子目录。

Ubuntu

(15.04)

deb http://mirrors.ustc.edu.cn/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ vivid-backports main restricted universe multiverse
Kali
deb http://mirrors.ustc.edu.cn/kali kali-rolling main contrib non-free

配置好软件源,就可以更新了,在命令行内输入:

sudo apt-get update

sudo apt-get install -y \
    tmux build-essential geany vim vim-gnome \
    gcc g++ make cmake \
    file-roller p7zip p7zip-full p7zip-rar unrar zip unzip cabextract \
    xsel htop w3m global \
    xclip astyle zsh git curl nasm ascii pandoc pinta

sudo apt-get install -y \
    nautilus-open-terminal software-center gnome-tweak-tool gdebi \
    python-all-dev python3  python-pip python-setuptools python-twisted \
    flashplugin-nonfree \
    calibre terminator audacious vlc chromium

dpkg-reconfigure locales                    # us utf 8; zh utf 8, GB, Big5, etc
locales-gen                                 # if skiped locales generation

配置

Zsh (oh-my-zsh)

curl -L http://install.ohmyz.sh | sh
.zshrc
plugins=(git colored-man)

Chrome/Firefox Extensions

插件:

refs and see also

MISC

Fonts

Terminal (Mono) Fonts

sudo apt-get install ttf-inconsolata
sudo apt-get install ttf-droid

Chinese fonts

  1. apt-get install fonts-wqy-microhei fonts-wqy-zenhei
  2. Install LaTeX to get more fonts.
  3. 如果你要偷字体
    1. c:\windows\fonts,偷点字体
    2. cd /usr/share/fonts/ && mkdir winfonts,放这里
    3. 处理一下:

      cd winfonts
      mkfontscale && mkfontdir
      fc-cache

中文输入法

sudo apt-get install ibus ibus-pinyin
im-config

然后打开 language-support 安装字体等相关内容。

Emacs 24

wget http://mirrors.ustc.edu.cn/gnu/emacs/emacs-24.3.tar.xz
tar --xz -xvf emacs*.tar.xz
apt-get install -y \
    libxaw7-dev libxpm-dev libpng12-dev libtiff5-dev \
    libgif-dev libjpeg8-dev libgtk2.0-dev libncurses5-dev
cd emacs*
mkdir build && cd build
../configure
make
make install

用 Chenbin 的配置(前端,C++,Evil-mode):redguardtoo/emacs.d

wget https://github.com/redguardtoo/emacs.d/archive/master.zip
unzip master.zip
cd ~ && rm -Rf .emacs.d
ln -s path/to/chenbin-emacs .emacs.d
emacs -nw --batch -l ~/.emacs.d/init.el -f package-refresh-contents

Some useful tools

Vim

简单的

set expandtab ts=4 sw=4 ai
%retab

pretty good: blog/vimrc.vim at master · district10/blog.

强大的

不要忘了 vim -u NONE

GCC4.9 (for C++11)

因爲硬件的問題,Debian 一直沒裝上,用了 Xubuntu,驚現原來原裝的 GCC4.8 已經可以用 -std=c++11……

Compile GCC: http://gcc.gnu.org/wiki/InstallingGCC

./configure
make
sudo make install

Other choice: How to compile GCC 4.9

sudo apt-get install flex bison build-essential gcc-multilib
cd gcc-4.9.1 && ./contrib/download_prerequisites
mkdir build && cd build
# ../configure --prefix=/opt/gcc_4_9 --program-suffix=-4.9 \
#    --enable-languages=c,c++ --enable-multilib \
#    --build=x86_64-linux-gnu --enable-checking=release
#    ../configure --prefix=/home/gnat/bin/gcc --program-suffix=-4.9 \
#    --enable-languages=c,c++ --enable-multilib \
#    --build=x86_64-linux-gnu --enable-checking=release
make -j4
make install

or to choose an online compiler: coliruC++ Shell

or MinGW Distro (open box) for windows users

QtCreator 建 C++ 工程(cmake),在 cmake 文件里加上

set( CMAKE_CXX_FLAGS "-std=c++11" )                # Add c++11 functionality

C++ 的 man 文档,超赞!

man std::string::c_str

man std::string::c_str

cd /tmp && \
git clone https://github.com/jeaye/stdman.git && \
cd stdman && \
./configure && \
sudo make install && \
sudo mandb

gPhoto2

# deps
sudo apt-get install \
subversion dh-autoreconf \
libglib2.0-dev \
libusb-dev libusb-1.0-0-dev \
libexif-dev libpopt-dev libfuse-dev \
mono-devel monodoc-base libmono-2.0.1 mono-gmcs \
python-pyrex
# source
wget http://sourceforge.net/projects/gphoto/files/libgphoto/2.5.2/libgphoto2-2.5.2.tar.gz
wget http://sourceforge.net/projects/gphoto/files/gphoto/2.5.2/gphoto2-2.5.2.tar.gz
# unzip, ./configure, make, make install

详细见 gPhoto2 指南

NodeJS & NPM

Goto official site: Node.js, then download the zip archive.

then install cnpm:

sudo npm install -g cnpm --registry=https://registry.npm.taobao.org

then use cnpm instead of npm

一些有用的东东:

sudo cnpm install -g http-server
sudo cnpm install -g csslint
sudo cnpm install -g jshint
sudo cnpm install -g typescript

Gems

用淘宝的 RubyGems 源RubyGems 镜像 - Ruby China

gem sources -l                              # 看看是什么,把它去除
gem sources --remove http://rubygems.org/
gem sources --add    https://gems.ruby-china.org/

注意 http://rubygems.org 不要打成 http://rubygems.org/

装个 pry
sudo gem install pry

Bonus

GDAL

http://download.osgeo.org/gdal
cd gdal-1.9.0
./configure --with-python
make
sudo make install
sudo ldconfig                   ## update the shared library cache

CGAL

sudo apt-get install libcgal-dev

或者自己编译:

# GMP
sudo apt-get install libgmp3-dev
# MPFR
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.xz
./configure && make -j 4
sudo make install
# BOOST
sudo apt-get install libboost-all-dev
# CGAL
cmake . && make -j 4
sudo make install

Open CV

A Script to install OpenCV:

version="$(wget -q -O - http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep -m1 -o '\"[0-9](\.[0-9]+)+' | cut -c2-)"
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -qq install -y libopencv-dev build-essential checkinstall cmake \
    pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev \
    libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev \
    libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev \
    libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev \
    libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 \
    v4l-utils ffmpeg
echo "Downloading OpenCV" $version
wget -O OpenCV-$version.zip \
    http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/opencv-"$version".zip/download
echo "Installing OpenCV" $version
unzip OpenCV-$version.zip
cd opencv-$version
mkdir build
cd build
cmake \
    -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON \
    -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON \
    -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j4
sudo checkinstall
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV" $version "ready to be used"

PCL

Ubuntu :

sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all

Debian:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 19274DEF
sudo echo \
    "deb http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu maverick main" \
    >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libpcl-all

Deps:

ag 搜索源码的好工具

apt-get install silversearcher-ag

Windows 二进制:http://gnat.qiniudn.com/ag.exe

比如,用 ag 搜索 three.js 中的 “fisheye”,基本是回车即显:

ag - The Silver Searcher

ag - The Silver Searcher

还有一个 pt 和它类似,对中文比较友好。

tmux & tmuxinator

查看文件中的 Tabag '\t'

sudo apt-get install tmux
sudo gem install tmuxinator

Wemux

wemux

wemux

sudo git clone git://github.com/zolrath/wemux.git /usr/local/share/wemux
sudo ln -s /usr/local/share/wemux/wemux /usr/local/bin/wemux
sudo cp /usr/local/share/wemux/wemux.conf.example /usr/local/etc/wemux.conf
sudo vim /usr/local/etc/wemux.conf # host_list=(root gnat),改成自己的 ID

Java8

refs and see also


install rpm package
sudo apt-get install alien dpkg-dev debhelper build-essential
sudo alien packagename.rpm
sudo dpkg -i packagename.deb
PyPI 镜像使用帮助 [LUG@USTC]
~/.pip/pip.conf
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple
sudo pip install --upgrade numpy
CPAN镜像使用帮助 [LUG@USTC]

modify file ~/.cpan/CPAN/MyConfig.pm to 'urllist' => [q[http://mirrors.ustc.edu.cn/CPAN/]],.

in bash, cpan App::cpanminus.

refs and see also

export PYTHONPATH=/home/tzx/caffe-rc3/python:$PYTHONPATH
import sys
caffe_root = '../../'
sys.path.insert(0, caffe_root + 'python')

Refs

  1. https://lug.ustc.edu.cn/wiki/mirrors/help/debian
  2. http://www.2cto.com/Article/201304/200418.html
  3. and many more.

「Load Disqus | 加载评论」