给 Subclipse 安装 JavaHL 库 

eclipse 是我最爱的Java IDE之一,在eclipse 上使用svn的插件也是有很多~subclipse 便是其中之一.

不过最近我的eclipse一直在报一个缺少JavaHL的错误,每次打开都会弹出来一次,很是烦人。如图:


我检查了一下,我的eclipse 是使用的JavaHL的引擎,而我的系统里还没有安装,所以每次都会弹出来错误。

而我的eclipse里面还装有另外一个svn插件 - subversive,所以我每次提交代码也都成功了。不过,我得干掉这个恶心的错误了~

于是我便在 package.ubuntu.com 搜了一下,找到了解决方案.

sudo apt-get install libsvn-java
sudo apt-get install libsvn-javahl #不适用于 natty

完了之后,在重启下。JavaHL 就进入了系统的Path了~ eclipse 也就不会在找不到它了。

更多信息,参见:http://subclipse.tigris.org/wiki/JavaHL

注:你还可以下载里面提供的 javahltests.jar 文件,运行测试下JavaHL是否OK.
[ ] ( 2731 次浏览 ) 永久链接 ( 3 / 2566 )
Ubuntu 强制关机后的分区损坏之解决 

这几天天气太热,我的笔记本的温度一直是很高~一连开了一下午的机器,快傍晚的时候,忽然系统一下子死掉了,连tty也进不去了,一直提示什么"device /dev/sda6 error"之类的错误,无奈,长按电源键关机了~

可是再开机就杯具了~直接进initramfs了~我还以为是内核的问题,选择之前的内核问题依旧。

杯具了~选择进 memtest 模式也不行,不过我发现了"/dev/sda6 not be mount"的字样,估计是/dev/sda6 分区挂了。搜了一下,果然是分区表坏了~

解决方案:
找一张Ubuntu LiveCD,启动进系统。打开终端:
输入 sudo fsck -p /dev/sda6
即可。

注:修复之前要确保/dev/sda6 没有被挂载。(废话了~能正常挂载了,还需要修复么 囧rz)

一切完成后,如果幸运的话,/dev/sda6 已经可以被正常挂载了,里面的文件还在。

重启,退出LiveCD,系统又回来了~
[ ] ( 3284 次浏览 ) 永久链接 ( 3 / 2551 )
利用crontab 每夜备份MySQL数据库 

自从数据库挂过一次之后,我越来越开始重视起我的数据安全了~特别是数据备份,一直要保质保量的完成。

我是这样做的,由于现在还没有找到完美的远程备份的解决方案,我先是在本地备份在本地,而后在手动转移。

首先,创建一个专门用于备份数据的MySQL用户,比如 dumper,授予所有数据库及表的select 和 lock table 权限,密码一定要足够的强大,并且只允许在本地登录。

命令:
grant select,lock tables on *.* to 'dumper'@'localhost' identified by PASSWORD('XXXX').
即可。

之后,为了让crontab 执行mysqldump 时不使用交互密码,编辑 my.cnf 配置文件。

找到[mysqldump]节点,加入
user = dumper
password = XXXX

保存。

一切OK后,使用crontab 创建备份任务.

运行 crontab -e
输入 0 0 * * * mysqldump -A -C -u dumper | bzip2 -9 > ~/sql/mysql_`date +%s`.sql.bz2

保存退出即可。

查看一下:
[root@PowerPC sql]# crontab -l
0 0 * * * mysqldump -A -C -u dumper | bzip2 -9 > ~/sql/mysql_`date +%s`.sql.bz2

这样的话,在每晚的0点,mysql 都会被整个压缩备份下来一次,再也不用担心数据库挂掉拉~

我个人建议是压缩一下,gzip/bzip 均可,压一下的结果很明显,毕竟VPS的硬盘也不算大~

[root@PowerPC sql]# ls -l -h
total 3.9M
-rw-r--r-- 1 root root 689K Jul 9 12:53 mysql_1310201629.sql.bz2
-rw-r--r-- 1 root root 3.2M Jul 9 12:54 mysql_1310201645.sql
[ ] ( 3290 次浏览 ) 永久链接 ( 3 / 2418 )
编译安装 Apache Traffic Server 3.0.0 通过 

本来想这篇文章不发算了~因为事实是trafficserver 的一个bug删掉了我的所有数据,而我也没有在用它~

不过想想我的这些噩梦般的遭遇可能会帮到一些人,便还是贴了出来~

我是在trafficserver 正式发布了3.0.0版本后,从apache官网下载的trafficserver的源码包(http://www.apache.org/dist//trafficserver/trafficserver-3.0.0.tar.bz2)。

解压,进入目录:
我的configure:
[root@PowerPC trafficserver-3.0.0]# ./configure \
> --prefix=/usr/local/trafficserver \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/trafficserver \
> --localstatedir=/var/run \
> --enable-purify \
> --enable-tproxy=auto \
> --with-user=cache \
> --with-group=web

倒也没什么特别的,检查依赖,报错:

checking for Tcl configuration... configure: error: Can't find Tcl configuration, install the TCL dev package


解决方案:yum install tcl-devel
再次检查,通过。接下来 make 编译,再次报错:

cc1plus: warnings being treated as errors
LogAccess.cc: In member function ‘int LogAccess::marshal_record(char*, char*)’:
LogAccess.cc:729: warning: comparison between signed and unsigned integer expressions


这是configure文件的问题,警告就导致编译程序退出了~修改一下,打开configure,
删除所有含有 "-Werror"的地方,一共有11处:

[root@PowerPC trafficserver-3.0.0]# cat configure |grep Werror
# or remarks (even with -Werror). So we grep stderr for any message
# or remarks (even with -Werror). So we grep stderr for any message
# or remarks (even with -Werror). So we grep stderr for any message
# common_opt="-pipe -Wall -Werror -Wconversion -Wno-sign-conversion"
common_opt="-pipe -Wall -Werror"
common_opt="-pipe -Wall -Werror"
common_opt="-pipe -Wall -Werror"
common_opt="-pipe -Wall -Werror"
common_opt="-pipe -Wall -Werror"
CFLAGS="$CFLAGS -Werror"
CFLAGS="$CFLAGS -Werror"


具体操作,vi里面replace即可,
:%s/\-Werror/ /g
11 substitutions on 11 lines

完了之后,编译通过,之后 make install 安装.

启动trafficserver,又报错了~

traffic_server: error while loading shared libraries: libtsutil.so.3: cannot open shared object file: No such file or directory


看来是动态链接库的问题,编辑位于 /etc 下的ld.so.conf文件,加入trafficserver的lib路径(/usr/local/libexec/trafficserver).
再重新刷新下ldconfig,
ldconfig -v
即可。
之后就可以正常启动了~

关于trafficserver的配置,可以说是比同类的Squid cache和Varnish cache 都要复杂,看的人都冒汗。

下面是所有配置文件的列表:
[root@PowerPC trafficserver]# ls -l
total 216
-rw-r--r-- 1 cache web 1324 Jun 16 07:08 ae_ua.config
drwxr-xr-x 3 cache web 4096 Jun 16 07:08 body_factory
-rw-r--r-- 1 cache web 1210 Jun 16 07:26 cache.config
-rw-r--r-- 1 cache web 657 Jun 16 07:26 cluster.config
-rw-r--r-- 1 cache web 1868 Jun 16 07:26 congestion.config
-rw-r--r-- 1 cache web 746 Jun 16 07:26 hosting.config
-rw-r--r-- 1 cache web 1313 Jun 16 07:26 icp.config
drwxr-xr-x 2 cache web 4096 Jun 16 07:26 internal
-rw-r--r-- 1 cache web 254 Jun 16 07:26 ip_allow.config
-rw-r--r-- 1 cache web 328 Jun 16 07:26 log_hosts.config
-rw-r--r-- 1 cache web 15076 Jun 16 07:26 logs_xml.config
-rw-r--r-- 1 cache web 365 Jun 16 07:08 mgr.cnf
-rw-r--r-- 1 cache web 1362 Jun 16 07:26 parent.config
-rw-r--r-- 1 cache web 310 Jun 16 07:26 plugin.config
-rw-r--r-- 1 cache web 318 Jun 16 07:08 plugin.db
-rw-r--r-- 1 cache web 0 Jun 16 07:26 proxy.pac
-rw-r--r-- 1 cache web 27444 Jun 16 07:26 records.config
-rw-r--r-- 1 cache web 7047 Jun 16 07:26 remap.config
drwx------ 2 cache web 4096 Jun 16 07:26 snapshots
-rw-r--r-- 1 cache web 1677 Jun 16 07:26 socks.config
-rw-r--r-- 1 cache web 2139 Jun 16 07:26 splitdns.config
-rw-r--r-- 1 cache web 430 Jun 16 07:26 ssl_multicert.config
-rw-r--r-- 1 cache web 68821 Jun 16 07:26 stats.config.xml
-rw-r--r-- 1 cache web 2960 Jun 16 07:26 storage.config
-rw-r--r-- 1 root root 19 Jun 16 07:08 trafficserver-release
-rw-r--r-- 1 cache web 1420 Jun 16 07:26 update.config
-rw-r--r-- 1 cache web 464 Jun 16 07:26 vaddrs.config
-rw-r--r-- 1 cache web 1278 Jun 16 07:26 volume.config
-rw-r--r-- 1 cache web 0 Jun 16 07:26 wpad.dat

很是恐怖~ 不过可以不时的参考官方的帮助文档(http://trafficserver.apache.org/docs/v2/admin/files.htm)。

而我在粗略的配置了一通后,居然报错了~

[Jun 16 15:08:00.991] Manager {3078682880} ERROR: [bindProxyPort] Unable to bind socket: 80 : Permission denied
[Jun 16 15:08:00.991] Manager {3078682880} ERROR: (last system error 13: Permission denied)


我很是不解~有人说,可能是我之前使用了root运行过服务,所以导致了部分文件不能被写入。最好的办法是卸载,重装,恢复初始化。

我便运行了"make uninstall && make distclean",于是我便杯具了~
[ ] ( 3618 次浏览 ) 永久链接 ( 3 / 2339 )
从头到脚编译安装VPS上所有东西 

拜Trafficserver 所赐,把我的VPS上所有的数据都搞没了~使用开源软件的潜在风险还得自己担着~ 我也只好是只认倒霉了~谁让使用MySQL养成的臭习惯呢~

具体见:http://www.mail-archive.com/[email protected]/msg00875.html (需翻墙)

总之,我之后便一狠心删除掉了VPS上的所有数据,就差重装系统了~现如今,我的数据也就那样了,我便打算重新架起VPS。

下载所有需要软件的源码包~如PHP、MySQL之类的.

wget http://mysql.mirrors.hoobly.com/Downloa ... -m5.tar.gz
wget http://nginx.org/download/nginx-1.0.4.tar.gz
wget http://downloads.php.net/stas/php-5.4.0alpha1.tar.bz2
wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.4.tar.gz
wget http://www.hiawatha-webserver.org/files ... 7.5.tar.gz
wget http://repo.varnish-cache.org/source/va ... 0.0.tar.gz
wget http://prdownloads.sourceforge.net/pam- ... RC1.tar.gz

全部解压,ls一下,

drwxr-xr-x 3 root root 4096 Jul 3 06:31 config_bak
drwxrwxrwx 7 1000 users 4096 Jun 6 01:06 hiawatha-7.5
drwxr-xr-x 31 7161 wheel 4096 Mar 14 16:40 mysql-5.6.2-m5
drwxr-xr-x 8 http games 4096 Jun 1 13:30 nginx-1.0.4
drwxrwxrwx 2 1000 1000 4096 Jan 9 2006 pam_mysql-0.7RC1
drwxr-xr-x 14 http games 4096 Jun 20 00:24 php-5.4.0alpha1
drwxr-xr-x 10 1000 1000 4096 Jun 16 15:38 varnish-3.0.0
drwxr-x--x 8 1000 1000 4096 Jun 30 18:15 vsftpd-2.3.4

一个个来吧~

先MySQL,进入目录:
首先 cmake . -LAH 查看编译帮助,我的编译参数:

[root@PowerPC mysql-5.6.2-m5]# cmake . \
> -DCMAKE_BUILD_TYPE:STRING=Release \
> -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \
> -DCOMMUNITY_BUILD:BOOL=ON \
> -DINSTALL_BINDIR:STRING=../bin \
> -DINSTALL_LAYOUT:STRING=STANDALONE \
> -DINSTALL_SBINDIR:STRING=../sbin \
> -DMYSQL_DATADIR:PATH=/var/mysql/data \
> -DSYSCONFDIR:PATH=/etc/sysconfig/mysql \
> -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_EXTRA_CHARSETS:STRING=all \
> -DWITH_FEDERATED_STORAGE_ENGINE:BOOL=ON \
> -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
> -DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
> -DWITH_SSL:STRING=no \
> -DWITH_ZLIB:STRING=bundled

依赖没有问题,开始编译,之后安装.再把之前的配置文件my.cnf 恢复下。

进入 /usr/local/mysql 目录,创建软连接至 /usr/local/bin:
ln -s ../bin bin

再把sbin 下的mysqld 复制到 bin 下:
cp mysqld ../bin

这么做,是为了方便初始化数据库,运行位于scripts 下的mysql_install_db 脚本:
./mysql_install_db --datadir=/var/mysql --user=mysql --basedir=/usr/local/mysql

数据库初始化完了之后,就可以启动MySQL服务了~
mysqld_safe &

最好在运行下 mysql_secure_installation ,设置下root 密码,以及删除测试表.

不过,我发现test 表并没有被删掉,phpmyadmin 提示"can't rmdir './test/', errno: 17"错误。排除了权限问题,我发现原来test 目录下并不是空的,而是有一个".empty"的文件,手动删除(rm -rf test)即可~

接下来PHP,进入目录:
我的configure:
[root@PowerPC php-5.4.0alpha1]# ./configure \
> --prefix=/usr/local/php \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/php \
> --localstatedir=/var \
> --disable-cli \
> --enable-fpm \
> --with-fpm-user=http \
> --with-fpm-group=web \
> --with-config-file-path=/etc/sysconfig/php/php.ini \
> --with-config-file-scan-dir=/etc/sysconfig/php \
> --disable-ipv6 \
> --enable-calendar \
> --enable-dba=shared \
> --enable-exif \
> --with-gd \
> --enable-gd-native-ttf \
> --with-mhash \
> --enable-mbstring \
> --with-mcrypt \
> --with-mysql=/usr/local/mysql \
> --with-mysql-sock=/tmp/mysql.sock \
> --with-mysqli=/usr/local/bin/mysql_config \
> --disable-pdo \
> --enable-sockets \
> --with-xmlrpc \
> --enable-zip \
> --with-zlib \
> --with-bz2 \
> --without-pear

依赖没问题,直接make 编译,之后make install 安装,最后恢复下备份的配置文件。

再然后是Web server,首先是nginx,进入目录:
我的configure:
[root@PowerPC nginx-1.0.4]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/var/run/nginx.lock \
> --user=http \
> --group=web \
> --with-select_module \
> --with-poll_module \
> --with-http_image_filter_module \
> --with-http_sub_module \
> --with-http_dav_module \
> --with-http_flv_module \
> --with-http_gzip_static_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx \
> --http-proxy-temp-path=/tmp/nginx \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

检查依赖,报错:

./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.


解决方案:yum install gd-devel
再次检查,通过。
编译概况为:

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx"
nginx http proxy temporary files: "/tmp/nginx"


make && make install 开始编译安装。之后恢复下之前的配置文件。
nginx -t 测试下配置文件,报错:

nginx: [emerg] the default path name "/tmp/nginx" has the same name as another default path, but the different levels, you need to redefine one of them in http section


看来缓存路径不能设成一样的,如果不像重新编译,就在配置文件里重写。
在nginx.conf 的http 块里加入
client_body_temp_path /tmp/nginx/request/;
一行即可。

之后就是hiawatha了,同样是7.5的版本,我之前编译过一次。不赘述了~
我的configure:
[root@PowerPC hiawatha-7.5]# ./configure \
> --prefix=/usr/local/hiawatha \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/hiawatha \
> --localstatedir=/var \
> --disable-largefile \
> --enable-chroot \
> --enable-command \
> --disable-ipv6 \
> --disable-monitor \
> --disable-ssl

然后就是缓存服务器Varnish,进入目录:
我的configure:
[root@PowerPC varnish-3.0.0]# ./configure \
> --prefix=/usr/local/varnish \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/varnish \
> --localstatedir=/var \
> --disable-largefile \
> --with-pcre-config=/usr/bin/pcre-config \
> --with-jemalloc

检查依赖,没有问题。make 编译,之后make install 安装。
最后在恢复下以前的配置文件,不过值得注意的是适用于2.1.x的配置格式可能与3.0.0有些出入,如引入了字符串 "+" 连接功能。

本来想,随便把vsftpd搞好,随便把pam_mysql 验证也搞定的~不过vsftpd 在编译的时候报错~这真的是很奇怪~

[root@PowerPC vsftpd-2.3.4]# make
gcc -o vsftpd main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o tunables.o ftpdataio.o secbuf.o ls.o postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o banner.o filestr.o parseconf.o secutil.o ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o tcpwrap.o ipaddrparse.o access.o features.o readwrite.o opts.o ssl.o sslslave.o ptracesandbox.o ftppolicy.o sysutil.o sysdeputil.o -Wl,-s `./vsf_findlibs.sh`
sysutil.o: In function `vsf_sysutil_open_file':
sysutil.c:(.text+0x1626): undefined reference to `__open64_2'
collect2: ld returned 1 exit status
make: *** [vsftpd] Error 1


可能我要发邮件问下开发者了~
[ ] ( 1903 次浏览 ) 永久链接 ( 3 / 2250 )

<< <上一页 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 下一页> >>