ubuntu上面无网络的情况上安装 emacs
因为有朋友问我这个问题,所以我就实践一下,写了下来.
1, 在其它能上网的电脑上面下载 emacs :
http://www.gnu.org/software/emacs/emacs.html
wget -c http://ftp.gnu.org/pub/gnu/emacs/emacs-23.2.tar.gz
82% [===============================> ] 38,794,237 438K/s ETA 23s
2, 解压
tar -xf emacs-23.2.tar.gz
cd emacs-23.2
3,看 README , 再看 INSTALL
INSTALL 里面写着:
1. Make sure your system has at least 120 MB of free disk space. 2a. `cd' to the directory where you unpacked Emacs and invoke the `configure' script: ./configure 2b. Alternatively, create a separate directory, outside the source directory, where you want to build Emacs, and invoke `configure' from there: SOURCE-DIR/configure where SOURCE-DIR is the top-level Emacs source directory. This may not work unless you use GNU make. 3. When `configure' finishes, it prints several lines of details about the system configuration. Read those details carefully looking for anything suspicious, such as wrong CPU and operating system names, wrong places for headers or libraries, missing libraries that you know are installed on your system, etc. If you find anything wrong, you will have to pass to `configure' explicit machine configuration name, and one or more options which tell it where to find various headers and libraries; refer to DETAILED BUILDING AND INSTALLATION section below. If `configure' didn't find some image support libraries, such as Xpm, jpeg, etc., and you want to use them refer to the subsection "Image support libraries", below. If the details printed by `configure' don't make any sense to you, assume that `configure' did its job and proceed. 4. If you need to run the `configure' script more than once (e.g., with some non-default options), always clean the source directories before running `configure' again: make distclean ./configure 5. Invoke the `make' program: make 6. If `make' succeeds, it will build an executable program `emacs' in the `src' directory. You can try this program, to make sure it works: src/emacs -q 7. Assuming that the program `src/emacs' starts and displays its opening screen, you can install the program and its auxiliary files into their installation directories: make install You are now ready to use Emacs. If you wish to conserve disk space, you may remove the program binaries and object files from the directory where you built Emacs: make clean You can also save some space by compressing (with `gzip') Info files and installed Lisp source (.el) files which have corresponding .elc versions.
4, 那就按他说的做吧:
kk@kk-laptop:~/down/emacs-23.2$ ./configure
提示错误:
configure: error: The following required libraries were not found: libjpeg libpng libgif/libungif libtiff Maybe some development libraries/packages are missing? If you don't want to link with them give --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no as options to configure
kk@kk-laptop:~/down/emacs-23.2$ as libjpeg v libjpeg-dbg - v libjpeg-dev - p libjpeg-progs - Programs for manipulating JPEG files i libjpeg62 - The Independent JPEG Group's JPEG runtime p libjpeg62-dbg - Development files for the IJG JPEG library p libjpeg62-dev - Development files for the IJG JPEG library
得到答案: 要安装 libjpeg-dev , 于是在其它电脑上面下载这个包, 命令 :
aptitude install -d libjpeg-dev
读取:1 http://cn.archive.ubuntu.com/ubuntu/ lucid/main libjpeg62-dev 6b-15ubuntu1 [188kB]
已下载 188kB,耗时 0秒 (284kB/s)
kk@kk-laptop:/var/cache/apt/archives$ ls libjpeg* libjpeg62-dev_6b-15ubuntu1_i386.deb
再搞定 其它几个.
... 我是直接跳过的. ./configure --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no
然后:
make distclean
./configure
configure: creating ./config.status config.status: creating Makefile config.status: creating lib-src/Makefile.c config.status: creating oldXMenu/Makefile config.status: creating doc/emacs/Makefile config.status: creating doc/misc/Makefile config.status: creating doc/lispintro/Makefile config.status: creating doc/lispref/Makefile config.status: creating src/Makefile.c config.status: creating lwlib/Makefile config.status: creating lisp/Makefile config.status: creating leim/Makefile config.status: creating src/config.h config.status: executing default commands creating src/epaths.h creating lib-src/Makefile creating src/Makefile
OK没报错.
直接执行 make
看看也没什么错误,
然后执行 src/emacs -q
成功了, emacs 的普通界面跳出来了. 爽的.
c-x,c-c 退出.
按照 INSTALL 里的第7步,还要 sudo make install
kk@kk-laptop:~/down/emacs-23.2$ type emacs emacs 已经被散列 (/usr/local/bin/emacs) kk@kk-laptop:~/down/emacs-23.2$ file /usr/local/bin/emacs /usr/local/bin/emacs: sticky ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped kk@kk-laptop:~/down/emacs-23.2$ ls -l /usr/local/bin/emacs -rwxr-xr-t 2 root root 10479250 2010-11-17 19:09 /usr/local/bin/emacs
需要 rm /usr/local/bin/ctags , 这个是emacs 自带的, 要删. 因为我平时用的是另一个 ctags + vim . 汗. 删了这个.