linux.ubuntu

A trail of 93 pages, marked with comments, by enjoylife
About this trail:

sudo apt-get install openssh-server

*Remember: You can open a terminal by pressing Alt+F2, typing gnome-terminal and pressing enter

93 marks in this trail
2

Creating Additional Desktops

In the examples so far we have only covered remote access to the primary desktop. By primary desktop we mean the desktop you see when you sit at your computer and turn on the monitor. While this is fine for a single user system we should not lose sight of the fact that Linux is a multi-user operating system and it will often be necessary for more than one person to have remote desktop access at a time. While it might be fun to watch everyone fight over the mouse point as they share the same desktop it is clear that not much work will get done. The solution to this is to run multiple desktops for the users to connect to.

New desktop environments are created using the vncserver utility. The first step is to assign a password to protect these desktops. THis can be achieved using the vncpasswd tool. Run this tool from the command-line prompt in a terminal window and enter the password of your choice.

The desktop we have used so far in this chapter is desktop :0. New desktops must be assigned different numbers. For example to launch desktop 1: run the following command from a terminal window command-line prompt:


sudo apt-get install vnc4server xinetd

vncserver :1 -extension XFIXES

http://www.movingtofreedom.org/2007/02/16/howto-remote-desktop-with-vnc-in-ubuntu-edgy-gnu-linux/
3
  • Download the following three files:
"NX Desktop Server DEB for Linux" from [3]
"NX Node DEB for Linux" from [4]
"NX Client DEB for Linux" from [5]
  • Install the files in the order shown below by right clicking on them and installing them, or using a package manager, or from the command line you could do sudo dpkg -i file/path/filename.deb for each file. Install them in this order:
4

To reemphasize what hhcv said: I also needed to do
sudo adduser SomeNewUserName

(and give this new user a password)

before I could successfully run

sudo smbpasswd -a SomeNewUserName

The first creates a UNIX user, the second creates an SMB user. I don't know if the two passwords need to be the same, but I made them the same just in case.


===================================

1) create unix user (e.g. wsuser)
2) sudo apt-get install samba smbfs
3) sudo smbpasswd -a wsuser
4) sudo gedit /etc/samba/smbusers
#add this line
wsuser = "wsuser"
5) sudo gedit /etc/samba/smb.conf
# add two lines after "####### Authentication #######"
security = user
username map = /etc/samba/smbusers

# Uncomment below three lines
[homes]
comment = Home Directories
browseable = yes
# add line
writable = yes


access windows shared directory from Linux samba

sudo mkdir /mnt/l-sjn-xxx.corp.yyy.com

sudo smbmount //l-sjn-xxx.corp.yyy.com/public_share /mnt/l-sjn-xxx.corp.yyy.com -o user=xxx,gid=users


5

Installing apxs2 on Ubuntu Warty

I need to install an apache module from source, but apxs2 is nowhere to be seen on the system.

apt-cache search apxs2 doesn’t help, where can it be?

A quick question on irc.freenode.net #ubuntu, and the answer is there: install apache2-prefork-dev.


Use “apt-file” to look for specific files to be installed.

$ apt-file search apxs

May need to do this if you have never used apt-file:
$ sudo apt-file update


6

How To Configure Remote Access To Your Ubuntu Desktop

Version 1.0
Author: Falko Timme
Last edited 01/23/2008

This guide explains how you can enable a remote desktop on an Ubuntu desktop so that you can access and control it remotely. This makes sense for example if you have customers that are not very tech-savvy. If they have a problem, you can log in to their desktops without the need to drive to their location. I will also show how to access the remote Ubuntu desktop from a Windows XP client and an Ubuntu client.

I do not issue any guarantee that this will work for you!

7

I've created a package to be used with NX Free edition.

But you have to edit /usr/NX/etc/node.cfg and change:
 - CommandStartGnome="/usr/bin/dbus-launch --exit-with-session gnome-session"
to
 - CommandStartGnome="/usr/bin/nx-session-launcher-suid gnome-session"

The package is in the building queue, once it finish I will post the location here.

 volksman wrote on 2008-06-26: (permalink)

After installing the above package and making the change to /usr/NX/etc/node.cfg I am able to use PolicyKit remotely.

Nicely done Marcelo!

8
According to other posts I added ServerName "localhost" to the .etc/apache2/apache2.conf and restarting apache2 made the error about qualified domain name vanish.
9
This tutorial describes how to set up an Apache 2 webserver as proxy with disk caching and deflating (compressing like mod_gzip) for Zope under Debian Testing. It may or may not be working with other distributions. Please send me feedback.

Christian 'Tiran' Heimes

How to set up an Apache 2 web server as proxy with disk caching and deflating.
Page 1 of 7.

Prerequisites

  • Apache 2 installed and running
  • The following Apache 2 modules installed (they should be shipped with Apache 2)
10

How to mount a remote ssh filesystem using sshfs October 28, 2005

Posted by Carthik in ubuntu.
trackback

SSH is protocol to transfer files securely. Like FTP, but more secure. Many hosting services offer their client the ability to remotely login to their hosting account using ssh. Transferring files to an from an ssh account can be done using the scp command. However, it would be neat if you could mount a remote folder that you can access using ssh on your local computer, so that you can access files on an ssh account just like they were local files on your pc, right? Well now you can! Mount a folder in an ssh account, edit the files locally and save the files, and the fi

11
OSX Leopard 今天才刚刚出炉,就已经把 Leopard 的风格移植到 Linux 上了 [via CB],与过去 Nicky 介绍过的非完美 OSX 风格改造方案不同的是,我们不再需要到处寻找一大堆的零部件,只需要去 Mac4Lin 下载 3 个包含主题、图标、光标、壁纸等等内容的压缩包外加 1 个说明文档,它们的体积也确实够大,加起来足足有 60M 之巨!看在能给自己的 Ubuntu 穿上美丽的新衣裳 Leopard,下载时付出一点点耐心也是非常值得的。
改造的方法那份 PDF 文档已经说得非常详细了,不过是英文的,有朋友需要中文版教程吗?
目前我还没有完全达到效果图的程度,已经很接近了,仍在努力中!心动的朋友请赶快:
12
Update: 找到了更好的办法,直接 sudo apt-get install sun-java6-jre sun-java6-jdk 就搞定了 JRE 和 JDK 了。省去了以下的麻烦,不过安装之后建议使用 sudo update-alternatives –config java 将 JVM 切换至最新安装的 Sun JVM。
首先下载 JRE 二进制自解压包,目前最新版本为 JRE 6 Update 2,文件名 jre-6u2-linux-i586.bin,大小约 18.22M。
13

如何为 Ubuntu 7.04 (Feisty Fawn) 安装中文输入法。(这篇文章的标题之所以用英文写,是为了方便大家在没有中文输入法的情况下也能找到此文。)

选择之一:安装 SCIM

其实即使是在不能进行中文输入的 Ubuntu 中,默认也有 SCIM 这个输入法的,我们只需要用下面的命令为其添加中文输入支持和智能拼音输入法就可以了。

sudo apt-get install im-switch scim-chinese scim-pinyin
# 如需安装五笔输入法,安装 scim-tables-zh 即可
im-switch -s scim

按下 Ctrl + Alt + BackSpace 重启 X 就可以看到它了。

选择之二:fcitx 小企鹅输入法

我个人是不太习惯 SCIM 的五笔输入,感觉做的非常别扭,并且词组库也不全,所以在从 fcitx 改向 SCIM 没两钟头后又立刻转回 fcitx。

安装步骤如下:

sudo apt-get install fcitx im-switch
im-switch -s fcitx
# 如果你的系统的 locale 是英文,还需要让 fcitx 支持英文系统的自动启动:
sudo gedit /etc/gtk-2.0/gtk.immodules

找到 “X Input Method” 那一行,把 “ko:ja:th:zh” 替换为 “en:ko:ja:th:zh”。

同样,按下 Ctrl + Alt + BackSpace 重启 X 后就可以看到它了。

14

看了 Nicky 的 Eva 不能登录的解决办法,我心想今儿个再试试看 Eva 能不能用,其实压根没报什么希望,孰料居然可以上了。

Eva 0.4.9

我用的 Eva 版本是 0.4.9,之前死活登录不了,提示“密码错误”,今天又好端端地可以用了,不知道是马腾讯斩了珊瑚虫乐得屁颠了,还是之前我 RP 太低。

PS: 我什么方法也没用,只是试了试就登录成功了,如果非要说我做了什么,那就是正在升级到 Ubuntu 7.10 Gutsy Gibbon,应该没什么必然联系吧?

15

一般安装

1、下载ubuntu-6.10-alternate-i386.iso  ,一定要是alternate版,而不是desktop版

2、下载引导文件 (这个其实不是这么用的,你当然可以去下个grub for dos,不过这里有我就懒得找了)
解压后把 boot 文件夹、grldr文件移到 C:\
在 c:\boot.ini 文件后面添加
c:\grldr="Ubuntu Linux "
把 timeout=0 改成 timeout=3

3、在任意盘找根目录中建一个 edgy 文件夹,把下载的桌面版光盘(*.iso)文件放到此目录中

4、下载引导文件initrd.gz , vmlinuz

5、修改c:\boot\grub\menu.lst 加入如下内容

代码:
16
Install 7z file archive support from the package p7zip (click the link to install), or by running the command below in your terminal:
sudo apt-get install p7zip
17

How To Install VMware Server (Version 1.0.6) On An Ubuntu 8.04 Desktop

This tutorial provides step-by-step instructions on how to install VMware Server (version 1.0.6) on an Ubuntu 8.04 desktop system. With VMware Server you can create and run guest operating systems ("virtual machines") such as Linux, Windows, FreeBSD, etc. under a host operating system. This has the benefit that you can run multiple operating systems on the same hardware which saves a lot of money, and you can move virtual machines from one VMware Server to the next one (or to a system that has the VMware Player which is also free).

18

Ubuntu Linux Install Sun Java Development Kit ( JDK ) and Java Runtime Environment ( JRE )

Posted by Vivek Gite [Last updated: July 1, 2008]

<!-- google_ad_client = "pub-7825705102693166"; google_ad_slot = "1901335248"; google_ad_width = 300; google_ad_height = 250; //-->

Q. How do I install Sun Java Development Kit (JDK) and Java Runtime Environment (JRE) under Ubuntu Linux? It appears that there are multiple JRE installed by default under Ubuntu. How do I select and use Sun JRE only? Can you explain steps required to set the environment to run java programs or apps?

A. Ubuntu Linux 7.10 has following packages from Sun:
=> sun-java6-bin : Sun Java Runtime Environment (JRE) 6

=> sun-java6-demo : Sun Java Development Kit (JDK) 6 demos

=> sun-java6-jdk : Sun Java Development Kit (JDK) 6

=> sun-java6-jre : Sun Java Runtime Environment (JRE) 6

19
  1. Download and install JDK 5+ (make sure your JAVA_HOME environment variable points to the JDK, not a JRE).
  2. Download and install MySQL 5.x.
  3. Setup a local SMTP server or change mail.properties (in src/main/resources) to use a different host name - it defaults to "localhost".
  4. Download and install Maven 2.0.9+.
  • From the command line, cd into your "Source" directory (c:\Source on Windows, ~/dev on Unix) and run one of the mvn archetype:create commands from the table below.  

  • export JAVA_HOME=/usr/lib/jvm/java-6-sun
    export M2_HOME=/usr/lib/apache-maven/apache-maven-2.0.9
    export M2=$M2_HOME/bin
    export MAVEN_OPTS="-Xms256m -Xmx512m"
    export PATH=$PATH:$JAVA_HOME/bin:$M2

20

9. Compiling from source

Ubuntu's package repository is huge, particularly when you factor in packages in the Universe and Multiverse repositories. However, many users find themselves needing to install packages from source, either because they want to use a newer package than is available in the repository, or they want to try something that's not in the Ubuntu repository at all.

If you want to install packages from source, you can use a few shortcuts to make life easier. First, you'll probably want to get the build-essential meta-package if you haven't installed any developer tools. Run sudo apt-get install build-essential; it will grab GCC, the Linux kernel headers, GNU Make, and some other packages that you'll probably need.

Next, if you're going to compile a package such as Gaim because a new version is out, you might be able to satisfy the new version's dependencies with the old version's dependencies. To do this, grab the package's build dependencies with sudo apt-get build-dep packagename . That will grab all of the development packages you need to build the package that's currently available in Ubuntu, and will probably satisfy dependencies for the new version you're compiling.

Finally, don't make install when you compile from source -- use CheckInstall instead. CheckInstall will create a Debian package and install it for you, so you can remove or upgrade the software more easily later on.

Grab CheckInstall with apt-get install checkinstall. After you've run ./configure ; make, just run sudo checkinstall and answer a few simple questions. Note that if you compile packages on AMD64, CheckInstall will select X86_64 as the architecture rather than amd64 -- which will cause the package install to fail, since Ubuntu expects amd64 as the architecture rather than X86_64.

By the way, the packages created by CheckInstall also make it easier to deploy the same package on several machines, if you happen to have several systems running Ubuntu. See Joe Barr's excellent CLI Magic feature on CheckInstall too.

22
This command fixed my problem... I read it somewhere else.



vsr@localhost:~$ sudo cp /usr/lib/libpng12.so.0 /usr/lib/vmware/lib/libpng12.so.0/

vsr@localhost:~$ sudo cp /usr/lib/gcc/i486-linux-gnu/4.2.3/libgcc_s.so /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1
24

How to enable the universe and multiverse repositories in Ubuntu 8.04 (Hardy)

Posted by admin on June 4th, 2008 Email This Post Email This Post

<!-- google_ad_client = "pub-3561711309083119"; //Ubuntu Rectangle google_ad_slot = "1464388544"; google_ad_width = 300; google_ad_height = 250; //-->
There are thousands of programs available to install on Ubuntu. These programs are stored in software archives (repositories) and are available for installation over the Internet. This makes it very easy to install new programs. It is also very secure, because each program you install is thoroughly tested and built specifically for Ubuntu.

The universe and multiverse repositories are official Ubuntu repositories, with safe, well-tested programs. The only difference between them and the repositories enabled by default is that the universe and multiverse repositories are maintained by the Ubuntu community rather than by paid Ubuntu developers.

There are three ways to enable the universe and multiverse repositories in Ubuntu 8.04 (Hardy Heron): via the graphical Software Sources tool,via the Synaptic Package Manager or via the command line.

Using Software Sources

To enable the universe and multiverse repositories using the Software Sources tool, you need to follow this procedure

Go to System->Administration->Software Sources


deb http://wine.budgetdedicated.com/apt hardy main


25
All the programs which you install using Synapatic package manger,apt-get,aptitude have a .Deb file in the following folder

/var/cache/apt/archives

This is very useful when you want to check which version of package is installed on your system and you can take backup of this folder and install all the packages in another machine

If you want to use GUI Program for this check here

addthis_url = 'http%3A%2F%2Fwww.ubuntugeek.com%2Fbackup-installed-packages-on-ubuntu.html'; addthis_title = 'Backup+installed+packages+on+ubuntu'; addthis_pub = 'david23';
26

hough there are many alternatives for MS Office, no doubt MS Office 2007 is a winner. If you want to install MS 2007 in Linux follow these steps:
<!-- google_ad_client = "pub-0816309066023726"; google_ad_slot = "7783831711"; google_ad_width = 468; google_ad_height = 60; //-->

  1. Install Wine
  2. Select Applications>Wine>Configure Wine to bring the Wine Configuration dialog box.
  3. Select Windows Version as Windows Vista from the Applications Tab
  4. Override two dll files rpcrt4.dll and msxml3.dll from Libraries tab. Override them to be Native (Windows)
  5. Download rpcrt4.dll file. Click here and save it on your desktop.
  6. Open the c_drive from Wine menu
  7. Delete rpcrt4.dll and msxml3.dll files from Windows/System32 directory.
  8. Copy the downloaded rpcrt4.dll file into Windows/System32 directory
  9. Download msxml3.msi file from Microsoft download site (here is the direct link for your convenience).
  10. Install msxml3.msi file from the Terminal window by issuing msiexec /i msxml3.msi
  11. Double click on setup.exe file from your MS Office 2007 installation CD. If it doesn’t work just type wine setup.exe from the Terminal window.
  12. Follow the normal installation procedures.

Watch the step-by-step video:

28
How can you make your Ubuntu desktop look beautiful and be productive at the same time? With these three things:

<!-- google_ad_client = "pub-0816309066023726"; google_ad_slot = "7783831711"; google_ad_width = 468; google_ad_height = 60; //-->
I. Avant Window Navigator:
Avant Window Navigator (AWN) is a Mac like dock-bar which (as of now) sits horizontally on the bottom of your screen (development is on the way for vertical support) helping you to launch programs and locations. You can install applets to make it more productive such as checking email, reporting local weather, showing time and calendar etc. Let’s get our hands dirty (to make the desktop beautiful)
29

Skype and aMSN

On Hardy Heron (and possibly earlier versions as well) SCIM will not work on applications compiled with their own version of QT such as Skype or aMSN. To resolve this do the following in addition to the guide above:

  • Edit /etc/profile
    sudo gedit /etc/profile
  • And add the following lines
    # SCIM
    export XMODIFIERS='@im=SCIM'
    export GTK_IM_MODULE="scim"
    export XIM_PROGRAM="scim -d"
    export QT_IM_MODULE="scim"
    scim -d

If you haven't already added your locale to /etc/scim/global do that now.

  • Run the command 'locale' in your terminal, and copy the locale name after LANG=
  • Edit the file /etc/scim/global:
30

I’m Using Ubuntu 8.04 final, and it didnt work out in the first place.

after installing libstdc++5 from synaptic
and copying the codecs to /usr/lib/codecs

everything worked fine!
(dont know which one of them made the difference, it probably has been only be the directory change)

31
Xterm from Ubuntu (version 209) supports 256 colours.

So, I checked on my system, but vim inside screen does not show the colours properly.

So then I did a google search and came accross this:  http://frexx.de/xterm-256-notes/
bartman, August 24, 2006 21:02 Update on vim/screen/xterm using 256 colours:

vim shows 256 colours inside screen, but if that screen is configured with 256 colour support and if your screenrc contains:

    attrcolor b ".I"
    termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
    defbce "on"

... as the previous link suggested.

My notes: http://www.jukie.net/~bart/blog/256-colour-xterm
Anonymous, August 25, 2006 8:31 Thanks bartman,
now I have got 256 colors in vim!
But I had to put these lines into my ~/.vimrc:
set t_AB=^[[48;5;%dm
set t_AF=^[[38;5;%dm
Did you succeed without them?
32
fixed it...here was the solution....

adding to /etc/modprobe.d/alsa-base

options snd-hda-intel model=3stack
34
这个问题是在Ubuntu8.04里的(不是windows下的问题,用windows的没有必要看)。

解决方法很简单

其实就一条命令:sudo apt-get install libflashsupport
35
原理我一向糊涂,还是不要写了。
配置,简单
http://www.ccs.neu.edu/home/flan/
到这里下载字体和fonts.tar.bz2整个覆盖你的/etc/fonts目录,记住先删了真个目录
永无后患,呵呵。
字体需要拷到哪我忘了,大概也就是/usr/share/fonts就行了
37
To re-order the list, the file vm-list file needs to be edited. 1 - Close the VMWare Server Console 2 - In Windows open a command prompt (Start \ Run…) and enter the following command: NOTE: (virtual machines do not need to be stopped) net stop "VMware Registration Service" Linux systems do not need to stop any deamons. 3 - Make a backup copy of the vm-list file, before editing (Windows users can use Notepad and Linux users can use VI or any editor of your choice). In Windows Vista the file can be found in the following folder location: C:\Users\All Users\VMware\VMware Server In all other versions of Windows (XP/2000/2003): C:\Documents and Settings\All Users\VMware\VMware Server In Linux: etc/vmware/vm-list NOTE: if you can not find the file, search for vm-list to locate it. When editing the file, order the VM's to your preference and make sure there is a carriage return after each VM entry (otherwise the VM will not appear in the inventory list). 4 - In Windows restart the VMware Registration Service: net start "VMware Registration Service"
38
关于用realplayer播放rmvb文件偏色的问题
我找到解决的办法了,在realplayer的菜单里找到:工具-->首选项-->硬件
将XVdieo前的勾去掉就可以了。
39
改叫数据空间了,好像以前版本就叫文件共享,现在1.6.2版本改为数据空间了。但你必须安装VirtualBox Guest Addition包。

1.启动虚拟windows xp,安装VirtualBox Guest Addition。进入虚拟机系统去把光驱里面的软件安装好。

2.关掉xp,点击设备菜单下面的分配数据空间,添加你需要共享的文件夹路径。最好是选默认固定分配,这样就不用每次都从新选。

3.重新进入你的虚拟机系统,右击我的电脑-》映射网络驱动器。选vitualbox shared folders下的你刚刚选择的文件夹。

4.o(∩_∩)o...哈哈,大功告成了。
40
刚才看了一下,进入X以后,ficitx的进程没有自动启动呢。在对话里面手动添加了fcitx,现在是可以了。但是不知道是原因造成的问题。。 Question


我也是天津的哦……

哈哈

fcitx加入会话然后修改一下~/.fcitx/config即可

感觉fcitx比scim省事多了(scimer别**)

虽然scim权威强大,但是经常出现莫名又奇妙的错误……

fcitx省心,什么时候fcitx能重新开发啊?

它啥时候能和搜狗词库同步,那么就统领中文输入法了!
41

Ubuntu 8.04 中开启3D桌面特效与设置方法

Ubuntu 8.04 (Hardy Heron) 中集成了强大3D交互界面,Ubuntu 的 3D 桌面特效给用户带来了一种全新的视觉用户。想必有很多朋友也因为看到了 Ubuntu 8.04 那炫目的 3D 桌面特效才开始慢慢地了解 Ubuntu 8.04 (Hardy Heron) 的。虽然在这之前也不少的朋友写过设置 Ubuntu  Linux 3D 桌面特效的文章,但新发行版的发布也会有新的朋友看到了 Ubuntu 3D 桌面特效而接触 Ubuntu  Linux 。因此,我觉得有必要把在 Ubuntu 8.04 (Hardy Heron) 开启 3D 桌面特效的方法给新手们再详细的介绍一下。

本文采用图文并茂的方式给新们讲解,几乎每一步骤都有配图片和文字说明,通过本文的介绍了后,没有多少 Ubuntu Linux 基础的新手们也应该能轻松地在 Ubuntu 8.04 (Hardy Heron) 中开启3D 桌面特效。

42
英文Locale下使用中文输入法

如果你在英文locale下,正确安装scim或fcitx后仍无法正常使用输入法,解决的方法如下:


sudo aptitude install im-switch

如果你用scim,运行

sudo im-switch -s scim -z all_ALL
im-switch -s scim -z all_ALL
43
我最初的笔记,希望能给初学的你带来些方便

新手常用命令:

查看版本
cat /etc/issue or cat /etc/lsb-release

查看内核
uname -a (显示全部信息).
uname -r (显示内核信息)
44
Ubuntu 8.04 中开启3D桌面特效与设置方法 (2008-05-24 14:02:04)
本文系转载,特此注明,对于UBUNTU的新用户大都是被它的特效所吸引,本文就是教你怎么开启特效。

Ubuntu 8.04 (Hardy Heron) 中集成了强大3D交互界面,Ubuntu 的 3D 桌面特效给用户带来了一种全新的视觉用户。想必有很多朋友也因为看到了 Ubuntu 8.04 那炫目的 3D 桌面特效才开始慢慢地了解 Ubuntu 8.04 (Hardy Heron) 的。虽然在这之前也不少的朋友写过设置 Ubuntu Linux 3D 桌面特效的文章,但新发行版的发布也会有新的朋友看到了 Ubuntu 3D 桌面特效而接触 Ubuntu Linux 。因此,我觉得有必要把在 Ubuntu 8.04 (Hardy Heron) 开启 3D 桌面特效的方法给新手们再详细的介绍一下。
46
gaint_star 写道:
恋鸟之伊 写道:
zhangsong023 写道:
audacious里将编码选为chinese,再填上cp936,犯不着转码。

但是我还是老样子啊……


还有一解决办法就是
在首选项->播放列表->歌曲显示
标题格式 改为 自定义
自定字符串 改为
代码:
%f

这样就可以啦


顶一下。这样可以解决的。。
47
刷新GNOME面板:killall gnome-panel
刷新gnome桌面:killall nautilus
以上创建一个启动器就行了,要刷新的时候双击启动器
还有就是直接F5就能刷新了
48
可以使用linux的Adobe Reader工具,我也和大家一样,在论坛里得到了很多解决方法,有用获得xpf chinese-simpled的,也有poppler-data包的,安装这个可以用evince打开,中文也可以正常显示。最后我觉得还是推荐大家下载使用Adobe公司的Reader工具,毕竟pdf格式是Adobe公司所传作。
本人学习中总结了pdf中文显示乱码的解决方法,和大家相互促进学习:
1. xpdf中文乱码问题:
在ubuntu下查看pdf文档的工具一般有Evince和xpdf,系统默认安装的是
Evince,由于xpdf阅读快捷键的方便,一般选用xpdf来查看。上面提到的这两款
软件对于中文的支持都不好,很多中文文档打开就是乱码,我们可以根据下面提
供的办法加以解决。首先下载popplerdata0.1
压缩包。然后将当前路径改为改为解
压文件夹之后所在的路径,执行下面命令:
sudo make install datadir=/usr/share
2. 安装xpdf下面简体中文插件:sudo aptget
install xpdfchinesesimplied
3. 下载安装Linux下的Adobe Reader中文版工具,网址如下所示:
http://www.adobe.com/cn/products/acrobat/readstep2_allversions.html
49
opera 9.50b2 用scim也有键盘问题

sudo apt-get install scim-bridge-client-qt
之后
im-switch -s scim-bridge

问题解决
52

I don’t know if this happens to everyone often, but I usually screw up the Synaptic Package Manager in my computer very often. Most often, there errors are due to some stupid packages that don’t get installed properly or have some compatibility issues with other installed packages.

The most grave error is this:

sahasranaman@sahasranaman-desktop:~$ sudo apt-get install flock
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package awcommon needs to be reinstalled, but I can’t find an archive for it.

When apt-get or Synaptic Package Manager gives this error, I would always have to reinstall Ubuntu because there is no direct way to correct this. A few days ago, I came across this hack to correct all package related errors in Synaptic Package Manager.

There is a file in Debian based Operating Systems called /var/lib/dpkg/status that stores a list of all installed packages. It is a text file in Human-Readable format. All you have to do is to remove the entry of the software package that is causing trouble from the list. Here’s a step by step procedure that can help you solve the problem:

  • Press Alt + F2 to open the “Run Command” dialog box.
  • In the Run Command dialog box, type gksu gedit /var/lib/dpkg/status and hit Enter.
  • Type your password when asked. This step opens the package list in a text editor.
  • In the text editor, look for the package that is causing the trouble. Press Ctrl + F to find the package that you want to remove
  • Once you find the entry of that particular package, remove it completely.

For example, if I want to remove a package called finger, I start removing from the line

Package: finger

and remove all lines upto the start of the next Package entry.

I’m not sure if this is the best way to solve such problems, because what we actually do here is remove the entry from the list of packages installed without actually uninstalling it, but it does the trick anyway.

53
现在如果不打补丁,只有pure-ftpd支持服务器端设定编码,而我们现在的系统多半都是UTF-8编码,但windows 的ie会自动当作gbk来看,而且还不支持编码转换(#%¥……#%¥#,还是lftp好,功能齐全)。所以,如果你的服务器要被ie用户访问,那么只有用pure-ftpd才不会乱码。

安装方法。

apt-get install pure-ftpd

执行以下命令

sed -i -e 's/yes/no/g' /etc/pure-ftpd/conf/NoAnonymous
cat > /etc/pure-ftpd/conf/FileSystemCharset <
UTF-8
EOF
groupadd ftpgroup
useradd ftp -g ftpgroup -d /home/ftp -s /etc //这里把你的ftp的目录设好 ,用户名注意要是ftp。
pure-pw useradd pan -u ftp -d /home/ftp/pan //用系统中的ftp用户登录,虚拟用户名为pan,pan的主目录在/home/ftp/pan

这样,一个在linux和windows客户端都不会乱码的ftp服务器就建好了。可以直接
/etc/init.d/pure-ftpd start
开始使用。匿名用户开启。也有非匿名用户pan。
更多具体内容请自助man。
54

The CGI protocol is wonderful for the remote execution of short tasks. But how do you execute a longer task? A task can’t just run without giving some kind of feedback to the user — eventually either the user will get bored or Apache will drop the connection.

I’ve seen (and written) some solutions that depend on “server push”, but not all browsers support that feature. Other solutions I’ve seen slowly write simple HTML and rely on the browser to incrementally render a page to reflect activity. Again, you can’t count on that behavior across the browser spectrum.

But one solution that minimizes server overhead and dependence on browser peculiarities is client pull, also called “meta refresh”. In client pull, the initial request forks a process to perform the real work and redirects the browser to a new URL that “pulls” the results obtained so far. While the results remain incomplete, an additional header instructs the browser to “refresh” the data after a predetermined number of seconds.

All that sounds messy. For example, how will each CGI invocation know what data to display? Where will this data be? And, how will requests manage inter-process communication? Believe it or not, the solutions are not as daunting as they might seem.

First, each CGI request will be assigned a unique “session key” that’s hard to guess, but easy to hand around. This session key provides all the differentiation we need. In my sample code, I’m using the MD5 hash of unpredictable data.

Next, I could use temporary files to store session data, but that requires some sort of cleaner to zap stale files. An easier solution is to use the Cache::Cache from the CPAN — a Perl module I’ve sung praises about in the past.

So, the basic strategy is this: the browser hits the form and the user fills out that form; the browser submits the form; after verifying good information, the response forks to run the task and redirect the browser back with a session key; the forked process runs the task, collects output as it arrives, updates a cache, and sets a flag when the task is complete; the CGI script pulls data from the cache and displays it, sending a refresh as long as the data is not complete.

For purposes of demonstration, we’ll use traceroute, a typical system administration task. Obviously, traceroute consumes system and network resources, so you shouldn’t set this up in a public place exactly as I’ve written it (as shown in Listing One) unless you want angry glares from your network neighbors.




Listing One: tracerouter-cgi.pl - Part 1

 1   #!/usr/bin/perl -T
2 use strict;
3 $|++;
4
5 $ENV{PATH} = “/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin”;
6
7 use CGI qw(:all delete_all escapeHTML);
8
9 if (my $session = param(’session’)) {
10 my $cache = get_cache_handle();
11 my $data = $cache->get($session);
12 unless ($data and ref $data eq “ARRAY”) {
13 show_form();
14 exit 0;
15 }
16 print header;
17 print start_html(-title => “Traceroute Results”,
18 ($data->[0] ? () : (-head =>
19 [”<meta http-equiv=refresh content=5>”])));
20 print h1(”Traceroute Results”);
21 print pre(escapeHTML($data->[1]));
22 print p(i(”… continuing …”)) unless $data->[0];
23 print end_html;
24 } elsif (my $host = param(’host’)) {
25 if ($host =~ /^([a-zA-Z0-9.-]{1,100})z/) {
26 $host = $1;
27 my $session = get_session_id();
28 my $cache = get_cache_handle();
29 $cache->set($session, [0, “”]);
30
31 if (my $pid = fork) {
32 delete_all();
33 param(’session’, $session);
34 print redirect(self_url());
35 } elsif (defined $pid) {
36 close STDOUT;
37 unless (open F, “-|”) {
38 open STDERR, “>&=1″;
39 exec “/usr/sbin/traceroute”, $host;
40 die “Cannot execute traceroute: $!”;
41 }
42 my $buf = “”;
43 while (<F>) {
44 $buf .= $_;
45 $cache->set($session, [0, $buf]);
46 }
47 $cache->set($session, [1, $buf]);
48 exit 0;
49 } else {
50 die “Cannot fork: $!”;
51 }
52 } else {
53 show_form();
54 }
55 } else {
56 show_form();
57 }
58
59 exit 0;
60
61 sub show_form {
62 print header, start_html(”Traceroute”), h1(”Traceroute”);
63 print start_form;
64 print submit(’traceroute to this host:’), ” “, textfield(’host’);
65 print end_form, end_html;
66 }
67
68 sub get_cache_handle {
69 require Cache::FileCache;
70
71 Cache::FileCache->new
72 ({
73 namespace => ‘tracerouter’,
74 username => ‘nobody’,
75 default_expires_in => ‘30 minutes’,
76 auto_purge_interval => ‘4 hours’,
77 });
78 }
79
80 sub get_session_id {
81 require Digest::MD5;
82
83 Digest::MD5::md5_hex(Digest::MD5::md5_hex(time().{}.rand().$$));
84}

Lines 1 through 3 begin nearly every CGI program I write: enable taint checking, set compiler restrictions, and disable the buffering of standard output.

Line 5 sets the shell execution path. Because we’re tainted, any use of a child command will be forbidden unless the PATH itself is also untainted — the simplest way to do that is to set PATH directly.

Line 7 pulls in the CGI shortcuts, including a couple of unusual entries that don’t get pulled in with :all (for reasons I can’t fathom).

Lines 9 to 57 form the three-way switch that determines what the CGI program does for a particular invocation. Since the code segments are listed in the reverse order of their normal invocation sequence, I’ll start at the bottom and work backwards.

Line 56 shows a Web form that accepts a single parameter, the host to which we are traceroute-ing. This comes from a subroutine defined in lines 61 to 66. Simply put, we print the HTTP (actually CGI) header, the beginning of the HTML document (titling the page as Traceroute), and then a first-level head also titled Traceroute. The form comes next (with an action that defaults to the same script again) along with a single submit button and a text field. The fieldname is host, which we note for the next part of the description. Then the form is closed and the HTML is completed. This is your standard trivial form.

When the user submits this form, we come back to the same script and end up in the code starting in line 24. Here’s where it gets interesting.

First lines 25 and 26 validate the input parameter and untaint it by extracting the host name from it via a narrowly defined regex. Note that I limit the size of the hostname to 100 characters (to prevent a denial-of-service or buffer-overflow attack) and the range of characters to prevent other messiness. Be very conservative when accepting web form parameters. If the validation fails, we redisplay the form in line 53.

Line 27 fetches a unique session ID. The session ID is 32 hex characters and reasonably hard to predict. The subroutine in lines 80 through 84 pull in the Digest::MD5 module (found in the CPAN) to take some random and unpredictable data to generate such a hash. I stole the routine from Apache:: Session; if it’s good enough for them, it’s good enough for me.

Line 28 gets a Cache::Cache object to hold the information for the interprocess communication. The subroutine beginning on line 68 defines this object: we’ll cache in the filespace, naming the application tracerouter. The data will be good for 30 minutes before purging, and a purging run will be executed automatically on the first hit after four hours have passed.

Line 29 puts the initial data into the cache. The cache is always a two element arrayref. The first element is a flag that’s true if the output is complete, false if it isn’t. The second element is the data so far.

And now the fun part. We’re going to fork on line 31. This permits the parent process to tell Apache that we’re done responding to the request, while letting the child go off to perform the long traceroute. If we’re the parent, we need to construct a URL that points back to us, but with the session ID as a CGI parameter. So, we clear all the stored CGI parameters (line 32), set the session ID (line 33), and then print a CGI-redirect of “ourself” (as modified), which becomes an external redirect to the browser (line 34), and we’re done.

The child goes on, but it must first close STDOUT. If it doesn’t, Apache (thinking that output might still be coming for the browser) won’t respond to the browser or release the connection until this is all resolved. Next, we have to launch a child process of the child to execute the traceroute.

We’ll do this with a pipe-open, which includes an implicit fork, on line 37. The grandchild process merges STDERR to STDOUT, and then executes traceroute, passing it the validated host parameter from before. If line 40 is executed, we die and emit a single line of output as our response.

The child (the parent of the traceroute) reads from the file handle opened from the STDOUT (and STDERR) of the traceroute starting in line 42. We declare a buffer ($buf), and as each line is read (line 43), the line is added to the buffer (line 44) and shoved into the cache storage (line 45). When the command is complete, we get end-of-file, drop out of the loop, store the entire buffer again with an “I’m done” flag (line 47), and exit (line 48).

In short, the child process scurries off to execute the command. The parent tells the server to tell the browser to “please revisit me with this session key”. So, the browser comes back on its own volition and ends up starting in line 9 for the third and final part of this program.

Line 10 gets the cache handle, opening the same cache to which the forked child is writing. Line 11 gets the cache data for that session key. Now if the data is missing, either the data has expired or someone is trying to jimmy up a session key to hijack someone else’s session. In either case, we show the form (again) and stop.

Line 16 generates the CGI header. Lines 17 to 19 follow that with the HTML header. If the “data complete” flag is not set, then we need to keep going after this display, so we’ll add a meta-refresh tag to the head info. This instructs the browser to poll the same URL in a number of seconds (here 5 seconds).

Lines 20-23 dump the data that we have so far. If the data is incomplete, an italicized “continuing” paragraph is appended, to let the user know that we’re still working on the answer. And that’s it! That’s a basic strategy to watch a long-running CGI program.

Note that the child process has no awareness if the parent is finally disinterested and could continue merrily chugging away to produce a result that no one will see. Perhaps that can be fixed in another revision. But until next time, enjoy!



Randal L. Schwartz is the chief Perl guru at Stonehenge Consulting and can be reached at merlyn@stonehenge.com. Code listings for this column can be found at http://www.stonehenge.com/merlyn/LinuxMag/.
55

Windows and Linux only: Free bootable image creator UNetbootin automates the downloading, imaging, and installing of Linux distributions onto USB thumb drives, creating a persistent, boot-anywhere desktop. We've previously featured rather involved guides to putting Linux on a flash drive, but UNetbootin does it all for you, from downloading the right ISO to setting up a USB stick as a bootable Linux drive. It can also convert almost any bootable ISO, so if you've got an old, smaller thumb drive not seeing much use these days, you can use UNetbootin to install a partition editor, a file-recovering live CD, or the Windows password-cracking Ophcrack. UNetbootin is a free download for Windows XP and higher and Linux systems.

56
If your memory or mistyping leaves you without the right password to get into an account on a Linux computer, there's no need to reformat. Make Magazine's Hacks Blog gives a step-by-step account of the command line fix you can make by booting into "single user mode." The fix is written from an Ubuntu perspective, but applies to most any Linux system that boots with the GRUB manager. It's also a reminder that even a password-protected Linux box isn't truly protected from the curious, so consider encrypting your data or taking other measures. Photo by Carl Johan.
57
关于locale的设定,为什么要设定locale
关于locale的设定

locale是国际化与本土化过程中的一个非常重要的概念,个人认为,对于中文用户来说,通常会涉及到的国际化或者本土化,大致包含三个方面:看中文,写中文,与window中文系统的兼容和通信。从实际经验上看来,locale的设定与看中文关系不大,但是与写中文,及window分区的挂载方式有很密切的关系。本人认为就像一个纯英文的Windows能够浏览中文,日文或者意大利文网页一样,你不需要设定locale就可以看中文。那么,为什么要设定 locale呢?什么时候会用到locale呢?

Tags: locale 设定 原因 解释

一、为什么要设定locale
正如前面我所讲的,设定locale与你能否浏览中文的网页没有直接的关系,即便你把locale设置成en_US.ISO-8859-1这样一个标准的英文locale你照样可以浏览中文的网页,只要你的系统里面有相应的字符集(这个都不一定需要)和合适的字体(如simsun),浏览器就可以把网页翻译成中文给你看。具体的过程是网络把网页传送到你的机器上之后,浏览器会判断相应的编码的字符集,根据网页采用的字符集,去字体库里面找合适的字体,然后由文字渲染工具把相应的文字在屏幕上显示出来。

在下文本人会偶尔把字符集比喻成密码本,个人觉得对于一些东西比较容易理解,假如你不习惯的话,把全文copy到任何文本编辑器,用字符集替换密码本即可。

那有时候网页显示乱码或者都是方框是怎么回事呢?个人认为,显示乱码是因为设定的字符集不对(或者没有相应的字符集),例如网页是用UTF-8编码的,你非要用GB2312去看,而系统根据GB2312去找字体,然后在屏幕上显示,当然是一堆的乱码,也就是说你用一个错误的密码本去翻译发给你的电报,当然内容那叫一个乱;至于有些时候浏览的网页能显示一部分汉字,但有很多的地方是方框,能够显示汉字说明浏览器已经正确的判断出了网页的编码,并在字体库里面找到了相应的文字,但是并不是每个字体库都包含某个字符集全部的字体的缘故,有些时候会显示不完全,找一个比较全的支持较多字符集的字体就可以了。


既然我能够浏览中文网页,那为什么我还要设定locale呢?

其实你有没有想过这么一个问题,为什么gentoo官方论坛上中文论坛的网页是用UTF-8编码的(虽然大家一直强烈建议用GB2312编码),但是新浪网就是用GB2312编码的呢?而Xorg的官方网页竟然是ISO-8859-15编码的,我没有设定这个locale怎么一样的能浏览呢?这个问题就像是你有所有的密码本,不论某个网站是用什么字符集编码的,你都可以用你手里的密码本把他们翻译过来,但问题是虽然你能浏览中文网页,但是在整个操作系统里面流动的还是英文字符。所以,就像你能听懂英语,也能听懂中文。
最根本的问题是:你不可以写中文。

当你决定要写什么东西的时候,首先要决定的一件事情是用那种语言,对于计算机来说就是你要是用哪一种字符集,你就必须告诉你的linux系统,你想用那一本密码本去写你想要写的东西。知道为什么需要用GB2312字符集去浏览新浪了吧,因为新浪的网页是用GB2312写的。

为了让你的Linux能够输入中文,就需要把系统的locale设定成中文的(严格说来是locale中的语言类别LC_CTYPE ),例如zh_CN.GB2312、zh_CN.GB18030或者zh_CN.UTF-8。很多人都不明白这些古里古怪的表达方式。这个外星表达式规定了什么东西呢?这个问题稍后详述,现在只需要知道,这是locale的表达方式就可以了。

二、到底什么是locale?
locale这个单词中文翻译成地区或者地域,其实这个单词包含的意义要宽泛很多。Locale是根据计算机用户所使用的语言,所在国家或者地区,以及当地的文化传统所定义的一个软件运行时的语言环境。

这个用户环境可以按照所涉及到的文化传统的各个方面分成几个大类,通常包括用户所使用的语言符号及其分类(LC_CTYPE),数字 (LC_NUMERIC),比较和排序习惯(LC_COLLATE),时间显示格式(LC_TIME),货币单位(LC_MONETARY),信息主要是提示信息,错误信息, 状态信息, 标题, 标签, 按钮和菜单等(LC_MESSAGES),姓名书写方式(LC_NAME),地址书写方式(LC_ADDRESS),电话号码书写方式 (LC_TELEPHONE),度量衡表达方式(LC_MEASUREMENT),默认纸张尺寸大小(LC_PAPER)和locale对自身包含信息的概述(LC_IDENTIFICATION)。

所以说,locale就是某一个地域内的人们的语言习惯和文化传统和生活习惯。一个地区的locale就是根据这几大类的习惯定义的,这些 locale定义文件放在/usr/share/i18n/locales目录下面,例如en_US, zh_CN and de_DE@euro都是locale的定义文件,这些文件都是用文本格式书写的,你可以用写字板打开,看看里边的内容,当然出了有限的注释以外,大部分东西可能你都看不懂,因为是用的Unicode的字符索引方式。

对于de_DE@euro的一点说明,@后边是修正项,也就是说你可以看到两个德国的locale:
/usr/share/i18n/locales/de_DE@euro
/usr/share/i18n/locales/de_DE
打开这两个locale定义,你就会知道它们的差别在于de_DE@euro使用的是欧洲的排序、比较和缩进习惯,而de_DE用的是德国的标准习惯。

上面我们说到了zh_CN.GB18030的前半部分,后半部分是什么呢?大部分Linux用户都知道是系统采用的字符集。

三、什么是字符集?
字符集就是字符,尤其是非英语字符在系统内的编码方式,也就是通常所说的内码,所有的字符集都放在 /usr/share/i18n/charmaps,所有的字符集也都是用Unicode编号索引的。Unicode用统一的编号来索引目前已知的全部的符号。而字符集则是这些符号的编码方式,或者说是在网络传输,计算机内部通信的时候,对于不同字符的表达方式,Unicode是一个静态的概念,字符集是一个动态的概念,是每一个字符传递或传输的具体形式。就像Unicode编号U59D0是代表姐姐的“姐”字,但是具体的这个字是用两个字节表示,三个字节,还是四个字节表示,是字符集的问题。例如:UTF-8字符集就是目前流行的对字符的编码方式,UTF-8用一个字节表示常用的拉丁字母,用两个字节表示常用的符号,包括常用的中文字符,用三个表示不常用的字符,用四个字节表示其他的古灵精怪的字符。而GB2312字符集就是用两个字节表示所有的字符。需要提到一点的是Unicode除了用编号索引全部字符以外,本身是用四个字节存储全部字符,这一点在谈到挂载windows分区的时候是非常重要的一个概念。所以说你也可以把Unicode看作是一种字符集(我不知道它和UTF-32的关系,反正UTF-32就是用四个字节表示所有的字符的),但是这样表述符号是非常浪费资源的,因为在计算机世界绝大部分时候用到的是一个字节就可以搞定的26个字母而已。所以才会有UTF-8,UTF-16等等,要不然大同世界多好,省了这许多麻烦。


四、zh_CN.GB2312到底是在说什么?
Locale 是软件在运行时的语言环境, 它包括语言(Language), 地域 (Territory) 和字符集(Codeset)。一个locale的书写格式为: 语言[_地域[.字符集]]. 所以说呢,locale总是和一定的字符集相联系的。下面举几个例子:

1、我说中文,身处中华人民共和国,使用国标2312字符集来表达字符。
zh_CN.GB2312=中文_中华人民共和国+国标2312字符集。

2、我说中文,身处中华人民共和国,使用国标18030字符集来表达字符。
zh_CN.GB18030=中文_中华人民共和国+国标18030字符集。

3、我说中文,身处中华人民共和国台湾省,使用国标Big5字符集来表达字符。
zh_TW.BIG5=中文_台湾.大五码字符集

4、我说英文,身处大不列颠,使用ISO-8859-1字符集来表达字符。
en_GB.ISO-8859-1=英文_大不列颠.ISO-8859-1字符集

5、我说德语,身处德国,使用UTF-8字符集,习惯了欧洲风格。
de_DE.UTF-8@euro=德语_德国.UTF-8字符集@按照欧洲习惯加以修正

注意不是de_DE@euro.UTF-8,所以完全的locale表达方式是
[语言[_地域][.字符集] [@修正值]

生成的locale放在/usr/lib/locale/目录中,并且每个locale都对应一个文件夹,也就是说创建了 de_DE@euro.UTF-8 locale之后,就生成/usr/lib/locale/de_DE@euro.UTF-8/目录,里面是具体的每个locale的内容。

五、怎样去自定义locale
在gentoo生成locale还是很容易的,首先要在USE里面加入userlocales支持,然后编辑locales.build文件,这个文件用来指示glibc生成locale文件。
很多人不明白每一个条目是什么意思。 其实根据上面的说明现在应该很明确了。

File: /etc/locales.build
en_US/ISO-8859-1
en_US.UTF-8/UTF-8

zh_CN/GB18030
zh_CN.GBK/GBK
zh_CN.GB2312/GB2312
zh_CN.UTF-8/UTF-8

上面是我的locales.build文件,依次的说明是这样的:

en_US/ISO-8859-1:生成名为en_US的locale,采用ISO-8859-1字符集,并且把这个locale作为英文_美国locale类的默认值,其实它和en_US.ISO-8859-1/ISO-8859-1没有任何区别。

en_US.UTF-8/UTF-8:生成名为en_US.UTF-8的locale,采用UTF-8字符集。

zh_CN/GB18030:生成名为zh_CN的locale,采用GB18030字符集,并且把这个locale作为中文_中国locale类的默认值,其实它和zh_CN.GB18030/GB18030没有任何区别。

zh_CN.GBK/GBK:生成名为zh_CN.GBK的locale,采用GBK字符集。
zh_CN.GB2312/GB2312:生成名为zh_CN.GB2312的locale,采用GB2312字符集。
zh_CN.UTF-8/UTF-8:生成名为zh_CN.UTF-8的locale,采用UTF-8字符集。

关于默认locale,默认locale可以简写成en_US或者zh_CN的形式,只是为了表达简单而已没有特别的意义。

Gentoo在locale定义的时候掩盖了一些东西,也就是locale的生成工具:localedef。
在编译完glibc之后你可以用这个localedef 再补充一些locale,就会更加理解locale了。具体的可以看 localedef 的manpage。

$localedef -f 字符集 -i locale定义文件 生成的locale的名称
例如
$localedef -f UTF-8 -i zh_CN zh_CN.UTF-8

上面的定义方法和在locales.build中设定zh_CN.UTF-8/UTF-8的结果是一样一样的。


六、locale的五脏六腑

刚刚生成了几个locale,但是为了让它们生效,必须告诉Linux系统使用那(几)个locale。这就需要对locale的内部机制有一点点的了解。在前面我已经提到过,locale把按照所涉及到的文化传统的各个方面分成12个大类,这12个大类分别是:
1、语言符号及其分类(LC_CTYPE)
2、数字(LC_NUMERIC)
3、比较和排序习惯(LC_COLLATE)
4、时间显示格式(LC_TIME)
5、货币单位(LC_MONETARY)
6、信息主要是提示信息,错误信息, 状态信息, 标题, 标签, 按钮和菜单等(LC_MESSAGES)
7、姓名书写方式(LC_NAME)
8、地址书写方式(LC_ADDRESS)
9、电话号码书写方式(LC_TELEPHONE)
10、度量衡表达方式(LC_MEASUREMENT)
11、默认纸张尺寸大小(LC_PAPER)
12、对locale自身包含信息的概述(LC_IDENTIFICATION)。

其中,与中文输入关系最密切的就是 LC_CTYPE, LC_CTYPE 规定了系统内有效的字符以及这些字符的分类,诸如什么是大写字母,小写字母,大小写转换,标点符号、可打印字符和其他的字符属性等方面。而locale定义zh_CN中最最重要的一项就是定义了汉字(Class “hanzi”)这一个大类,当然也是用Unicode描述的,这就让中文字符在Linux系统中成为合法的有效字符,而且不论它们是用什么字符集编码的。

LC_CTYPE
% This is a copy of the "i18n" LC_CTYPE with the following modifications: - Additional classes: hanzi

copy "i18n"

class "hanzi"; /
% ..;/
..;/
;;;;;;;;/
;;;;;;;;/
;;;;
END LC_CTYPE

在en_US的locale定义中,并没有定义汉字,所以汉字不是有效字符。所以如果要输入中文必须使用支持中文的locale,也就是zh_XX,如zh_CN,zh_TW,zh_HK等等。

另外非常重要的一点就是这些分类是彼此独立的,也就是说LC_CTYPE,LC_COLLATE和 LC_MESSAGES等等分类彼此之间是独立的,可以根据用户的需要设定成不同的值。这一点对很多用户是有利的,甚至是必须的。例如,我就需要一个能够输入中文的英文环境,所以我可以把LC_CTYPE设定成zh_CN.GB18030,而其他所有的项都是en_US.UTF-8。


七、怎样设定locale呢?

设定locale就是设定12大类的locale分类属性,即 12个LC_*。除了这12个变量可以设定以外,为了简便起见,还有两个变量:LC_ALL和LANG。它们之间有一个优先级的关系:
LC_ALL>LC_*>LANG
可以这么说,LC_ALL是最上级设定或者强制设定,而LANG是默认设定值。
1、如果你设定了LC_ALL=zh_CN.UTF-8,那么不管LC_*和LANG设定成什么值,它们都会被强制服从LC_ALL的设定,成为 zh_CN.UTF-8。
2、假如你设定了LANG=zh_CN.UTF-8,而其他的LC_*=en_US.UTF-8,并且没有设定LC_ALL的话,那么系统的locale设定以LC_*=en_US.UTF-8。
3、假如你设定了LANG=zh_CN.UTF-8,而其他的LC_*,和LC_ALL均未设定的话,系统会将LC_*设定成默认值,也就是LANG的值 zh_CN.UTF-8 。
4、假如你设定了LANG=zh_CN.UTF-8,而其他的LC_CTYPE=en_US.UTF-8,其他的LC_*,和LC_ALL均未设定的话,那么系统的locale设定将是:LC_CTYPE=en_US.UTF-8,其余的 LC_COLLATE,LC_MESSAGES等等均会采用默认值,也就是LANG的值,也就是LC_COLLATE=LC_MESSAGES=……= LC_PAPER=LANG=zh_CN.UTF-8。

所以,locale是这样设定的:
1、如果你需要一个纯中文的系统的话,设定LC_ALL= zh_CN.XXXX,或者LANG= zh_CN.XXXX都可以,当然你可以两个都设定,但正如上面所讲,LC_ALL的值将覆盖所有其他的locale设定,不要作无用功。
2、如果你只想要一个可以输入中文的环境,而保持菜单、标题,系统信息等等为英文界面,那么只需要设定LC_CTYPE=zh_CN.XXXX, LANG=en_US.XXXX就可以了。这样LC_CTYPE=zh_CN.XXXX,而LC_COLLATE=LC_MESSAGES=……= LC_PAPER=LANG=en_US.XXXX。
3、假如你高兴的话,可以把12个LC_*一一设定成你需要的值,打造一个古灵精怪的系统:
LC_CTYPE=zh_CN.GBK/GBK(使用中文编码内码GBK字符集);
LC_NUMERIC=en_GB.ISO-8859-1(使用大不列颠的数字系统)
LC_MEASUREMEN=de_DE@euro.ISO-8859-15(德国的度量衡使用ISO-8859-15字符集)
罗马的地址书写方式,美国的纸张设定……。估计没人这么干吧。
4、假如你什么也不做的话,也就是LC_ALL,LANG和LC_*均不指定特定值的话,系统将采用POSIX作为lcoale,也就是C locale。
58
但是,Ubuntu对USB键盘的支持不佳,所以最好用PS/2键盘。

此外,Ubuntu认识的显示器型号不多,往往识别为Plug 'n' Play(即插即用)。如果显示参数不能自动正确设置,而且你有显示器驱动光盘,可以添加你的显示器型号:

应用程序——>其他——>显示器和显卡设置——>显示屏型号:——>添加——>显示器驱动光盘上的相应INF文件

61
想像一下你正在阅读一个 Ubuntu 的软件列表,其中一个软件吸引了你的眼球,使得你特想尝试一下它。而安装它时我们不需要打开 添加/删除... ,不需要打开新立得,也不用打开终端,而只需简单点一下链接...

如果你正在使用 ubuntu 下的 firefox 浏览器访问本页,不妨点击以下链接进行尝试

跨平台的开源浏览器 firefox
mplayer 的流行前端 SMPlayer
轻便的 email 客户端 sylpheed
计算机代数系统 Maxiam
国产办公套件永中 Office
轻便的文本编辑器 leafpad
台湾同胞编写的 bbs 工具 pcmanx
大陆同胞编写的 bbs 工具 qterm

注:

1. 所有通过 apturl 安装的软件都源自使用者系统中设置的软件仓库,因此不用担心安全问题

2. opera 浏览器用户,需先进行如下设置:
打开首选项,高级,程序,添加,协议填 apt ,程序填 /usr/bin/apturl 即可

3.Konqueror 浏览器用户,请参考以下地址

http://wiki.ubuntu.org.cn/Apturl

如果大家喜欢这个功能的话,下一步我们会在wiki 中的 软件推荐 中提供一键安装功能
62

/ ;linux系统的根目录,是系统的最顶层。
/bin ;里面是系统最基本的二进制命令文件如ls cp rm ln等等。
/sbin ;s就是super的意思,里面都是超级用户用于管理系统的命令,如mkfs.ext3 等。
/boot ;里面是开机程序,lilo或grub,还有linux 内核文件vmlinuz ,初始化系统的initrd.img文件。
/dev ; 就是device的意思,代表计算机的所有硬件设备。如IDE盘:/dev/hdx ;串口:/dev/ttyx.;scsi盘用sdx表示。注意,一般情况下usb盘,s-ata硬盘也模拟成scsi来驱动。
/lib ; 系统核心的动态模块和连接库文件,各种可动态加载的硬件驱动程序。nvidia的驱动程序就是安装在这里面。
/etc ;里面绝大部分都是文本文件,用于设置系统的,作用相当于windows的注册表。注意,其中有一个/etc/shadow文件里面保存着用户的登录密码。
/root 超级用户的工作目录。
/mnt ;外接文件系统的挂载点,u盘、cdrom、windows分区都应挂到这里面。
/proc ;里面的文件不再硬盘上,而是在内存里,都是系统内核的运行信息。
/var ;包含在正常操作中被改变的文件:假脱机文件、记录文件、加锁文件、临时文件和页格式化文件等。 默认情况下,http,ftp等服务的主文件夹也在这里面。
/tmp ;各用户程序产生的临时文件的存放场所,临时文件会被自动清除掉。
/home;一般用户的主文件夹所在的地方。
/usr;规模非常庞大的文件夹,里面是各个应用程序的文件,相当于windows的 program files 文件夹。/usr下有几个重要的子文件夹。
/usr/bin ;应用程序的可执行文件部分。相当于windows的*.exe文件。
/usr/lib;应用程序的共享动态连接库部分,都是一些*.so的文件,linux下各个应用程序的库文件都是可共享的。所以都存放在一个文件夹中。
/usr/X11R6;xwindow 系统的所属文件。
/usr/share;存放的是应用程序需要的字体、图片、文档等资源文件。
/usr/src; linux的源代码就放在这里。
/usr/games;游戏软件的存放区域,可惜现在linux大游戏还不太多。
/usr/include;Linux下开发和编译应用程序需要的头文件,爱好编程的朋友可要仔细研究这里呦。
/opt ; 非开源的商业程序一般都装到这里面。
63
第一次发帖,很多东西都不懂!!见谅。

如何从源码包安装软件? http://lfs.linuxsir.org/main/?q=node/38

作者:6692975 来自:LinuxSir.Org

提要:

如何从源码包安装软件?编译的一点体会,希望对新手有点用 Smile

从源码包安装软件最重要的就是仔细阅读README INSTALL等说明文件,它会告诉你怎样才能成功安装。

通常从源码包安装软件的步骤是:
tar jxvf gtk+-2.4.13.tar.bz2 解开源码包
cd gtk+-2.4.13/ 进入源码目录
./configure 似乎在某些环境下./configure会造成终端退出
而使用. configure则会正常运行,如果有这个现象,就试试 . configure

通过configure程序猜测主机信息,最终建立Makefile,以完成make,所以如果./configure不成功
而去make的话,就会出现"make: *** No targets specified and no makefile found. Stop."
make 当./configure成功结束后,就开始正式编译程序了.
make install 编译成功后使用make install安装
make uninstall 某些软件支持卸载,可能使用该方法卸载,如果支持的话,通常会在README中写到(似乎比较少)

configure程序带有很多参数,可以通过 ./configure --help 查看详细内容,通常位于前面的是常规configure的
参数说明,末尾是该程序的可用参数说明。
./configure --prefix=/usr 指定安装目录,通常从源码包编译安装的软件默认会放在/usr/local下
因为这是FHS(Filesystem Hierarchy Standard)的规定,不知道什么是FHS?看看这篇文章吧:
http://www.pathname.com/fhs/pub/fhs-2.3.html 相信它会让你对linux系统结构有更好的理解,很值得读读。

再说一下几个关系到能否成功编译的东东:/etc/ld.so.conf ldconfig PKG_CONFIG_PATH

首先说下/etc/ld.so.conf:

这个文件记录了编译时使用的动态链接库的路径。
默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件
如果你安装了某些库,比如在安装gtk+-2.4.13时它会需要glib-2.0 >= 2.4.0,辛苦的安装好glib后
没有指定 --prefix=/usr 这样glib库就装到了/usr/local下,而又没有在/etc/ld.so.conf中添加/usr/local/lib
这个搜索路径,所以编译gtk+-2.4.13就会出错了
对于这种情况有两种方法解决:
一:在编译glib-2.4.x时,指定安装到/usr下,这样库文件就会放在/usr/lib中,gtk就不会找不到需要的库文件了
对于安装库文件来说,这是个好办法,这样也不用设置PKG_CONFIG_PATH了 (稍后说明)

二:将/usr/local/lib加入到/etc/ld.so.conf中,这样安装gtk时就会去搜索/usr/local/lib,同样可以找到需要的库
将/usr/local/lib加入到/etc/ld.so.conf也是必须的,这样以后安装东东到local下,就不会出现这样的问题了。
将自己可能存放库文件的路径都加入到/etc/ld.so.conf中是明智的选择 ^_^
添加方法也极其简单,将库文件的绝对路径直接写进去就OK了,一行一个。例如:
/usr/X11R6/lib
/usr/local/lib
/opt/lib

再来看看ldconfig是个什么东东吧 :

它是一个程序,通常它位于/sbin下,是root用户使用的东东。具体作用及用法可以man ldconfig查到
简单的说,它的作用就是将/etc/ld.so.conf列出的路径下的库文件 缓存到/etc/ld.so.cache 以供使用
因此当安装完一些库文件,(例如刚安装好glib),或者修改ld.so.conf增加新的库路径后,需要运行一下/sbin/ldconfig
使所有的库文件都被缓存到ld.so.cache中,如果没做,即使库文件明明就在/usr/lib下的,也是不会被使用的,结果
编译过程中抱错,缺少xxx库,去查看发现明明就在那放着,搞的想大骂computer蠢猪一个。 ^_^
我曾经编译KDE时就犯过这个错误,(它需要每编译好一个东东,都要运行一遍),所以

切记改动库文件后一定要运行一下ldconfig,在任何目录下运行都可以。

再来说说 PKG_CONFIG_PATH这个变量吧:

经常在论坛上看到有人问"为什么我已经安装了glib-2.4.x,但是编译gtk+-2.4.x 还是提示glib版本太低阿?
为什么我安装了glib-2.4.x,还是提示找不到阿?。。。。。。"都是这个变量搞的鬼。
先来看一个编译过程中出现的错误 (编译gtk+-2.4.13):

checking for pkg-config... /usr/bin/pkg-config
checking for glib-2.0 >= 2.4.0 atk >= 1.0.1 pango >= 1.4.0... Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found

configure: error: Library requirements (glib-2.0 >= 2.4.0 atk >= 1.0.1 pango >= 1.4.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
[root@NEWLFS gtk+-2.4.13]#
很明显,上面这段说明,没有找到glib-2.4.x,并且提示应该将glib-2.0.pc加入到PKG_CONFIG_PATH下。
究竟这个pkg-config PKG_CONFIG_PATH glib-2.0.pc 是做什么的呢? let me tell you ^_^
先说说它是哪冒出来的,当安装了pkgconfig-x.x.x这个包后,就多出了pkg-config,它就是需要PKG_CONFIG_PATH的东东
pkgconfig-x.x.x又是做什么的? 来看一段说明:

The pkgconfig package contains tools for passing the include path and/or library paths to build tools during the make file execution.

pkg-config is a function that returns meta information for the specified library.

The default setting for PKG_CONFIG_PATH is /usr/lib/pkgconfig because of the prefix we use to install pkgconfig. You may add to PKG_CONFIG_PATH by exporting additional paths on your system where pkgconfig files are installed. Note that PKG_CONFIG_PATH is only needed when compiling packages, not during run-time.

我想看过这段说明后,你已经大概了解了它是做什么的吧。
其实pkg-config就是向configure程序提供系统信息的程序,比如软件的版本啦,库的版本啦,库的路径啦,等等
这些信息只是在编译其间使用。你可以 ls /usr/lib/pkgconfig 下,会看到许多的*.pc,用文本编辑器打开
会发现类似下面的信息:

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums

Name: GLib
Description: C Utility Library
Version: 2.4.7
Libs: -L${libdir} -lglib-2.0
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include

明白了吧,configure就是靠这些信息判断你的软件版本是否符合要求。并且得到这些东东所在的位置,要不去哪里找呀。
不用我说你也知道为什么会出现上面那些问题了吧。

解决的办法很简单,设定正确的PKG_CONFIG_PATH,假如将glib-2.x.x装到了/usr/local/下,那么glib-2.0.pc就会在
/usr/local/lib/pkgconfig下,将这个路径添加到PKG_CONFIG_PATH下就可以啦。并且确保configure找到的是正确的
glib-2.0.pc,就是将其他的lib/pkgconfig目录glib-2.0.pc干掉就是啦。(如果有的话 ^-^)
设定好后可以加入到~/.bashrc中,例如:
PKG_CONFIG_PATH=/opt/kde-3.3.0/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/pkgconfig:
/usr/X11R6/lib/pkgconfig
[root@NEWLFS ~]#echo $PKG_CONFIG_PATH
/opt/kde-3.3.0/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/pkgconfig:/usr/X11R6/lib/pkgconfig

从上面可以看出,安装库文件时,指定安装到/usr,是很有好处的,无论是/etc/ld.so.conf还是PKG_CONFIG_PATH
默认都会去搜索/usr/lib的,可以省下许多麻烦,不过从源码包管理上来说,都装在/usr下
管理是个问题,不如装在/usr/local下方便管理
其实只要设置好ld.so.conf,PKG_CONFIG_PATH路径后,就OK啦 ^_^

另外某些软件因为版本原因(比如emacs-21.3),在gcc-3.4.x下编译无法成功,(make 出错)
使用低版本的gcc就可能编译通过。
可能是因为gcc-3.3.x和gcc-3.4.x变化很大的缘故吧。

暂时想到了这么多,先记下这些吧,如果你对源码包编译有了一点的了解,就不枉我打了这么半天字啦。 ^_^

另外./configure 通过,make 出错,遇到这样的问题比较难办,只能凭经验查找原因,比如某个头文件没有找到,
这时候要顺着出错的位置一行的一行往上找错,比如显示xxxx.h no such file or directory 说明缺少头文件
然后去google搜。
或者找到感觉有价值的错误信息,拿到google去搜,往往会找到解决的办法。还是开始的那句话,要仔细看README,INSTALL
程序如何安装,需要什么依赖文件,等等。

另外对于newbie来说,编译时,往往不知道是否成功编译通过,而编译没有通过就去make install
必然会出错,增加了解决问题的复杂性,可以通过下面方法检查是否编译成功:

一:编译完成后,输入echo $? 如果返回结果为0,则表示正常结束,否则就出错了
echo $? 表示 检查上一条命令的退出状态,程序正常退出 返回0,错误退出返回非0。
二:编译时,可以用&&连接命令, && 表示"当前一条命令正常结束,后面的命令才会执行",就是"与"啦。
这个办法很好,即节省时间,又可防止出错。例:
./configure --prefix=/usr && make && make install

编译DOSBOX时出现"cdrom.h:20:23: SDL_sound.h: No such file or directory"

今天忽然想回味下经典DOS游戏,于是编译这个DOSBOX模拟器,README中说明需要SDL_SOUND
于是下载,安装,很顺利,没有指定安装路径,于是默认的安装到了/usr/local/
当编译DOSBOX make 时,出现如下错误:
if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../include -I/usr/include/SDL -D_REENTRANT -march=pentium4 -O3 -pipe -fomit-frame-pointer -MT dos_programs.o -MD -MP -MF ".deps/dos_programs.Tpo" -c -o dos_programs.o dos_programs.cpp; \
then mv -f ".deps/dos_programs.Tpo" ".deps/dos_programs.Po"; else rm -f ".deps/dos_programs.Tpo"; exit 1; fi
In file included from dos_programs.cpp:30:
cdrom.h:20:23: SDL_sound.h: No such file or directory
66

The Annoying Delete in Linux

When it comes to backspace and delete, linux SUCKS! BIG TIME!

I read a lot of howto online, but I don't think it is helping that 
much. Either they are awfully complicated or either it just works on 
specific system. Because of my bad long term memory, I want to write 
this down, so that I know what to do when I deal with this shit again.

I only care how to get bash, nano, emacs to work, so I guess you need 
to go somewhere else if you want to know how to configure other 
applications.



For bash, you need to know how bash interpreted your keys. To see what
you typed, you do
Control V, then Key
Then you need to put the bindings in your .bashrc files
Nothing is more clear than an example
Say I press Control V, then backspace, it outputs ^H
and I press Control V, then del, it outputs ^?
do bind -p | grep delete may help too.
I put these lines in my .bashrc file

bind '"\C-h": backward-delete-char'
bind '"\C-?": delete-char'

For other weird symbol, such as control d and ^[[3~, you do
bind '"\C-d": delete-char'
bind '"\M-[3~": delete-char'

It will be great if things are so easy, but usually they don't.
You may find your keys are interpreted differently in xterm.
You need to have specific settings for different environment.
My .bashrc looks like this

# remote login with putty or ssh secure shell
# ^H is a backward delete
# ^? is a forward delete
if [ "$TERM" == "vt100" ]; then
bind '"\C-h": backward-delete-char'
bind '"\C-?": delete-char'

# bind '"\C-d": delete-char'
# bind '"\M-[3~": delete-char'
fi

# for xterm
$ TERM may not be rxvt in xterm, so do echo $TERM to check
# ^? is a backward delete
# M-[3~ is a forward delete

if [ "$TERM" == "rxvt" ]; then
bind '"\C-?": backward-delete-char'
bind '"\M-[3~": delete-char'

# bind '"\C-d": backward-delete-char'
# bind '"\C-h": backward-delete-char'
fi

Similar deal with emacs. You need to find out what emacs interpreted
what you pressed and you bind that with a function. Unfortunately,
emacs and emacs -nw don't interprete keys the same way. So you need
to have different settings for different environment.

To see what you type, you hit the key many many times, then do
M x view-lossage. You should be able to see what emacs type, for
both in xemacs mode and emacs -nw mode
Here is my .emacs file

;; use view lossage to see what keysym you are getting
(cond
;; for window system
(window-system
(global-set-key (kbd "<backspace>") 'backward-delete-char)
(define-key c-mode-map (kbd "<backspace>") 'backward-delete-char)

(global-set-key (kbd "<delete>") 'delete-char)
(define-key c-mode-map (kbd "<delete>") 'delete-char))


;; for -nw / tty mode
('T
(global-set-key "\C-d" 'backward-delete-char)
(define-key c-mode-map "\C-d" 'backward-delete-char)

(global-set-key "\C-h" 'backward-delete-char)
(define-key c-mode-map "\C-h" 'backward-delete-char)

(global-set-key (kbd "DEL") 'delete-char)
(define-key c-mode-map (kbd "DEL") 'delete-char)))




67
Apple has convinced millions that they can make the switch from Windows to OS X, but those curious about Linux have to see for themselves if they can work or play on a free desktop. The short answer is that, for most halfway tech-savvy people who aren't hardcore gamers, yes, you can. There are positively addictive productivity apps available for Linux, along with tools to make switching between Linux and other systems easy, or just running Windows programs themselves if you need to. Today we're detailing a Linux desktop that helps you move quickly, work with Windows, and just get things done; read on for a few suggestions on setting it up.
68
很多朋友使用emacs,但是emacs的起点比较高,没有经验的话,入门很难。

我这里给些比较好的链接,都是我初学的时候常看的资料:
GNU emacs的官方网站 http://www.gnus.org/software/emacs
王垠的主页http://docs.huihoo.com/homepage/shredderyin/--我学习emacs就是受他的影响
王纯业的主页http://ann77.stu.cdut.edu.cn/EmacsIndex.html--里面有几个很不错的扩展-比如中文日历
还有就是emacs的wiki主页http://www.emacswiki.org/cgi-bin/wiki--现在大部分的扩展都可以在这里找到
Emacs 中文化指南,有很多适合咱们中国人使用的技巧 http://zhdotemacs.sourceforge.net/emacs/
emacs.cn的wiki,也可以看看http://www.emacs.cn/Main/HomePage
再加一个emacs扩展的仓库http://www.damtp.cam.ac.uk/user/sje30/emacs/ell.html里面的东西很多哦

当然最权威的也就是emacs自带的manual手册了,如果你可以花点功夫读一读的话,会收获大增的。
69

Fedora也在谋杀你的硬盘?

  10月底看到注意!Ubuntu的Bug可能会减少笔记本硬盘寿命这篇新闻(原始相关讨论在这里),没有往心里去。但昨天看到Fedora的论坛上也在讨论这个问题,说Fedora也存在相同的问题,于是开始警觉起来。

  问题不是很复杂,就是使用命令:

sudo smartctl -a /dev/sda | grep Load_Cycle_Count

  重复执行这个命令看一下硬盘SMART功能中记录的Load/Unload次数,在Ubuntu或Fedora等Linux下,我们会发现这个值很快的增长,而一块硬盘可以承受的Load/Unload次数是比较有限的。我的Seagate ST980815A硬盘可以承受的次数是600000,而我现在从smartctl中读到的数字是115000,并且以一分钟2次左右的速度增长。这样算来,硬盘虽然不会立即就会结束它的寿命,但也算是折寿得够快的了。

  实际的情况,比这里描述的还要复杂一点,比如:在使用AC电源和电池的时候,行为不一定一样;不同厂家的SMART中记录的Load_Cycle_Count值的含义可能并不一样;为什么这个问题在Windows下不出现?是硬盘firmware还是主板BIOS还是操作系统的问题呢?

  可以参考的资料不少:

  http://ubuntuforums.org/showpost.php?p=3675960&postcount=26

  https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/59695

  https://www.redhat.com/archives/fedora-devel-list/2007-October/msg02260.html

  http://fedoraproject.org/wiki/FWN/Issue107#head-10d9e6175a2dbef23ed071339345ccc747588683

  看到头脑发涨,其实这个问题还是没有结论,倒底对硬盘的影响有多大也还是不得而知,但总结一下,最保守可行的做法就是修改硬盘的节电参数,尽量减少它做不必要的Load/Unload动作。方法是执行下面的命令:

sudo hdparm -B 254 /dev/sda

  这个命令把硬盘高级电源管理的参数改成254(默认一般是128),这样就可以大大减少硬盘做Load/Unload的动作。这样做的副作用是在使用电池供电时硬盘也不能及时的进入节电状态。

  通过写ACPI消息的响应脚本,可以让这个命令在系统开机、待机唤醒、休眠唤醒时都得到执行,可惜偶还没研究出来怎么在Fedora上写,还好我很少用待机和休眠,所以就直接把hdparm -B 254 /dev/sda这命令写在/etc/profile中的最后一行吧。现在开机以后硬盘的Load_Cycle_Count已经基本上不发生变化了。

70
有一些emacs的buffer是read-only buffer, 就会标成% %%表示档案是read-only. 
 
C-x C-q 可以解开read-only的锁定, 无论如何你要改这个编辑区. 这是个toggle指令, 如果原来是可以修改的, C-x C-q会把它切成 read-only. 
71

/boot分区,它包含了操作系统的内核和在启动系统过程中所要用到的文件,建这个分区是有必要的,因为目前大多数的PC机要受到BIOS的限制,况且如果有了一个单独的/boot启动分区,即使主要的根分区出现了问题,计算机依然能够启动。这个分区的大小约在60MB—120MB之间。

/usr分区,是 Linux系统存放软件的地方,如有可能应将最大空间分给它。

/home分区,是用户的home目录所在地,这个分区的大小取决于有多少用户。如果是多用户共同使用一台电脑的话,这个分区是完全有必要的,况且根用户也可以很好地控制普通用户使用计算机,如对用户或者用户组实行硬盘限量使用,限制普通用户访问哪些文件等。

/var/log分区,是系统日志记录分区,如果设立了这一单独的分区,这样即使系统的日志文件出现了问题,它们也不会影响到操作系统的主分区。

/tmp分区,用来存放临时文件。这对于多用户系统或者网络服务器来说是有必要的。这样即使程序运行时生成大量的临时文件,或者用户对系统进行了错误的操作,文件系统的其它部分仍然是安全的。因为文件系统的这一部分仍然还承受着读写操作,所以它通常会比其它的部分更快地发生问题。

/bin分区,存放标准系统实用程序。

上面介绍了几个常用的分区,但记住至少要有两个分区,一个SWAP分区,一个/分区。

72
将username替换成你的用户名
备份系统
su -s -H
cd /home/username/Desktop
tar cvpzf backup.tgz --exclude=/proc --exclude=/home/username/Desktop--exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

解释一下,exclude就是排除。这个tar命令将系统重要文件备份并放到Desktop下面。
还原系统
tar backup.tgz -C //home/username/Desktop
73
这里简单介绍下,几个重要的目录,这几个目录在ubuntu安装的硬盘分区时,可选择性的特别分区,进行挂载。

  /usr 文件系统中一般不改变的文件,如库,程序。
  /var 文件系统包含会改变的文件。
  /home 文件系统包含用户家目录,即系统上的所有实际数据。
  /tmp 临时文件。
  /usr/local 这是提供给一般用户的/usr目录,在这安装软件最适合。
  /srv 一些服务起动以后,需要的数据放在这里。
  /opt 一些大型程序,安装在这里,方便管理。
  / 根目录,没啥说的。

  在分区的时候也是有一定的机巧的,根据磁盘的特点,我们知道越是靠磁盘外部的柱面,旋转越快,而且每次旋转时,磁盘读写头可以覆盖较多的区域,也就意味着靠外部的柱面可以得到较好的性能。所以在分区时,我们应该考虑将访问频率高的,对系统性能影响相对较大的分区置于磁盘的靠外部分。
  
  一个建议的分区:
  / 和其他目录在一个分区,这些基本不做改变。总容量不会超过1G。建议为总容量减去下面三个容量之和。
  /home 建议在3-4G,完全看用户的文档和配置文件有多大。
  /var /tmp 单独分出一个分区,/var中存放所有apt-get的临时包,/tmp是临时文件,需要起码2G的容量。这是两个文件改变最频繁的目录,单独分出去,让他们自己乱。
  /usr /opt 是安装软件的地方,也是容易改变的目录,可以单独分出去8-10G。Linux无论装多少软件,都是不会影响到系统性能的。放心大胆地装吧。
75
I solved this problem and I get all sound out!!!

I found the solution occasionally.

It is that you must first select "external amplifier"(listed on the volume panel) and unselect it right away.

It make me feel very strange why have to do it but it does just work.
76
Problem: No sound.
Solution:


This for the sound card (Intel Corporation 82801H (ICH8 Family))
Edit /etc/modprobe.d/alsa-base (sudo nano /etc/modprobe.d/alsa-base) and add this in the bottom of it

Code:
options snd-hda-intel model=vaio
then do this
Code:
sudo apt-get install linux-backports-modules-$(uname -r)
78

How to install RealPlayer on Ubuntu

1. Open a terminal and enter the following command to download RealPlayer:

wget __LongTerm__

2. Make the file executable with the following command:

chmod a+x RealPlayer11GOLD.bin

3. Run the executable as root and enter your password when prompted:

sudo ./RealPlayer11GOLD.bin

4. If everything is working, you should see this message, hit enter:

Extracting files for Helix installation........................

Welcome to the RealPlayer (11.0.0.4028) Setup for UNIX
Setup will help you get RealPlayer running on your computer.
Press [Enter] to continue...

5. When prompted, install to /opt/real/RealPlayer, just hit enter:

Enter the complete path to the directory where you want
RealPlayer to be installed. You must specify the full
pathname of the directory and have write privileges to
the chosen directory.
Directory: [/opt/real/RealPlayer]

6. Enter "F" at the following screen to confirm:

You have selected the following RealPlayer configuration:

Destination: /opt/real/RealPlayer

Enter [F]inish to begin copying files, or [P]revious to go
back to the previous prompts: [F]:

7. If all goes well, RealPlayer should install and you will be dumped back to the prompt:

Copying RealPlayer files...Path setup done.
Succeeded.
installing application icons resource...
installing document icons resource...
....Succeeded.
Configuring Mozilla...
Installing .mo locale files...
Setting selinux context...
Succeeded.

RealPlayer installation is complete.
Cleaning up installation files...
Done.

8. Optional: delete the RealPlayer download with the following command:

rm RealPlayer11GOLD.bin

9. Copy the Mozilla/Firefox plugins to your plugins directory, enter the command:

cp /opt/real/RealPlayer/mozilla/nphelix.so ~/.mozilla/plugins/nphelix.so && cp /opt/real/RealPlayer/mozilla/nphelix.xpt ~/.mozilla/plugins/nphelix.xpt

10. Optional: remove RealPlayer audio icons from system:

sudo /opt/real/RealPlayer/postinst/install_icon_resource.sh uninstall

Source from here

4 comments:

Paul said...

what i enter the command:

cp /opt/real/RealPlayer/mozilla/nphelix.so ~/.mozilla/plugins/nphelix.so && cp /opt/real/RealPlayer/mozilla/nphelix.xpt ~/.mozilla/plugins/nphelix.xpt

i get the following error:

cp: cannot create regular file `/home/paul/.mozilla/plugins/nphelix.so': No such file or directory

any idea's why?

Paul

tony said...

i got the same response as Paul. I am on Ubuntu 8.04 and Mac Book

shareme said...

hi correct folder url for ff3 is:

/home/user/.mozilla/firefox/ob6n0vod.default/estensions

should work with that change

shareme said...

Confirmed change the directory url to the one I stated

79

Using Juniper Network Connect on Ubuntu

What is Network Connect?

Network Connect is a software package from Juniper Networks that interfaces with its Secure Access hardware and provides a Virtual Private Network (VPN) solution. There are two software products that connect to Secure Access servers: Windows Secure Application Manager which, as you might guess, runs on Microsoft Windows; and Network Connect which runs on other platforms, in particular GNU/Linux.

So, GNU/Linux is supported! Great! Well, sort of. Juniper has fallen into the common trap of supporting Red Hat Enterprise Linux and calling it good enough. It's quite frustrating, since with an extra hour or two of effort these companies could create a portable solution. I realize that support costs money, but even if they only officially supported Red Hat Enterprise, it wouldn't hurt them to go the extra couple of centimeters necessary to provide a more generic implementation.

Luckily, the actual VPN software works fine on Ubuntu. It's the invocation script and especially the installer which is utterly broken. However, it's a relatively straightforward proposition to simply avoid using them; I've created a shell script which will allow you to connect and disconnect without needing to go through the broken scripting that comes with Network Connect. Here's how you use it.


This is how I got REX on Hardy:

 

- Download and install "libstdc++2.10-glibc2.2_2.95.4-24_i386.deb" from http://packages.ubuntu.com/gutsy/i386/libstdc++2.10-glibc2.2/download

 

- install "alien" and "rpm" (via the package manager)

 

- Install openssl  (via the package manager)

- cd /usr/lib

- sudo ln -s libssl.so.0.9.8 libssl.so

 

- enable user "root" with "sudo passwd root"

 

- connect to "https://rex.corp.ebay.com"

 

- when a xterm pops up, enter the root password

 

- after installing disable "root" with "sudo passwd -l root"

 

From now on, just navigate to REX as usual.  When the xterm pops up (like it did above), just ^C out because it’s already installed.


I have done the same thing, except I didn't fake it out using your symlink method for rpm.

Instead, I edited the $HOME/.juniper_networks/network_connect/xlaunchNC.sh. Towards the bottom is the code that looks for rpm.

Code:
rpm -q openssl 1>> $1/missing.info
if [ "$?" -ne "0" ]
then
echo "RPM query for openssl failed." >> $1/missing.rpt
fi
I just commented these lines out. Then I ran
Code:
chattr +i xlaunchNC.sh
...on the file to prevent the logon script from overwriting this file on future logins to the vpn and reseting it back to default.

Works great for me!


81
Try File Management System> Preferences> File Management
If you cant see File Management goto
System> Preferences> Main Menu
In Main Menu System> Preferences, check box File Management
In File Management Media tab Photos choose do nothing.
83

So how do you discover just what partition belongs to which UUID? Open up a terminal session (Applications -> Accessories -> Terminal) and type the following:

sudo blkid

84
Linux only: QuickStart, a free automation utility for Ubuntu Linux systems, makes it easy to perform partial or full system backups of any partition, synchronize folders and update them on a schedule, and take care of other tasks a beginner would normally need to spend serious time researching. The tiny app opens a simple interface listing your choices, although dialog prompts guide you through any steps requiring input. The tools for installing DVD playing codecs, backing up your Master Boot Record, and creating synchronized backups seem particularly helpful, and while I haven't tested every function, a handful of them completed without any problems. QuickStart is a free download for Ubuntu systems only; both links below carry non-terminal installation instructions for the script.
85

View Full Version : [SOLVED] Can't connect to MySQL (10061)


47_MasoN_47
March 5th, 2008, 05:20 PM
Hello,

I'm running MySQL 5.0.45 on Ubuntu 7.10 server edition. I can login fine as either root or the user account I created from the server itself. Those users can create tables, etc. just fine. I want to be able to access the server from WinXP using the ODBC Connector, but every time I try to connect to the server I get error 10061. I checked some other threads and Googled for the past hour but can't figure out what is wrong. I cannot telnet to port 3306 either, but the firewall (Firestarter) is supposed to allow incoming connections to everyone on that port. I can telnet to port 80 which Firestarter also says is open if that means anything.

Thanks, I'm a n00b to MySQL and linux servers in general.
86

Introduction

This page is a quick and brief guide to adjusting the brightness on a Sony VAIO laptop using Ubuntu 6.06.

SONYPI Module

In order to adjust the brightness of a Sony VAIO laptop, the sonypi module needs to be loaded into the kernel.

Step 1: Checking for Module

At the command line issue the following command:

# grep -E "^sonypi" /proc/modules

If you receive a line of outpout, and it states that it is Live, then the module is loaded. If not, move on to step 2.

Step 2: Load the Module

At the command line issue the following commands:


Add your comment: