Category Archives: Linux

use linux desktop again

上个月写了《使用ggplot画图》一文,图片太多,一下子把博客的12G流量给用光了,月中博客就被停了,小伙伴们太给力了,blog不能访问,真是件不爽的事情。

言归正传,从2002年使用redhat 7.1开始,就没中止过使用linux,为什么要说again呢,因为在过去几年的工作时间里,使用的是OS X和win7做为桌面的,linux只在服务器端使用。自从用了OS X之后,就不想再用linux当桌面了,OS X绝对是节省生命的系统,本身是unix-like系统,对各种桌面软件支持又好,特别是中华大地,linux还是小众,用来当桌面实在是各种坑。

不过现在又回到学生时代了,所以还得继续学生屌丝的折腾,本科时从redhat,debian到gentoo,硕士时实验室的机器用ubuntu,而笔记本用NetBSD。这么多年的使用,该有的坑都填了,但是时代在发展,新坑还是不断有的,使用百度云来同步化文献库,就是最近的新坑,装上linux之后,发现度娘没有客户端,首先想到的当然是wine,wine出来的偶尔能行,时常崩溃,跟它死磕我也会崩溃,github上寻找开源实现,各种功能缺失和限制,那就只能虚拟机了,把home目录做为共享盘,挂到虚拟机中,但是度娘一直都是占100% CPU,然后数据无法同步,只有两个原因,不是硬盘就是网络,感觉好像我一个分区800G太大了,但在虚拟中对硬盘读写正常,网络因为使用NAT,虚拟成内网,有可能是这个原因,于是换成bridge,把虚拟机当成现实网络中的另一台主机,但度娘依然只占CPU,不干活。那只能还是硬盘问题,最后问题解决了,通过在linux中提供samba服务,然后在虚拟机中通过网上邻居把共享目录映射成网络驱动器,这时候度娘终于肯干活了。都不知道是virtualbox的驱动有问题,还是度娘太挑,这太TM坑了。
Read more »

local blast

I was asked to set up a local blast for the lab. Blast can be installed directly using apt in debian and it turns out to be easy.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@jz:/ssd/genomes# apt-get install ncbi-blast+
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  ncbi-blast+
0 upgraded, 1 newly installed, 0 to remove and 26 not upgraded.
Need to get 11.2 MB of archives.
After this operation, 32.8 MB of additional disk space will be used.
Get:1 http://ftp.hk.debian.org/debian/ wheezy/main ncbi-blast+ amd64 2.2.26-3 [11.2 MB]
Fetched 11.2 MB in 1min 16s (146 kB/s)
Selecting previously unselected package ncbi-blast+.
(Reading database ... 252681 files and directories currently installed.)
Unpacking ncbi-blast+ (from .../ncbi-blast+_2.2.26-3_amd64.deb) ...
Processing triggers for man-db ...
Setting up ncbi-blast+ (2.2.26-3) ...

Before the program can be used for sequence alignment, we should prepare the db files:

1
2
3
4
5
6
7
8
9
root@jz:/ssd/genomes/blast/db# makeblastdb -in ../../hg19.fa -out hg19 -dbtype nucl
Building a new DB, current time: 11/21/2013 16:03:05
New DB name:   hg19
New DB title:  ../../hg19.fa
Sequence type: Nucleotide
Keep Linkouts: T
Keep MBits: T
Maximum file size: 1073741824B
Adding sequences from FASTA; added 25 sequences in 27.7084 seconds.

That's it. Now blast is supported in the lab server.
Read more »

migrate from tetex to texlive

CentOS升级R到2.14之后,编译vignettes时便报错了,原因是少了latex的inconsolata.sty,这是文档中代码要需要用到的字体。google不出解决方案,基本上都是说不关R的事,要装latex包。

CentOS的repos里没有这个包,latex的东西以前折腾过,搞起来太麻烦。

现在一般用整合的latex环境,比如MiKTeXTeX LiveCentOS的repos里都没有,有的只有tetex,这个很难搞的家伙。

于是yum remove tetex,删掉tetex,再自己安装TeX Live
装完之后,编译安装R,./configure时报出warning,不支持latex。

通过修改PATH,搞掂。

PATH=/usr/local/texlive/2011/bin/i386-linux:$PATH 

upgrade R - F77 cause compilation error

I try to compile the source code of R 2.12 on CentOS, but it throw an error when trying to install *cluster*.

* installing *source* package ‘cluster’ ...
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c clara.c -o clara.o
g77   -fpic  -g -O2 -c daisy.f -o daisy.o
g77   -fpic  -g -O2 -c dysta.f -o dysta.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c fanny.c -o fanny.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c init.c -o init.o
g77   -fpic  -g -O2 -c meet.f -o meet.o
g77   -fpic  -g -O2 -c mona.f -o mona.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c pam.c -o pam.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c sildist.c -o sildist.o
gcc -std=gnu99 -I/usr/local/lib/R/include  -I/usr/local/include    -fpic  -g -O2 -c spannel.c -o spannel.o
g77   -fpic  -g -O2 -c twins.f -o twins.o
gcc -std=gnu99 -shared -L/usr/local/lib -o cluster.so clara.o daisy.o dysta.o fanny.o init.o meet.o mona.o pam.o sildist.o spannel.o twins.o -L/usr/lib/gcc/i386-redhat-linux/3.4.6 -lg2c -lm
installing to /usr/local/lib/R/library/cluster/libs
** R
** data
**  moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/local/lib/R/library/cluster/libs/cluster.so':
  /usr/local/lib/R/library/cluster/libs/cluster.so: undefined symbol: cl_daisy_
ERROR: loading failed
* removing ‘/usr/local/lib/R/library/cluster’
* restoring previous ‘/usr/local/lib/R/library/cluster’

The downloaded packages are in
        ‘/tmp/RtmpP1rf0B/downloaded_packages’
Updating HTML index of packages in '.Library'
Warning message:
In install.packages("cluster") :
  installation of package 'cluster' had non-zero exit status

Read more »

USB启动盘-Linux+WinPE

制作U盘版的启动盘,用于系统维护,虽然现在基本上不干这样的事,但还是弄一个,备用。

Linux用Sysresccd,这个版本是专门做livecd用于系统维护的,基于gentoo开发,我喜欢gentoo,所以选它-,-
还有一个好处是,可以选择启动32bit还是64bit的内核。这个很重要,因为做系统维护的话,通常是需要chroot到硬盘上的系统的。32bit是不能chroot到64bit的系统的,反之亦然。
Sysresccd可以从http://sourceforge.net/projects/systemrescuecd/下载到。
虽然是致力于做livecd,但也可以制作usb启动盘。几乎所有的livecd都能做为安装盘,当然这个也不例外。通过这个装gentoo,也算是省时省力的一件事。

制作过程可参考:http://www.sysresccd.org/Sysresccd-manual-en_How_to_install_SystemRescueCd_on_an_USB-stick
我在windows下制作这个:
先把U盘格式化成fat32格式
装载iso,拷文件到U盘里
重命名isolinux文件夹下的isolinux.cfg到syslinux.cfg
重命名isolinux文件夹到syslinux

在装载的光盘目录下,bootprog/syslinux-3.84.zip里有一个syslinux.exe,解压到硬盘。
运行cmd
syslinux -ma X:
#记得更改盘符-,-
#两个参数,m代表写入mbr,a代表分区设为active。

WinPE使用‘龙行天下U盘启动维护系统贺岁版’可从http://bbs.winpeedu.com/thread-1701-1-1.html下载。

解压后,打开lxtx_UBOOT_2009.5.18贺岁版\setup,运行“GRUBGUI.EXE”,选择相应的磁盘,选择“优先引导原来的MBR”,开始安装,然后将boot文件夹和szlos文件复制到U盘的根目录就可以了。

现在winpe的启动盘几乎都清一色用grub去引导,我本来还在想得去修改它的配置,让它去引导linux,没想到安装时,竟然有“优先引导原来的MBR”这个选项。试了一下,果然没问题,启动的时候,按空格进入grub,引导winpe启动盘,还有一些dos工具之类的。按其它键,则进入linux。总共才400多M,我的U盘有8G,再放一张xp的ghost镜像。这启动盘就perfect了。

Linux还带有X,默认不启动。StartX能出来。用的是XFCE。硬件都能检测出来。

% uname -a
Linux sysresccd 2.6.31.09-std134-amd64 #1 SMP Fri Dec 18 23:57:11 UTC 2009 x86_64 Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz GenuineIntel GNU/Linux
% lspci
00:00.0 Host bridge: Intel Corporation 4 Series Chipset DRAM Controller (rev 03)
00:01.0 PCI bridge: Intel Corporation 4 Series Chipset PCI Express Root Port (rev 03)
00:19.0 Ethernet controller: Intel Corporation 82567LM-3 Gigabit Network Connection (rev 02)
00:1a.0 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #5 (rev 02)
00:1a.2 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #6 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #2 (rev 02)
00:1b.0 Audio device: Intel Corporation 82801JD/DO (ICH10 Family) HD Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801JD/DO (ICH10 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801JD/DO (ICH10 Family) PCI Express Port 2 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a2)
00:1f.0 ISA bridge: Intel Corporation 82801JDO (ICH10DO) LPC Interface Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801JD/DO (ICH10 Family) 4-port SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801JD/DO (ICH10 Family) SMBus Controller (rev 02)
00:1f.5 IDE interface: Intel Corporation 82801JD/DO (ICH10 Family) 2-port SATA IDE Controller (rev 02)
01:00.0 VGA compatible controller: ATI Technologies Inc RV710 [Radeon HD 4350]
01:00.1 Audio device: ATI Technologies Inc RV710/730