`

ubuntu 12.04 使用纪要 -- 持续更新

阅读更多

今天 2013.1.4 用了 好几周了  不想说了 用户体验极差 bug N多啊 还有那个全局菜单 你学 apple 大哥你学全啊

 

今天 2013.1.9 从unity回到gnome后 感觉蛮好的 没有再出现 假死的问题了 顺便推荐下IDE http://www.jetbrains.com/phpstorm

 

 

上周四来weiyouxi入职,从那天开始 从 windows 转向 linux 了吧 先从ubuntu 12.4开始吧,如下是我配置环境中所记录的知识点,硬件: thinkpad e430c

写道
Ubuntu 12.04下一键安装LAMP环境,Lamp组件是服务器站点的必备组件,简单的几个步骤就可以搭载好环境.

打开终端

sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin

一键安装需要的组件.

期间会要求你输入mysql数据库的root用户密码,选择服务器类型[apache],phpMyAdmin的密码等。

装完之后重启一下apache,命令:sudo /etc/init.d/apache2 restart

还要把安装的phpmyadmin 链接过来,在/var/www/下用命令:ln -s /usr/share/phpmyadmin phpmyadmin

Ubuntu下Apache、php、mysql默认安装路径
apache:
如果采用RPM包安装,安装路径应在/etc/httpd目录下
apache配置文件:/etc/httpd/conf/httpd.conf
Apache模块路径:/usr/sbin/apachectl
web目录:/var/www/html
如果采用源代码安装,一般默认安装在/usr/local/apache2目录下


php:
如果采用RPM包安装,安装路径应在/etc/目录下
php的配置文件:/etc/php.ini
如果采用源代码安装,一般默认安装在/usr/local/lib目录下
php配置文件: /usr/local/lib/php.ini
或/usr/local/php/etc/php.ini


mysql:
如果采用RPM包安装,安装路径应在/usr/share/mysql目录下
mysqldump文件位置:/usr/bin/mysqldump
mysqli配置文件:
/etc/my.cnf或/usr/share/mysql/my.cnf
mysql数据目录在/var/lib/mysql目录下
如果采用源代码安装,一般默认安装在/usr/local/mysql目录下

Ubuntu 12.04中文输入法的安装

Ubuntu上的输入法主要有小小输入平台(支持拼音/二笔/五笔等),Fcitx,Ibus,Scim等。其中Scim和Ibus是输入法框架。
在Ubuntu的中文系统中自带了中文输入法,通过Ctrl+Space可切换中英文输入法。这里我们主要说下Ubuntu英文系统中,中文输入法的安装。
安装输入法的第一步,是安装语言包。我们选择System Settings-->Language Support-->Install/Remove Languages,将弹出以下窗口: www.2cto.com



输入密码后,系统会安装简体中文语言包。
第二步,安装IBus框架,在终端输入以下命令:
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4
启动IBus框架,在终端输入:
im-switch -s ibus
安装完IBus框架后注销系统,保证更改立即生效。
第三步:安装拼音引擎

有下面几种常用选择:
IBus拼音:sudo apt-get install ibus-pinyin
IBUS五笔:sudo apt-get install ibus-table-wubi
谷歌拼音输入法:sudo apt-get install ibus-googlepinyin
Sun拼音输入法:sudo apt-get install ibus-sunpinyin
第四步:设置IBus框架 www.2cto.com
ibus-setup
此时,IBus Preference设置被打开。我们在Input Method选项卡中,选择自己喜欢的输入方式,并配置自己喜欢的快捷键即可。如下图所示:



第五步:通常情况下,IBus图标(一个小键盘)会出现在桌面右上角的任务栏中。有时候这个图标会自行消失,可使用以下命令,找回消失的IBus图标:
ibus-daemon -drx

Nginx and PHP-FastCGI on Ubuntu 10.04 LTS (Lucid)
Published: Wednesday, April 21st, 2010 by Phil Paradis

The nginx web server is a fast, lightweight server designed to efficiently handle the needs of both low and high traffic websites. Although commonly used to serve static content, it's quite capable of handling dynamic pages as well. This guide will help you get nginx up and running with PHP via FastCGI on your Ubuntu 10.04 LTS (Lucid) Linux VPS.

It is assumed that you've already followed the steps outlined in our getting started guide. These steps should be performed via a root login to your Linode VPS over SSH.

Contents

Set the Hostname
Install Required Packages
Configure Virtual Hosting
Create Directories
UNIX Sockets Configuration Example
TCP Sockets Configuration Example
Important Security Considerations
Enable and Start Services
Test PHP with FastCGI
More Information

Set the Hostname

Before you begin installing and configuring the components described in this guide, please make sure you've followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:

hostname
hostname -f

The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).
Install Required Packages

Issue the following commands to update your system and install the nginx web server, PHP, and compiler tools:

apt-get update
apt-get upgrade
apt-get install nginx php5-cli php5-cgi spawn-fcgi psmisc

Configure Virtual Hosting
Create Directories

In this guide, the domain "example.com" is used as an example site. You should substitute your own domain name in the configuration steps that follow. First, create directories to hold content and log files:

mkdir -p /srv/www/www.example.com/public_html
mkdir /srv/www/www.example.com/logs
chown -R www-data:www-data /srv/www/www.example.com

UNIX Sockets Configuration Example

Next, you'll need to define the site's virtual host file. This example uses a UNIX socket to connect to fcgiwrap. Be sure to change all instances of "example.com" to your domain name.

File:/etc/nginx/sites-available/www.example.com

server {
server_name www.example.com example.com;
access_log /srv/www/www.example.com/logs/access.log;
error_log /srv/www/www.example.com/logs/error.log;
root /srv/www/www.example.com/public_html;

location / {
index index.html index.htm;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}
}

Create a file named /usr/bin/php-fastcgi with the following contents:

File:/usr/bin/php-fastcgi

#!/bin/bash

FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
SOCKET=/var/run/php-fastcgi/php-fastcgi.socket
PIDFILE=/var/run/php-fastcgi/php-fastcgi.pid
CHILDREN=6
PHP5=/usr/bin/php5-cgi

/usr/bin/spawn-fcgi -s $SOCKET -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5

Make it executable by issuing the following command:

chmod +x /usr/bin/php-fastcgi

TCP Sockets Configuration Example

Alternately, you may wish to use TCP sockets instead. If so, modify your nginx virtual host configuration file to resemble the following example. Again, make sure to replace all instances of "example.com" with your domain name.

File:/etc/nginx/sites-available/www.example.com

server {
server_name www.example.com example.com;
access_log /srv/www/www.example.com/logs/access.log;
error_log /srv/www/www.example.com/logs/error.log;
root /srv/www/www.example.com/public_html;

location / {
index index.html index.htm;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}
}

Create a file named /usr/bin/php-fastcgi with the following contents:

File:/usr/bin/php-fastcgi

#!/bin/bash

FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
ADDRESS=127.0.0.1
PORT=9000
PIDFILE=/var/run/php-fastcgi/php-fastcgi.pid
CHILDREN=6
PHP5=/usr/bin/php5-cgi

/usr/bin/spawn-fcgi -a $ADDRESS -p $PORT -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5

Make it executable by issuing the following command:

chmod +x /usr/bin/php-fastcgi

Important Security Considerations

If you're planning to run applications that support file uploads (images, for example), the above configurations may expose you to a security risk by allowing arbitrary code execution. The short explanation for this behavior is that a properly crafted URI which ends in ".php", in combination with a malicious image file that actually contains valid PHP, can result in the image being processed as PHP.

To mitigate this issue, you may wish to modify your configuration to include a try_files directive. Please note that this fix requires nginx and the php-fcgi workers to reside on the same server.

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}

Additionally, it's a good idea to secure any upload directories your applications may use. The following configuration excerpt demonstrates securing an "/images" directory.

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
if ($uri !~ "^/images/") {
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}

Enable and Start Services

Issue the following commands to enable the site:

cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/www.example.com

Create a file named /etc/init.d/php-fastcgi with the following contents:

File:/etc/init.d/php-fastcgi

#!/bin/bash

PHP_SCRIPT=/usr/bin/php-fastcgi
FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
PID_DIR=/var/run/php-fastcgi
PID_FILE=/var/run/php-fastcgi/php-fastcgi.pid
RET_VAL=0

case "$1" in
start)
if [[ ! -d $PID_DIR ]]
then
mkdir $PID_DIR
chown $FASTCGI_USER:$FASTCGI_GROUP $PID_DIR
chmod 0770 $PID_DIR
fi
if [[ -r $PID_FILE ]]
then
echo "php-fastcgi already running with PID `cat $PID_FILE`"
RET_VAL=1
else
$PHP_SCRIPT
RET_VAL=$?
fi
;;
stop)
if [[ -r $PID_FILE ]]
then
kill `cat $PID_FILE`
rm $PID_FILE
RET_VAL=$?
else
echo "Could not find PID file $PID_FILE"
RET_VAL=1
fi
;;
restart)
if [[ -r $PID_FILE ]]
then
kill `cat $PID_FILE`
rm $PID_FILE
RET_VAL=$?
else
echo "Could not find PID file $PID_FILE"
fi
$PHP_SCRIPT
RET_VAL=$?
;;
status)
if [[ -r $PID_FILE ]]
then
echo "php-fastcgi running with PID `cat $PID_FILE`"
RET_VAL=$?
else
echo "Could not find PID file $PID_FILE, php-fastcgi does not appear to be running"
fi
;;
*)
echo "Usage: php-fastcgi {start|stop|restart|status}"
RET_VAL=1
;;
esac
exit $RET_VAL

Start php-fastcgi and nginx by issuing the following commands:

chmod +x /etc/init.d/php-fastcgi
update-rc.d php-fastcgi defaults
/etc/init.d/php-fastcgi start
/etc/init.d/nginx start

Test PHP with FastCGI

Create a file called "test.php" in your site's "public_html" directory with the following contents:

File:/srv/www/example.com/www/public_html/test.php

<?php phpinfo(); ?>

When you visit http://www.example.com/test.php in your browser, the standard "PHP info" output is shown. Congratulations, you've configured the nginx web server to use PHP-FastCGI for dynamic content!
More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

The nginx Homepage
FastCGI Project Homepage
PHP Documentation
Basic Ngnix Configuration


在Ubuntu上配置使用memcached及PHP Memecache 客户端(apt-get方式)

memcache是一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各种格式的数据,包括图像、视 频、文件以及数据库检索的结果等。

要开发使用memcache ,我们必须安装memcache服务端和PHP的memcache扩展

1、首先安装memcache服务端:

$ sudo apt-get install memcached

然后可以使用命令开启memcache:
$ memcached -l 127.0.0.1 -p 11211 -d -u nobody -P /var/run/memcached.pid -m 64M -c 1024 -vv

解释一下几个参数的意思:
-l 监听的ip地址,127.0.0.1是我本地服务器的IP地址,如果你需要多个服务器都能够读取这台memcached的缓存数据,那么就必须设定 这个ip
-p memcached监听的TCP端口
-d 以daemon方式运行,将程序放入后台
-u memcached的运行用户,我设定的是nobody,memcache默认不允许以root用户登录
-P memcached的pid文件路径
-m memcached可以使用的最大内存数量
-c memcached同时可以接受的最大的连接数
如果你希望以socket方式来访问memcached,那么在启动的时候就必须去掉 -l和-p参数,并加上-s参数:
-s memcached的socket文件路径

-vv显示debug信息

2、安装PHP Memecache 客户端
$ sudo apt-get install php5-memcache

完了重启fastcgi服务,然后用phpinfo()应该就能看见 memcache扩展了

ubuntu 下安装memcache
安装服务器
sudo apt-get install memcached
$ memcached -d -m 50 -p 11211 -u root
参数说明 -m 指定使用多少兆的缓存空间;-p 指定要监听的端口; -u 指定以哪个用户来运行

安装php 模块
sudo apt-get install php5-memcache

编辑配置文件
$ sudo vim /etc/php5/conf.d/memcache.ini
; uncomment the next line to enable the module
extension=memcache.so

[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0

在apache中使用 memcache 来作 session 存储,用例子测试一下:

session.save_handler = memcache
session.save_path = "tcp://127.0.0.1:11211"

使用多个 memcached server 时用逗号","隔开,并且和 Memcache::addServer() 文档中说明的一样,可以带额外的参数"persistent"、"weight"、"timeout"、"retry_interval" 等等,类似这样的:"tcp://host1:port1?persistent=1&weight=2,tcp://host2:port2" 。
<?php
session_start();
$_SESSION["UserID"]=123;
echo session_id();
?>

用 sessionid 去 memcached 里查询一下:
<?php
$memcache = memcache_connect('localhost', 11211);
var_dump($memcache->get('19216821213cxycedec65b0883238c278eeb573e077'));
?>

用 memcache 来存储 session 在读写速度上会比 files 时快很多,而且在多个服务器需要共用 session 时会比较方便,将这些服务器都配置成使用同一组 memcached 服务器就可以,减少了额外的工作量。缺点是 session 数据都保存在 memory 中,持久化方面有所欠缺,但对 session 数据来说也不是很大的问题。

memcache是一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各种格式的数据,包括图像、视 频、文件以及数据库检索的结果等。

要开发使用memcache ,我们必须安装memcache服务端和PHP的memcache扩展

1、首先安装memcache服务端:

$ sudo apt-get install memcached

然后可以使用命令开启memcache:
$ memcached -l 127.0.0.1 -p 11211 -d -u nobody -P /var/run/memcached.pid -m 64M -c 1024 -vv

解释一下几个参数的意思:
-l 监听的ip地址,127.0.0.1是我本地服务器的IP地址,如果你需要多个服务器都能够读取这台memcached的缓存数据,那么就必须设定 这个ip
-p memcached监听的TCP端口
-d 以daemon方式运行,将程序放入后台
-u memcached的运行用户,我设定的是nobody,memcache默认不允许以root用户登录
-P memcached的pid文件路径
-m memcached可以使用的最大内存数量
-c memcached同时可以接受的最大的连接数
如果你希望以socket方式来访问memcached,那么在启动的时候就必须去掉 -l和-p参数,并加上-s参数:
-s memcached的socket文件路径

-vv显示debug信息

2、安装PHP Memecache 客户端
$ sudo apt-get install php5-memcache

完了重启fastcgi服务,然后用phpinfo()应该就能看见 memcache扩展了

Mplayer 是一个功能强大的媒体播放器。支持的编码方式有:MPEG 1/2/4、DivX 3/4/5、Windows Media 7/8/9、RealAudio/Video(9以下)、Quicktime 5/6 以及 Vivo 1/2。它支持很多针对MX/SSE (2)/3Dnow(Ex)优化的视频/音频编码……(以下略)

在Ubuntu 10.04 (Lucid) 里安装 Mplayer。

首先在软件源的设置里启用“社区维护的开源软件(universe)”和“有版权和合法性问题的软件(multiverse)”
然后刷新软件源:
sudo apt-get update
用下面这行命令安装:
sudo aptitude install mplayer-gui
或者点击下面的链接:
apt://mplayer
现在您可以在 应用程序⇒影音 里找到 Mplayer Movie Player

在Ubuntu 10.04 (Lucid)里安装 w32codecs 和 libdvdcss2

w32codecs 用于支持WMV、RealMedia和一些其他格式。但是由于版权和法律方面的原因,这个软件包没有包含在Ubuntu的软件仓库里。而libdvdcss2 软件包在播放加密的DVD的时候是必须的。
下面的命令将把 Medibuntu 的软件仓库添加到 Ubuntu,并同时把 Medibuntu 的 GPG 密钥添加到您的密码环,以便于验证 Medibuntu 软件包。
sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get -q update
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring
sudo apt-get -q update
i386 用户用下面这条命令安装 Codecs:
sudo apt-get install w32codecs libdvdcss2
amd64 用户用下面这条命令安装 Codecs:
sudo apt-get install w64codecs libdvdcss2
上面这个下载地址可用于安装大多数适用于 ubuntu 的解码器包。

给Firefox 安装 Mplayer 插件 //注:经验证,下面这段不管用,提示 mozilla-mplayer 不存在。

如果想给 Mplayer 安装 Mplayer 插件,请运行下面这行命令:
sudo apt-get install mozilla-mplayer
或点击下面的链接:
apt://mozilla-mplayer

在Ubuntu碰到CHM的乱码问题,那么直接“sudo apt-get install kchmviewer”吧!需要注意的是,默认这款软件不会集成在菜单里,你需要在终端下打“kchmviewer”或者自己做个启动器

ubuntu右键在当前目录执行终端terminal程序

直接安装一个软件包nautilus-open-terminal
sudo apt-get install nautilus-open-terminal
重启X(Ctrl+Alt+Backspace)!

gedit 支持windows下的中文txt文件的方法:

1. 安装 gconf-editor
2. 终端运行
gsettings set org.gnome.gedit.preferences.encodings auto-detected "['GB18030', 'UTF-8', 'GB2313', 'GBK', 'BIG5', 'CURRENT', 'UTF-16']"

关于Ubuntu中编码不能自动识别,打开GB2312或GBK编码的文件总是乱码的问题网上有很多相关的文章,多也好用。但对于vi中文乱码的问题,网上很多办法似乎都无效,其中《vim中编辑不同编码的文件时需要注意的一些地方》一文从原理上对编码的问题进行了解释。不过,最实际的还是CSDN Blog上的一篇文章,现转载如下:

Ubuntu 默认采用UTF8编码,可以方便global。但对中文支持,还不细致,即便默认采用中文安装,也并不会自动添加GB*等支持,致使在Ubuntu下访问部分Win文本文件时,出现乱码。

I. 配置系统环境
执行 sudo vi /var/lib/locales/supported.d/zh
加入以下配置参数

zh_CN.GB18030 GB18030 (最新汉字编码字符集,向下兼容GBK,GB2312)
zh_CN.GBK GBK (汉字扩展编码,向下兼容GB2312, 并包含BIG5全部汉字)
zh_CN.GB2312 GB2312 (简化汉字编码字符集, 最近有客户要我们改进GB2312,太看得起我们了,我只能说:”NO!”)
zh_CN.GB18031 GB18031 (数字键盘汉字编码输入,面向手持设备,我的Nokia3120从来就是发短信,接听电话,无法和PC通讯,就不用这个了。 maybe用Google Android SDK的大侠们需要这个)
zh_HK.BIG5 BIG5 (繁体)
zh_TW.BIG5 BIG5 (繁体)

然后执行 sudo locale-gen
提示以下信息,成功了
zh_CN.GB18030… done
zh_CN.GBK… done
……

II. 系统环境支持GB*内码了,但用vi, gedit等工具访问文件还会继续乱码,需要针对不同的工具分别配置,使之自己检测支持范围内的编码
e.g. vi
执行 sudo vi /etc/vim/vimrc
加入以下配置参数
let &termencoding=&encoding
set fileencodings=utf-8,gb18030,gbk,gb2312,big5

e.g. gedit
见上面的

ubuntu 安装 curl & php curl 模块
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl


Install RabbitVCS on Ubuntu 12.04

Posted by richard on June 9, 2012

RabbitVCS is a set of graphical tools for accessing the version control software that you use. It supports Subversion and git and is similar to TortoiseVCS found on Windows.

Ubuntu 12.04 provides RabbitVCS in the standard repositories but this is version 0.13 which does not have support for GNOME 3 and so does not provide nautilus integration or gEdit integration.

In order to install the later 0.15 version of RabbitVCS you will need to add the RabbitVCS ppa. To do this add the following repositories:

deb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu precise main
deb-src http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu precise main



Either by editing your /etc/apt/sources.list file directly or using a graphical tool such as Synaptic or Ubuntu Software Center.

Reload the changes and install packages rabbitvcs-core, rabbitvcs-cli, rabbitvcs-nautilus3 and rabbitvcs-gedit. You will need to log out and in again for the changes to take effect.
 
开发工具依据我之前的习惯,照例是选择了 PDT 安装的是 Eclipse for PHP Developers Version: 3.0.2

可惜此版本不再像1.1那样支持java开发了,主要的插件肯定是要装上的: spket,dbeaver,pydev,java,subclipse


Ubuntu 12.04 安装Flash问题

不知道从几时开始,Ubuntu安装Flash经常失败,记得原来(10.04开始)安装 flash 很简单的,用以下方法安装flashplugin

sudo apt-get install flashplugin-installer

但是现在貌似这个变得艰难多了,不论是使用以上命令或者使用Ubuntu-tweak来安装,最终都卡在了下载那个地方无法通过,如下:

......
flashplugin-installer: downloading http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_11.2.202.233.orig.tar.gz

网上搜索了一番,最后参阅了adobe 官旺的指导,才知道现在flash 安装已经不是以前那个方法了。

如果你第一安装,那可以使用以下方法:

访问http://get.adobe.com/cn/flashplayer/下载解压

cd install_flash_player_11_linux.i386
sudo cp libflashplayer.so /usr/lib/mozilla/plugins
sudo cp -r usr/* /usr

如果不幸,已经使用flashplugin-installer 安装,并发生了以上提示的下载步骤错误出,那么需要Ctrl+c先强行推出。

然后使用以下命令,终止flashplugin-installer 的安装

sudo dpkg -r flashplugin-installer
sudo apt-get remove --purge flashplugin-installer

出现提示lock被锁的话,可以使用以下方法删除以继续操作

sudo rm -rf /var/lib/dpkg/lock

删除flashplugin-installer 之后,然后使用上面提供的方法重新安装。


--------------------
eclipse 定位到当前打开的文件

不知道为什么PDT 打开类之后,从文件中转向到其他的类文件中 package exploer不会自动定位到该文件,
Package Explorer的右上角有一个双向箭头图标,按下这个图标后,你在Editor打开任何文件,
Package Explorer就会自动定位到这个文件。

eclipse subclipse 插件禁用中文界面的方法,它的中文界面实在太烂了
打开eclipse\configuration\config.ini文件,在最后添加一句:osgi.nl=en_US

在Ubuntu 12.04 下, eclipse 安装 svn插件一般会遇到两个问题:
1)Failed to load JavaHL Library.

These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = /usr/lib/jni

这里有官方的解决这个问题的指导:http://subclipse.tigris.org/wiki/JavaHL

按照以前的装法

1、sudo apt-get install libsvn-java

该命令会产生libsvnjavahl-1.so文件。

(64位操作系统该文件在/usr/lib/x86_64-linux-gnu/jni/目录下,如果是32位操作体系则在/usr/lib/i386-linux-gnu/jni/目录下。

2、eclipse.ini中增加参数(该文件在eclipse目录中)

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Djava.library.path=/usr/lib/jni

其实eclipse默认使用的library path就是/usr/lib/jni目录,该目录下还有其他java native的实现。所以不能为了解决subclipse的问题,而修改-Djava.library.path的值,应该把需要的文件软链接到默认的library path下(即/usr/lib/jni下)。所以请按照第三步来做。

3、把libsvnjavahl-1.so文件软链接到/usr/lib/jni下

64位操作系统请用这个命令:

sudo ln -s /usr/lib/x86_64-linux-gnu/jni/libsvnjavahl-1.so /usr/lib/jni/libsvnjavahl-1.so

32位操作系统请用这个命令:

sudo ln -s /usr/lib/i386-linux-gnu/jni/libsvnjavahl-1.so /usr/lib/jni/libsvnjavahl-1.so

4、重启eclipse
2) ubuntu Incompatible JavaHL library loaded.  1.7.x or later required

JavaHL 版本过低错误,Ubuntu 12.04中,通过 $ apt-get install libsvn-java 命令安装的版本是1.6.x

如果你的eclipse是3.7.2 默认安装的subclipse 是 1.8.x 版本的,他要求 JavaHL 是 1.7 以上。

所以需要你卸载掉 subclipse  换成 1.6.x 版本。
或者 按装 subclipse版本

sudo add-apt-repository ppa:dominik-stadler/subversion-1.7
sudo apt-get update
sudo apt-get install libsvn-java

不过这样一来,安装的就是 svn1.7了 与之前的1.6的svn格式不同,有问题 纠结了
只能 sudo add-apt-repository -r ppa:dominik-stadler/subversion-1.7 删除这个源再装了 汗
在 eclipse 中卸载subclipse1.8.x这个插件,然后按装 http://subclipse.tigris.org/update_1.6.x/

搞定这些之后又发现一个很纠结的问题,创建项目时使用 svn 项目类型创建的PHP项目无法解析项目中存在的类与方法,不知道原因,最后只能先创建php项目,再使用 team来检出代码,此时就可以解析项目中存在的类与方法,不知道这是subclipse的bug还是PDT的bug。

关于 rabbitvcs 有个要吐槽的地方,在合并代码时,其界面上明确标志 如果对比的版本框留空则合并到最新的版本,但此处留空却什么都不合并,必须指定一系列的版本号,真纠结啊 有高手能解决么

Gambas 是一个linux下类似于 Windows 的 VB 的可视化快捷开发工具.

Gambas 操作及语法几乎和win下的VB一样..在 IDE 上面功能也十分的强.代码编辑器是我十分喜欢的.让人感到清爽,友好.支持高 亮,代码自动提示,等delphi和vb上常见的功能..而且在我们手工输入代码后,保留关键词会自动转为大写,并高亮.

强大的组件扩展功能.

gambas支持linux下常见的几种数据库的连接(mysql/postgresql/sqllite...没讲甲骨文.),并带有一个专门的数据库管理工具.


这个工具很爽,

sudo add-apt-repository ppa:nemh/gambas3
sudo apt-get update
sudo apt-get install gambas3

之前使用wine装的QQ 后面觉得不爽彻底把wine给卸载了,但是 wine卸载之后右键还是有它的菜单项,比如打开chm文件默认有使用wine程序打开的现象,关于这种残留的解决方法:

~/.local/share/applications/wine/Programs/下rm掉多余的菜单项,这样“其他”里就没东西了
rm -rf ~/.local/share/applications/wine*

然后再到~/.config/menus/applications-merged/下去清理多余的垃圾。
rm -rf ~/.config/menus/applications-merged/wine*

关系到右键的:
rm ~/.local/share/mime/packages/x-wine-extension-*

顺便说一句 ubuntu12自带的那个libreOffice的兼容性真的很差。。。。 纠结啊
PHP 语句性能查看 http://www.phpbench.com/

这几天遭遇了ibus消失了的bug,坑爹啊... 在家几天都用不了中文
解决方法1:
gconftool --type boolean -s /desktop/ibus/panel/show_icon_on_systray true
gconftool --type boolean -s /desktop/ibus/panel/show true
gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

上面的这个解决方法其实并没有解决iBus图标消失的问题
造成这个问题的原因是 Ubuntu给IBus加AppIndicator补丁造成的问题.
解决方法2(经过我验证可以):
https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/875435
<引用>
I have the similar problem with oneiric.1. login
2. ps axw|grep ibus
 4194 ?        Sl     0:00 /usr/bin/ibus-daemon --xim
 4200 ?        Sl     0:00 /usr/lib/ibus/ibus-gconf
 4202 ?        Rl     0:35 /usr/bin/python /usr/share/ibus/ui/gtk/main.py
 4204 ?        Rl     0:34 /usr/lib/ibus/ibus-x11 --kill-daemon
 4256 ?        Sl     0:00 /usr/lib//ibus-sunpinyin/ibus-engine-sunpinyin --ibus
 4836 pts/0    S+     0:00 grep --color=auto ibus

 the ibus icon did not show in the upper right pannel and there was no input method.  But the process:
 4204 ?        Rl     0:34 /usr/lib/ibus/ibus-x11 --kill-daemon
occupied almost 100% cpu.

3. I killed the process:
 4204 ?        Rl     0:34 /usr/lib/ibus/ibus-x11 --kill-daemon
and
 4202 ?        Rl     0:35 /usr/bin/python /usr/share/ibus/ui/gtk/main.py
in htop

4. then I pressed Alt+F2 run
    ibus-setup
5. I pressed ok when a dialog pop-up saying the ibus-daemon was not running and it would start a ibus-daemon.
6. ps axw|grep ibus
 4194 ?        Z      0:04 [ibus-daemon] <defunct>
 4897 ?        Sl     0:03 ibus-daemon --xim
 4898 ?        Sl     0:00 /usr/lib/ibus/ibus-gconf
 4900 ?        Sl     0:01 /usr/bin/python /usr/share/ibus/ui/gtk/main.py
 4902 ?        Sl     0:00 /usr/lib/ibus/ibus-x11 --kill-daemon
 4907 ?        Sl     0:00 /usr/lib//ibus-sunpinyin/ibus-engine-sunpinyin --ibus
 4928 pts/0    S+     0:00 grep --color=auto ibus
now, the ibus icon showed in the upper right pannel, the input method worked fine, and cup occupation was normal.
7. logout
8. login, the same problem happened again as described in 1.

other information

1. lsb_release -d
Description:    Ubuntu 11.10

2. dpkg -l|grep ibus
ii  ibus                                   1.3.99.20110419-1ubuntu3                        Intelligent Input Bus - core
ii  ibus-gtk                               1.3.99.20110419-1ubuntu3                        Intelligent Input Bus - GTK+2 support
ii  ibus-gtk3                              1.3.99.20110419-1ubuntu3                        Intelligent Input Bus - GTK+3 support
ii  ibus-pinyin                            1.3.99.20110706-1                               Pinyin engine for IBus
ii  ibus-pinyin-db-android                 1.3.99.20110706-1                               Pinyin engine for IBus - Android database
ii  ibus-qt4                               1.3.1-1ubuntu3                                  qt-immodule for ibus (QT4)
ii  ibus-sunpinyin                         2.0.3-1ubuntu1                                  sunpinyin engine for ibus
ii  ibus-table                             1.3.0.20100621-3ubuntu1                         table engine for IBus
ii  libibus-1.0-0                          1.3.99.20110419-1ubuntu3                        Intelligent Input Bus - shared library
ii  libibus-qt1                            1.3.1-1ubuntu3                                  qt-immodule for ibus (QT4)
rc  libibus1                               1.2.0.20091215-1ubuntu4                         New input method framework using dbus
rc  libibus2                               1.3.9-0ubuntu3                                  New input method framework using dbus
ii  libusb-0.1-4                           2:0.1.12-18                                     userspace USB programming library
ii  libusb-1.0-0                           2:1.0.8-4                                       userspace USB programming library
ii  libusbmuxd1                            1.0.7-1                                         USB multiplexor daemon for iPhone and iPod Touch devices - library
rc  libusplash0                            0.5.49                                          userspace bootsplash library
ii  python-ibus                            1.3.99.20110419-1ubuntu3                        Intelligent Input Bus - Python support
</引用>

今天不知道咋回事 unity的quicklist突然就没有用了,不知道为什么unity经常出现问题还会强制给用户使用,并且最催的是 hud这个对中文用户极不友好,擦。。。。 还是使用 gnome吧 纠结啊

gnome 任务栏上的快捷方式无法删除

 press both the Alt & Super keys at the same time while right-clicking on the panel/applet you wish to edit, move, or remove

这点很坑爹,网上都说是 alt,但是实际上是  super+alt 合在一起 OK了

如何关闭重叠式滚动条?
gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false

在ubuntu 12.04 中安装SciTE 文本编辑器

SciTE是一款基于SCIntilla开发的文本编辑器。最开始SciTE是为了演示Scintilla而开发,但是逐渐发展成了一款非常有用的用于构建、运行程序的程序员编辑器,支持众多的脚本,比如C、C++、PHP、C#、perl、html、css、java等等。免费而且开源。支持linux和win32环境。在windows下面只需要将下载的文件解压缩就能使用。较其它同重量级软件,最耀眼的就是导出功能,可以导出PDF/HTML/RTF/XML/LaTex类型的文件,直接就能将语法高亮的内容导出。
安装

sudo apt-get install scite
wget http://scite-files.googlecode.com/svn-history/trunk/translations/locale.zh_cn.properties
mv locale.zh_cn.properties locale.properties
sudo mv locale.properties  /usr/share/scite

刚安装好的SciTE文本编辑器非常简朴,需要经过适当配置才能成为真正称手的编程利器。
下文中的所有配置项,可以直接拷贝,然后粘贴到SciTE的用户设置文件中即可生效,部分设置项需要重新启动SciTE。在linux系统中,SciTE的用户设置文件为 ~/.SciTEUser.properties。
你也可以直接下载我的配置文件,放置在~/目录中即可。注意,该文件是隐藏文件,文件前面有一个点号。

# 修改所有的字体为微软雅黑,如果希望修改为其它字体,只需要修改default.font.name即可   
default.font.name=font:!Microsoft YaHei
font.base=$(default.font.name),size:11
font.small=$(default.font.name),size:10
font.comment=$(default.font.name),size:11
font.code.comment.box=$(font.comment)
font.code.comment.line=$(font.comment)
font.code.comment.doc=$(font.comment)
font.code.comment.nested=$(font.comment)
font.text=$(default.font.name),size:10
font.text.comment=$(default.font.name),size:9
font.embedded.base=$(default.font.name),size:9
font.embedded.comment=$(default.font.name),size:9
font.monospace=$(default.font.name),size:11
font.vbs=$(default.font.name),size:9   

# 修改打开文件窗口的文件过滤器为“全部文件”
if PLAT_WIN
    all.files=All Files (*.*)|*.*|
    top.filters=$(all.files)|All Source
if PLAT_GTK
    all.files=All Files (*)|*|Hidden Files (.*)|.*|
    top.filters=$(all.files)|All Source
if PLAT_MAC
    all.files=All Files (*.*)|*.*|
    top.filters=$(all.files)All Source

# 打开SciTE时默认全屏
position.maximize=1

# 默认显示工具条
toolbar.visible=1

# 让scite工具条使用gnome当前主题提供的图标
toolbar.usestockicons=1

# 默认显示状态栏
statusbar.visible=1

#在窗口标题栏显示当前文件的全路径文件名称
title.full.path=1

# 默认显示行号
line.margin.visible=1
# 行号至少占用的宽度
line.margin.width=2+

# 高亮当前选中的单词
highlight.current.word=1
# 设置高亮单词的颜色
highlight.current.word.colour=#FF0000

# 当前文件被外部程序修改时自动载入
load.on.activate=1
# 自动重新载入前询问
are.you.sure.on.reload=1

# 在已运行的SciTE中打开新文件
check.if.already.open=1

# 保存最近打开的文件列表
save.recent=1

# 打开SciTE时自动打开上次退出时没有关闭的所有文件
save.session=1

# 设置tab size 为 4个空格的大小
tabsize=4
# 设置缩进的大小为4个空格的大小,可以和tabsize不同
indent.size=4
#缩进时使用空格代替tab,如果设置为1则是空格和tab混合。
use.tabs=1

# 打开编辑窗格自动换行
wrap=1
# 按字进行换行(更适合亚洲语言)。如果设置为1则是按单词进行换行。
wrap.style=2
# 打开输出窗格自动换行
output.wrap=1

# 开启单词自动补全
autocompleteword.automatic=1

# 打开文件时自动检测编码
command.discover.properties=python /home/kenxu/myinstall/FileDetect.py "$(FilePath)"
   
# xml、html自动闭合括号
xml.auto.close.tags=1


下文中自动检测文件编码的相关配置项,需要使用到FileDetect.py文件,可以点击这里,放置到家目录下即可。
# Detect file encoding
# Simple method that just chacks that first 1000 lines are valid in each encoding
# and chooses first from set that is valid for all lines checked.
# A better version would allow for a small proportion of failures and rank encodings
# depending on how well they match the input.
import sys
import os

encodings = [
    ['utf-8', 65001, 0],
    ['cp932', 932, 128],
    ['cp936', 936, 134],
    ['cp949', 949, 129],
    ['cp950', 950, 136],
]

codings = [e[0] for e in encodings]

def EncodingWorks(encoding, text):
    try:
        text.decode(encoding)
        return True
    except UnicodeDecodeError:
        return False
   
# Read up to first 1000 lines of file
if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]):
    with open(sys.argv[1], "rb") as f:
        lineNumber = 1
        for line in f.readlines():
            # Filter out any encodings that fail
            codings = [c for c in codings if EncodingWorks(c, line)]
            lineNumber += 1
            if lineNumber > 1000:
                break

comment = ''
for c in codings:
    for e in encodings:
        if e[0] == c:
            codePage, characterSet = e[1:]
            if codePage:
                print('%scode.page=%s' % (comment, codePage))
            if characterSet:
                print('%scharacter.set=%s' % (comment, characterSet))
            # Display other matches as comments so can check results
            comment = '#'

# Change the caret colour so we can see that something happened
print('caret.fore=#4499FF')


Callisto Discovery Site 安装
http://download.eclipse.org/callisto/releases/

netbeans字体反锯齿解决
解决这个问题有两个方法:

一个是只让Netbeans使用反锯齿,编辑Netbeans安装目录里的/etc/netbeans.conf,加上这个启动参数

-J-Dawt.useSystemAAFontSettings=on

另一个是让所有的Java程序都使用反锯齿,就是在~/.profile后面再加上

export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'

某些jdk中不存在swing.properties,根据java文档描述,如果不存在的话,就手动添加该文件到jre/lib的文件夹下。然后在该文件中添加以下内容:

#swing.defaultlaf = javax.swing.plaf.metal.MetalLookAndFeel #swing.defaultlaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel #swing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel

swing.defaultlaf = com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel

其中#后面的内容是被注释掉的。且如果有两行没有#,则以最后一次的设置为准。

网页中好多的文档都写其在java_home所指向的jre/lib下,但经过我的尝试,如用eclipse环境需要将该文件放到help->installation details->configuration中的java.home所描述的路径下的jre/lib下。而不是系统变量中的java_home下所指的jre/lib下。其他路径均不行。

 修改netbeans配置文件
代码如下
vim ~/netbeans-7.0.1/etc/netbeans.conf

在netbeans_default_options="....."里面添加参数"-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd"
代码如下
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd"
(* 至于为什么要加这两个参数,大家可以去google下)

如此一来,代码锯齿的问题是解决了,但是netbeans界面字体也不是很好,比如菜单栏,dialog等界面自动都是默认的宋体,如何能跟ubuntu一样使用文泉驿正黑呢,遂研究了下netbeans和Zend Studio的不同之处, netbeans依赖于JVM,当我打开JVM的时候发现JVM的界面跟netbeans的界面十分相似,于是便着手解决JVM的字体优化

3.更改JVM字体设置
代码如下
sudo vim /usr/lib/jvm/java-6-sun/jre/lib/swing.properties
将第二行的注释符号去掉
代码如下
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
意思就是使JVM运行的时候继承GTK的风格外观等

将JVM默认的Ubuntu字体设置去掉
代码如下
sudo mv fontconfig.Ubuntu.properties.src fontconfig.Ubuntu.properties.src.bak
sudo mv fontconfig.Ubuntu.bfc fontconfig.Ubuntu.bfc.bak
编辑fontconfig.properties文件
代码如下
sudo gedit /usr/lib/jvm/java-6-sun/jre/lib/fontconfig.properties
找到Font File Names的地方,把前两行的字体路径替换成你想要的
代码如下
filename.-arphic-ar_pl_shanheisun_uni-medium-r-normal--*-*-*-*-p-*-iso10646-1=/usr/share/fonts/truetype/wqy/wqy-microhei.ttc
filename.-arphic-ar_pl_uming_uni-medium-r-normal--*-*-*-*-p-*-iso10646-1=/usr/share/fonts/truetype/wqy/wqy-microhei.ttc

试过了好几种字体,发现这个字体效果最好

Ubuntu 12.04 安装NetBeans后菜单文字暗淡 暗淡的看不清
解决办法:

*** @***:~$ sudo vi /usr/share/themes/Ambiance/gtk-2.0/gtkrc

将 338 行内容

style "menu" {
换成
style "menu" = "dark" {

所谓的轻量级的源代码编辑器 排除 eclipse & netbeans 这种级别的 诸如 gedit scite,sublime_text2 虽然很好用 但是都无 函数列表 这种功能 等等  今天找到一个好用的 geany 这个给力的东西,其是基于scite的,感觉好好 现与大家分享 哈哈





sql 查询相关: http://gsql.org GSQL 这个东西也蛮好使,基本可以比得上 小企鹅的 lite 版本了


为了在vbox中使用USB 使用 usermod 结果把自身从sudoer用户组中移除了 被催了 加上又把root给禁用了 所以 。。。。 很悲惨 只能进入 单用户模式了

关于 变更用户组把自身从 sudoer 移除的解决
重启后 按shift 进入 grub 选择界面 选择恢复模式项
此处 切记不要点击 而是 按 e 进入编辑界面
将 下面的某行(应该是倒数第二行) 中的 ro 修改成 rw single init=/bin/bash

进入之后 vim /etc/sudoers 在其中添加一行
用户名 ALL=(ALL) ALL
 
不错的 ubuntu 使用介绍博客 http://ubuntudaily.net
 


关于QQ 这个 我要说的是 甭再弄什么 webqq 什么 java版本的 qt版本的 linux 下qq 都是扯淡的玩意

真正想使用的还是 虚拟机 + xp + qq 吧 唉

这么才是好用啊 其它的都是浮云

 

开启SSH服务的方法如下:

sudo apt-get install openssh-server

Ubuntu缺省安装了openssh-client,所以在这里就不安装了,如果你的系统没有安装的话,再用apt-get安装上即可。

然后确认sshserver是否启动了:

ps -e |grep ssh

如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明ssh-server已经启动了。

ssh-server配置文件位于/ etc/ssh/sshd_config,在这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号,如222。然后重启SSH服务:

sudo /etc/init.d/ssh resar

ssh连接:ssh linuxidc@192.168.1.1

 
  • 大小: 204 KB
4
3
分享到:
评论
9 楼 vb2005xu 2013-04-07  
putty 使用 http://dzh001.blog.51cto.com/2767/40624
8 楼 vb2005xu 2013-01-08  
http://fifesoft.com/projects.php java code insigt compa
7 楼 vb2005xu 2013-01-08  
sublime text2 函数列表 快捷键 ctrl + r
6 楼 vb2005xu 2013-01-06  
自从从 unity 退回到 gnome 之后 崩溃假死 暂时木有了 , 开发时 alt + / 也好使了
坑爹的 unity 啊
5 楼 vb2005xu 2012-12-26  
linux tishu 免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com
4 楼 vb2005xu 2012-12-21  
3 楼 cxh116 2012-12-17  
无力吐槽,一个ubuntu系统,RPM(Redhat Package Manager)都来了
2 楼 vvvpig 2012-12-17  
也是经常在Ubuntu12.04遇到假死,默认Unity桌面Bug一堆换个桌面环境试试,比如XUbuntu或者Kubuntu
1 楼 vb2005xu 2012-12-16  
发现了一个问题 ubuntu 12.04 频繁假死 这个问题咋办???

相关推荐

Global site tag (gtag.js) - Google Analytics