Ubuntu 12.04 Apache2 增加虚拟目录

Apache2 增加虚拟目录需要如下操作.

我们以建立一个 /deb 目录, 也就是可以通过 http://www.mobibrw.com/deb/来访问的目录为例子。

1.停止 Apache2 的服务,如果修改文件之前不停止服务,则服务重启的时候,有可能会写回以前的配置,导致我们的配置无效。

2.修改配置文件

在里面增加如下内容

如果允许用户可以通过网页来遍历目录下面的所有文件,则需要设置 Options ,把 Options None 修改为 Options Indexes

3.启动服务

编译vim,提示找不到tgetent()

在树莓派上面编译VIM 的时候,提示找不到 tgetent()

就总是提示错误:

解决方法

安装ncurses-dev

Ubuntu下HTTP多线程下载工具

Windows下的下载工具--迅雷,之所以下载速度快,乃是它能搜索资源、为己所用,而不是仅仅从原始地址这单一资源处下载。

Ubuntu下也有类似的工具,那就是aira2。
aira2是一个命令行下载工具,可以配合其他图形界面的下载软件使用。我用的是uget+aria2。uget本身是一个小巧实用的多线程下载工具,加上aria2作为插件,下载速度有明显提高。

一、安装。
uget和aria2都可以在“软件中心”中安装。但是版本都是比较旧的版本。

如果需要安装最新的版本,可以在终端中添加ppa进行安装:
1.uget的安装:

2.aria2的安装:

安装完aria2后,可以在终端中运行aria2 -v,查看版本和支持的特性。需要1.10以上的版本才能支持资源搜索。

二、使用与设置技巧
1.主界面及版本

20130612105251093

2.启用aria2插件

20130612105336468

3.设置下载任务的属性(同时下载几个任务、多少个服务器、保存位置等)

20130612105408843

20130612105426343

服务器数设置为16比较合适。

参考网址 http://blog.csdn.net/luojiming1990/article/details/9078447

cmake两个错误的解决方法

问题1:

-- Check for working CXX compiler: CMAKE_CXX_COMPILER-NOTFOUND
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

解决方法:

sudo apt-get install g++

问题2:

CMake Error at /usr/share/cmake-2.6/Modules/FindKDE4.cmake:84 (MESSAGE):
ERROR: cmake/modules/FindKDE4Internal.cmake not found in
/home/mm/.kde/share/apps;/usr/share/kde4/apps[/code]

解决方法:

sudo apt-get install kdelibs5-dev

Ubuntu 12.04 Server安装Bittorrent Transmission

Ubuntu Server 没有图形界面,如果作为BT 下载服务器的话,可以使用Bittorrent Transmission 来通过Web界面操作,类似http://192.168.1.X:9091这样的方式管理下载。

1.安装服务器端

2.配置文件修改

主要调整如下部分的内容

也就是调整白名单为所有地址都可以网络访问,同时修改用户名密码到自己熟悉的即可。其中  "download-dir" 用来调整文件下载到的地址,这个自己调整即可。

3.使得配置信息生效(注意,必须使用此命令,否则Bittorrent Transmission 会在重启的时候把数据写回磁盘,导致修改无效)

4.修改系统配置文件,开放对于UDP的访问限制

增加如下语句

然后重启服务器。

5.通过浏览器访问即可。

Ubuntu 12.04 安装socks5代理服务器dante-server

dante-server是一个很好的socks4/5代理服务器软件。

  • 使用apt-get安装

  • 添加一个用户

  • 禁止proxyuser用户登录系统(安全考虑)

将proxyuser的shell改成 /bin/false

  • 配置danted.conf

输入以下内容:

  • 创建log文件夹

  • 启动dante-server

  • 查看是否监听成功:

现在你就可以使用socks5了

Ubuntu 13.10 IDT 92HD71B7X 声卡插入耳机无声问题

DELL E5400 笔记本,安装Ubuntu 13.10 ,今天突然发现,插入外置音响,耳机的时候,没有声音了,而内置的喇叭是正常的,网上查询了一下得到解决方法,目前仅仅针对IDT 92HD71B7X  芯片组,其他芯片组不保证能用。

查看声卡芯片组

输出结果如果为

则尝试本方法

如果文件存在,则在文件的最后增加

重启机器,如果不想重启机器,可以尝试

注意,重启,或者强制声卡重新加载之后,可能声音被强制设置为静音了,因此,需要手动打开音量,这个要注意一下。

Ubuntu无法进入桌面报告 Could not update /home/$USER/.ICEauthority

使用Ubuntu和Fedora的用户经常会在进入GNOME时出现

这样的提示。然后就不能正常进入GNOME了(之前在GNOME上的配置都消失了)

解决办法:以root的用户执行

解决问题很简单,但为什么会出现这种情况呢?下面是我的一些个人理解

首先:先介绍下sudo和gksudo

sudo和gksudo都是使用root权限来执行应用,sudo执行程序时使用的是当前用户的配置和家目录,而gksudo使用的是root用户 的家目录和配置,一般情况下看不出什么区别,但是对于那些针对不同用户有不同的配置文件和表现形式的应用程序来说,这两种方式的结果区别就很明显了。比如 下面原文中举的firefox例子。在不通过终端运行程序时,sudo没有办法提供一个界面来输入管理员密码,比如在快捷方式中。还有些GUI程序只能用 gksudo。细心的朋友肯定发现了,在/root下并没有.ICEauthority。那么当用sudo运行程序之后,由于使用的是当前用户的配置和家 目录,

系统将整个家目录的所属者和所属组归属到root:root下,并将.ICEauthority的权限修改成600。故当再次以普通用户身份登入系统时,由于没有权限故无法读取用户的配置文件。根据上述分析,显然,当使用gksudo将能避免这种情况的发生。
一般情况下,可以这样,运行命令行程序时使用sudo,运行GUI程序时用gksudo。

下面是原文:

What’s the Issue?
Since most Ubuntu documentation asks you to use sudo even with graphical applications, I often get asked by Ubuntu users why I recommendgksudo or kdesu for graphical applications instead of sudo.

For example, a lot of guides (including the first book ever published about Ubuntu) will ask you to type this sort of command:

I will always recommend, however, that people use instead this sort of command:

And reserve sudo for command-line applications, like so:

Why is it an issue?
Well, to be perfectly honest, most of the time it isn’t. For a lot of applications, you can run them the improper way—using sudo for graphical applications and see no adverse side effects.

1. There are other times, though, when side effects can be as mild as Firefox extensions not sticking or as extreme as as not being able to log in any more because the permissions on your .ICEauthority changed. You can read a full discussion on the issue here.

These errors occur because sometimes when sudo launches an application, it launches with root privileges but uses the user’s configuration file.

5616035720110414233611022

For example, if you launch Firefox with the command

it uses root’s Firefox configuration file.
5616035720110414233935037
But if you launch Firefox with the command

Change a few settings while launched as root, and you'll see if you dig into your Firefox profile that certain files are now owned by root.

56160357201104142343300785616035720110414233611022 (1)

it runs with root privileges but uses the user’s configuration file (in this case, you can see the homepage and theme are different).
2. Running graphical applications with sudo also has the downside of always having to be run from the terminal. If you don’t use the proper command—gksudo or kdesu, you will not be able to use the command as an icon launcher or keyboard shortcut because there will be no graphical dialogue box to enter your sudo password in.

3. There are also some graphical applications that simply will not run with the sudo command. Kate, for example, can be run as

but cannot be run as

Why not make exceptions?
Bottom line: most of the time when you use sudo for graphical applications, it’s fine. Some of the time, though, it is not fine, and is, in fact, extremely bad.

If you made exceptions, you would have to give people a list of all the graphical applications that are okay to run as sudo and a list of all the graphical applications that must be run as gksudo or kdesu.

Why make a list that needs to be compiled and updated, that most people won’t refer to, and that is completely unnecessary? Just be consistent in suggesting good practice: gksudo and kdesu for graphical applications. sudo for command-line applications.

But gksudo sometimes gives me an error… even though it appears to work…

You may notice that even though gksudo is the proper way to launch graphical applications, if you launch a gksudo application it will sometimes give you what appears to be an error. This, for example:

or these

That is not a real error, and there’s already been a bug report filed on the message appearing. The developers have seen the bug and labeled it a low priority. In the meantime, just ignore the message and keep encouraging people to not use sudo for graphical applications so they won’t potentially mess up their ~/.ICEauthority and other user configuration files.

参考:http://czmmiao.iteye.com/blog/1003810

linux top命令的TIME/TIME+值

top命令的TIME/TIME+是指的进程所使用的CPU时间,不是进程启动到现在的时间,因此,如果一个进程使用的cpu很少,那即使这个进程已经存在N长时间,TIME/TIME+也是很小的数值。

此外,如果你的系统有多个CPU,或者是多核CPU的话,那么,进程占用多个cpu的时间是累加的。

top的manual page:http://linux.die.net/man/1/top
看看他的帮助说明:
l: TIME — CPU Time
Total CPU time the task has used since it started. When ‘Cumulative mode’ is On, each process is listed with the cpu time that it and its dead children has used. You toggle ‘Cumulative mode’ with ‘S’, which is a command-line option and an interactive command. See the ‘S’ interactive command for additional information regarding this mode.
m: TIME+ — CPU Time, hundredths
The same as ‘TIME’, but reflecting more granularity through hundredths of a second.

参考 http://1.guotie.sinaapp.com/?p=24

WordPress安装插件提示“无法创建目录”

WordPress安装插件提示“无法创建目录”,这个是由于目录的权限设置导致的,一般情况下可以直接给目录/wp-content目录下面的plugins  themes   uploads upgrade目录增加 777 权限即可,但是这样做会导致服务器配置的不够安全,因此找到个更合适的方案处理。

前提,服务器系统为Ubuntu 12.04 版本,几个目录的默认所有者为 root,使用的FTP为 vsftpd ,服务器为 Apache2 ,这些条件主要限制了默认的用户组名字,如果系统不同,用户组的名字可能需要调整一下。

1.给这几个目录 755 权限,即,只有所有者才有权限写入。

2.逐个授权,vsftpd 的默认用户分组为ftpgroup,用户名自定义的,我们假定为 ftpuser.  Apache2 的用户分组默认都为www-data,其中plugins  themes  upgrade目录主要是ftp安装插件用的,因此写入权限只要给ftpuser 就可以了,其他用户读取权限足够了。而uploads目录是上传图片资源文件的目录,因此只要给www-data 用户写入权限就可以了。

这样子,基本就安全多了。