Install Something

1 前言

这个是我的一个配置环境的wiki,主要记录我这些年安装的软件和配置的一些服务。 主要是在Windows7上和Linux(现在主要是Ubuntu)上。 详细记录一些配置过程和安装的软件。方便以后重新安装系统。

2 Node

~/.npm
/usr/local/bin/node
/usr/local/bin/npm
/usr/local/lib/node_modules
/usr/local/libexec/node_modules
/usr/local/share/man/man1/node*
/usr/local/lib/dtrace/node.d
/usr/local/include/node_modules
/var/db/receipts/org.nodejs.node.pkg.*

.node_repl_history

3 Git

3.1 git lfs error: failed to push some refs to

# you should be able to fix your pushes by removing the .git/hooks/pre-push file from your repository. This is where git is trying to run git lfs when you push.
rm .git/hooks/pre-push

Reference: https://github.com/github/git-lfs/issues/333

4 Emacs

4.1 Refile

;; http://superuser.com/a/373976
(setq org-refile-use-outline-path 'file)
(setq org-refile-targets '((org-agenda-files :level . 1)))

5 System Images SHA

链接 microsoft-msdn

文件名: cn_windows_8_enterprise_x64_dvd_917570.iso SHA1:1280BC3A38A7001FDE981FA2E465DEB341478667

文件名: en_windows_8_x64_dvd_915440.iso 语言: English SHA1:1CE53AD5F60419CF04A715CF3233F247E48BEEC4

文件名: cn_windows_8.1_with_update_x64_dvd_4048046.iso SHA1:F44B2BBD1F6F243DAAE172FA8C1DB342CB98EDAA

6 libuv

依赖 autoconf automake libtool

6.1 Error: glibtoolize cannot found.

if [ "$LIBTOOLIZE" = "" ] && [ "`uname`" = "Darwin" ]; then
  LIBTOOLIZE=libtoolize # 这里的glibtoolize -> libtoolize
fi

6.2 Undefined symbols for architecture x86_64

clang -Wall -I/usr/local/libuv/include -L/usr/local/libuv/lib -luv main.c

7 m4

看完这个文档 m4-doc or GNU M4 1.4.17 macro processor ,感觉m4就是lisp宏的一个翻版嘛~ (逃…

也可以参考这个有趣的 M4

8 Verify the Signature

gpg --verify xxx.tar.gz.sig xxx.tar.gz
# get the key ID
gpg --recv-keys [key ID]
# add the key
gpg --verify --verbose xxx.tar.gz.sig xxx.tar.gz

Reference: http://www.cnblogs.com/daemon369/p/3204020.html

9 Extract Files

if [ -f $1 ] ; then
    case $1 in
        *.tar.bz2)      tar xvjf $1 && cd $(basename "$1" .tar.bz2) ;;
        *.tar.gz)       tar xvzf $1 && cd $(basename "$1" .tar.gz) ;;
        *.tar.xz)       tar Jxvf $1 && cd $(basename "$1" .tar.xz) ;;
        *.bz2)          bunzip2 $1 && cd $(basename "$1" /bz2) ;;
        *.rar)          unrar x $1 && cd $(basename "$1" .rar) ;;
        *.gz)           gunzip $1 && cd $(basename "$1" .gz) ;;
        *.tar)          tar xvf $1 && cd $(basename "$1" .tar) ;;
        *.tbz2)         tar xvjf $1 && cd $(basename "$1" .tbz2) ;;
        *.tgz)          tar xvzf $1 && cd $(basename "$1" .tgz) ;;
        *.zip)          unzip $1 && cd $(basename "$1" .zip) ;;
        *.Z)            uncompress $1 && cd $(basename "$1" .Z) ;;
        *.7z)           7z x $1 && cd $(basename "$1" .7z) ;;
        *)              echo "don't know how to extract '$1'..." ;;
    esac
else
    echo "'$1' is not a valid file!"
fi

10 Install Protobuf

10.1 PKG_CONFIG_PATH unknow

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

11 Install GnuPG

11.1 error: intmax_t unknow when compile

After upgrading to Apple's Xcode 5.0, gnupg2 2.0.21 would no longer compile.

For some reason or other, sm/stdint.h could not resolve certain typedefs. Workaround was to crassly force typedef resolution in sm/stdint.h with these lines after #include <stdint.h> :

typedef long intptr_t; typedef long long intmax_t; typedef unsigned long uintptr_t; typedef unsigned long long uintmax_t;

After that everything compiled and all make checks passed.

Reference: https://bugs.gnupg.org/gnupg/msg4744

11.2 Install TeX on Mac

$ sudo ln -s /Volumes/MyTeXLive/bin/universal-darwin /usr/texbin

或者 TeX Live Utility > TeX programs (choose) 这里修改TeX路径。

使用清华TUNA: http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet

Reference: https://www.tug.org/texlive/doc/texlive-en/texlive-en.html#tlportable

12 iTerm2 GBK编码

让iTerm2临时变成GBK编码的环境,首先创建一个名为GBK的Profile,然后将其字符编码改成GBK。运行下面的sh即可用。

#!/bin/bash
# 使用GBK Profile
echo -e "\033]50;SetProfile=GBK\a"
# 环境编码切换为GBK
export LANG=zh_CN.GBK
export LC_ALL=zh_CN.GBK
# 更改当前 iTerm2 tab title
echo -ne "\033]0;"$@"\007"
$@
echo -ne "\033]0;"${PWD/#$HOME/~}"\007"
# GBK任务完成后,自动切换回默认编码(UTF-8)
echo -e "\033]50;SetProfile=Default\a"
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8

13 Windows

13.1 Install Windows7 Ultimate

  1. From Home basic to Ultimate FOR LenoveY470:

    6K2KY-BFH24-PJW6W-9GK29-TMPWP
    22TKD-F8XX6-YG69F-9M66D-PMJBM
    
  2. Install Windows7 Ultimate by DVD/USB:

    waiting…

13.2 Install Emacs and config her

13.2.1 Change the Home Directory:

  1. Ctrl + R
  2. Input "regedit"
  3. HKEY\_CURRENT\_USER/Software/GNU/Emacs/HOME=%The Home of Emacs% (New a string value)

13.2.2 Swap the CapsLk && Ctrl\_L

  1. Modify the regedit

      REGEDIT4
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "Scancode Map"=hex:00,00,00,00,00,00,00,00,
             03,00,00,00,1d,00,3a,00,
             3a,00,1d,00,00,00,00,00
      (New a binary Values)
    
  2. Download Software:

13.3 Install Jekyll

13.3.2 Install:

Next -> Next -> … -> Finish

Attention: The path of the installer cannot have space!!!

13.3.3 Run:

> jekyll serve

13.3.4 Change:

13.3.5 Q&A:

  1. Liquid Exception: incompatible character encodings: IBM437 and UTF-8

    # windows:
    > chcp 65001
    
    # Linux
    $ export LC_ALL=en_US.UTF-8
    $ export LANG=en_US.UTF-8
    $ jekyll --server --auto
    

    Reference:

  2. Python Django: {&#37; autoescape off &#37;}

Hello {&#123; name &#123;} {&#37; endautoescape &#37;} Reference:

13.4 Install Foobar and config her

13.5 Install Win7Code

13.6 Install mit-scheme and fix some issue

13.7 Install Java Development

13.8 Install Qt Development

13.8.2 Install:

  1. Next->Next->…->Finish

13.8.3 Configure:

  1. use it in terminal (vs2010): Please use the : Qt 4.8.4 Command Prompt

14 Linux

14.1 Install Emacs and config it

  1. Go to here(main GNU ftp) to download the lastest .xz
  2. Install the depends below:

    $ sudo apt-get install texinfo build-essential
    $ sudo aptitude install libdbus-1-dev libgconf2-dev libgif-dev libgpm-dev \
      libgtk2.0-dev libjpeg62-dev libm17n-dev libncurses5-dev \
      libotf-dev librsvg2-dev libtiff4-dev libXpm-dev
    
    $ ./configure
    $ make bootstrap
    $ make
    $ src/emacs -q ;; This checks that it built properly
    $ sudo make install
    $ mv /usr/local/bin/emacs-24.0.50 /usr/local/bin/emacs24
    ;; Change the number to whatever the version is, I moved it to a more convienent name
    $ emacs24 -q
    
  3. Download this config files!

14.2 Install Google Chrome

  1. Go to here to download the leaset google-chrome
  2. Who can tell me why hwo to solve it: Dependency is not satisfiable: libudev0(>=147) (I was in Ubuntu13.04 amd64)

14.3 Return to classic gnome for ubuntu12.04+

$ sudo apt-get install gnome-session-fallback

14.4 Install Git (You can find the books. Just click here)

  1. Go to here download the lastest git.
  2. Follow the 1.4 Getting Started - Installing Git. The main steps are:

    $ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \
      libz-dev libssl-dev
    $ tar -zxf git-1.7.2.2.tar.gz
    $ cd git-1.7.2.2
    $ make prefix=/usr/local all
    $ sudo make prefix=/usr/local install
    # Below is options:
    $ git clone git://git.kernel.org/pub/scm/git/git.git
    
  3. Follow the 1.5 Getting Started - First-Time Git Setup. The main steps are:

    $ git config --global user.name "John Doe"
    $ git config --global user.email johndoe@example.com
    
  4. Now, you can Generating SSH Keys. The main steps are:

    $ ssh-keygen -t rsa -C "your_email@example.com"
    $ sudo apt-get install xclip
    $ xclip -sel clip < ~/.ssh/id_rsa.pub
    

14.5 Add the picture when ubuntu boot up

Please pay more attenttion to modify this file

  1. Move the picture to the /usr/share/backgrounds
  2. Replace:

    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    if background_color 44,0,30; then
      clear
    fi
    ### END /etc/grub.d/05_debian_theme ###
    

    With:

    ### BEGIN /etc/grub.d/05_debian_theme ###
    insmod part_msdos
    insmod ext4
    # Here you should use (sudo fdisk -l) to see /dev/sda??
    set root='(hd0,msdos10)'
    search --no-floppy --fs-uuid --set e3a8ca35-417d-4da2-9380-91f08a9e4fb2
    insmod png
    if background_image /usr/share/backgrounds/spacefun-grub-widescreen.png;
    then
      set color_normal=light-gray/black
      set color_highlight=white/black
    else
      set menu_color_normal=cyan/blue
      set menu_color_highlight=white/blue
    fi
    ### END /etc/grub.d/05_debian_theme ###
    
  3. Reboot

14.6 Install Adobe Flash Player

  1. Go to here to download it.
  2. Extract it.
  3. Follow below:

    # Make sure libflashplayer.so with +x
    $ sudo cp libflashplayer.so /usr/lib/firefox/plugins/
    $ sudo cp -r usr/* /usr
    
  4. Open your browser to test!

14.7 Install Lua and Luarocks

14.7.1 lua

  1. Go to here to download
  2. Extra it
  3. make linux (if error: no readline.h. sudo apt-get install libreadline-dev)
  4. sudo make install
  5. Over~

14.7.2 Luarocks

  1. Go to here to doanload and the extra it
  2. ./configure
  3. make
  4. sudo make install
  5. Over~

14.8 Install Java

  1. Download the tar.gz package from official repo
  2. Unzipped
  3. Copy/Move the unzipped category to usr/lib/jvm
  4. Now Run

    update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
    sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
    sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
    
  5. Correct the file ownership and the permissions of the executables:(if necessary)

    sudo chmod a+x /usr/bin/java
    sudo chmod a+x /usr/bin/javac
    sudo chmod a+x /usr/bin/javaws
    sudo chown -R root:root /usr/lib/jvm/jdk1.7.0
    
  6. Test

    java -version
    

Reference:

14.9 MySQL

# start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]

14.10 Change Some Key Shortcuts

  1. Launchers > Key to show the HUD Alt+Alt R
  2. Windows > Activate the window menu Menu
  3. Alt + key to active menu Alt+E > Keyboard Shortcuts

14.11 Make Ubuntu12.04 hibernation

  1. open file

    sudo vi /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
    
  2. modify

    [Re-enable hibernate by default]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=yes
    
  3. reboot

Reference:

14.12 Install Ubuntu12.04 black screen

安装ubuntu12.04花屏。

   在开机时进入grub编辑程序,在quite splash后面加上nomodeset

Reference:

  1. http://ycool.com/post/brncevj
  2. http://wiki.ubuntu-tw.org/index.php?title=FAQinstall

Junjia Ni

2015-12-27

2016-11-10 Thu 13:03

Emacs 25.1.1 (Org mode 9.0)

2016-10-23 Sun 23:09