分类存档: Tech/技术-Archlinux - 第3页

BOINC分布式计算(Archlinux)

转载自wiki

BOINC website: "Use the idle time on your computer (Windows, Mac, or Linux) to cure diseases, study global warming, discover pulsars, and do many other types of scientific research. It's safe, secure, and easy."

Wikipedia: "The Berkeley Open Infrastructure for Network Computing (BOINC) is a non-commercial middleware system for volunteer and grid computing. It was originally developed to support the SETI@home project before it became useful as a platform for other distributed applications in areas as diverse as mathematics, medicine, molecular biology, climatology, and astrophysics. The intent of BOINC is to make it possible for researchers to tap into the enormous processing power of personal computers around the world."

安装:

pacman -S boinc

图形界面使用:

boincmgr

更多使用方法参考 wiki archlinux boinc


ArchLinux下Gnome3的安装和配置

本文转载自wiki

Introduction

GNOME3 comes with two interfaces, gnome-shell (the new, standard layout) and fallback mode. gnome-session will automatically detect if your computer is capable of running gnome-shell and will start fallback mode if not.

Fallback mode is very similar to the GNOME 2.x layout (while using gnome-panel and metacity, instead of gnome-shell and Mutter).

If you are on fallback mode you can still change the window manager with your preferred one.

Upgrade from the current gnome 2.32

Warning: The session might crash during the update and it is recommended that you run the update command in a screen session, from another DE or WM, or from tty
# pacman -Syu 

Important: You will end up with a system that has GNOME 3.x fallback mode. To install the new shell:

# pacman -S gnome-shell

Installing to a new system

GNOME 3 is in [extra]. You can install it by running the following command:

# pacman -Syu gnome

For additional applications

# pacman -Syu gnome-extra

Daemons and modules needed by GNOME

The GNOME desktop requires one daemon, DBUS for proper operation.

To start the DBUS daemon:

# /etc/rc.d/dbus start

Or add these daemons to the DAEMONS array in /etc/rc.conf so they will start on boot up, e.g.:

DAEMONS=(syslog-ng dbus network crond)

GVFS allows the mounting of virtual file systems (e.g. file systems over FTP or SMB) to be used by other applications, including the GNOME file manager Nautilus. This is done with the use of FUSE: a user space virtual file system layer kernel module.

To load the FUSE kernel module:

# modprobe fuse

Or add the module to the MODULES array in /etc/rc.conf so they will load at boot up, e.g.:

MODULES=(fuse usblp)
Note: FUSE is a kernel module, not a daemon.

Running GNOME

For better desktop integration GDM is recommended (but other login managers, such as SLiM also work, see Policykit section).

# pacman -S gdm

Check out Display_Manager to learn how to start it correctly.

If you prefer to start it from the console, add the following line to your ~/.xinitrc file, making sure it's the last line and the only one that starts with exec (see xinitrc):

exec ck-launch-session gnome-session

Now GNOME will start when you enter the following command:

$ startx

Using the shell

See https://live.gnome.org/GnomeShell/CheatSheet

Customization

Using Gnome-tweak-tool

# pacman -S gnome-tweak-tool

This tool can customize fonts, themes, minimize & maximize buttons and some other useful settings like what action is taken when the lid is closed.

A good customization tutorial is http://blog.fpmurphy.com/2011/03/customizing-the-gnome-3-shell.html which explores the power of gsettings.

GDM Customization

# su - gdm -s /bin/bash
$ dbus-launch

This command will print DBUS_SESSION_BUS_ADDRESS and DBUS_SESSION_BUS_PID. We need to export them

$ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Jb433gMQHS,guid=fc14d4bf3d000e38276a5a2200000d38
$ export DBUS_SESSION_BUS_PID=4283

Check to see if dconf-service is running and if not, start it like this

$ /usr/lib/dconf/dconf-service &

Wallpaper

$ GSETTINGS_BACKEND=dconf gsettings get org.gnome.desktop.background picture-uri
$ GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-uri "file:///usr/share/backgrounds/gnome/SundownDunes.jpg"

You will need to point to a file where the gdm user has permission to read, not in your home directory.

Turning off the sound

$ GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.sound event-sounds false

Change GDM's keyboard layout

Since GDM 3 does not care about your gnome keyboard settings, you have to set your layout to Xorg config. See here: Beginners'_Guide#Non-US_keyboard

Changing the GTK3 theme using settings.ini

Similar to ~/.gtkrc-2.0 for GTK2+ it is possible to set the GTK3 (Gnome 3) theme via ${XDG_CONFIG_HOME}/gtk-3.0/settings.ini. By default ${XDG_CONFIG_HOME} is interpreted as ~/.config.

Only Adwaita theme exists in this moment for gtk3 and is available in gnome-themes-standard package.

Example:

 [Settings]
 gtk-theme-name = Adwaita
 gtk-fallback-icon-theme = gnome
 # next option is applicable only if selected theme supports it
 gtk-application-prefer-dark-theme = true
 # set font name and dimension
 gtk-font-name = Sans 10

It may be necessary to restart one's DE or WM for the settings to be applied.

Note: More options can be find there: GtkSettings documentation

Resizing the Massive Titlebar

# sed -i "/title_vertical_pad/s/value=\"[0-9]\{1,2\}\"/value=\"0\"/g" /usr/share/themes/Adwaita/metacity-1/metacity-theme-3.xml

Hit Alt + F2 and type restart followed by Enter

This will change the title_vertical_pad from 14 to 0 giving a much sleeker look to windows.

To restore the original values:

sudo pacman -S gnome-themes-standard

Setting an icon theme

Note: With gnome-tweak-tool version 3.0.3 and later, you can place icon theme you wish to use inside ~/.icons.

Usefully, Gnome 3 is able to use Gnome 2 icon themes, which means you're not stuck with the default set. To do this, simply copy your desired icon theme's directory to ~/.icons. For example:

$ cp -R /home/user/Desktop/my_new_icon_theme ~/.icons

The new icon theme 'my_new_icon_theme' will now be selectable using the gnome-tweak-tool (under 'Interface'), otherwise it can be set with no need of gnome-tweak-tool by adding the gtk-icon-theme-name entry inside ${XDG_CONFIG_HOME}/gtk-3.0/settings.ini.

File: ${XDG_CONFIG_HOME}/gtk-3.0/settings.ini
.....
gtk-icon-theme-name = my_new_icon_theme
.....

Start program automatically after login to GNOME 3

You can specify which programs to start automatically after login using the gnome-session-properties tool, which is a part of the gnome-session package.

$ gnome-session-properties

Removing folders from the "Computer" section in Nautilus's Places sidebar

The displayed folders are specified in ~/.config/user-dirs.dirs and can be altered with any editor. An execution of xdg-user-dirs-update will change them again, thus it may be advisable to set the file permissions to read-only.

Setting the default terminal via console

gsettings, which replaces gconftool-2 in Gnome 3, is used to set e. g. the default terminal manually. The setting is relevant for nautilus-open-terminal.

The commands for urxvt run as daemon:

gsettings set org.gnome.desktop.default-applications.terminal exec urxvtc
gsettings set org.gnome.desktop.default-applications.terminal exec-arg "'-e'"

Setting Nautilus to Use Location Bar Entry

If you want to enter path locations manually in Nautilus you can press ctrl+l. To make this persistent you can use gsettings.

gsettings set org.gnome.nautilus.preferences always-use-location-entry true

Disable accessibility icon in panel

First deactivate it as startup-service: GNOME_3#Start_program_automatically_after_login_to_GNOME_3

After that create a folder named noa11y.icon@panel.ui in $HOME/.local/share/gnome-shell/extensions. In this folder create two files. The first one is named extension.js and has this content:

const Panel = imports.ui.panel;

function main() {
	Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['a11y'] = '';
}

The second one is named metadata.json and has this content:

{
	"shell-version": ["3.0.1"],
	"uuid": "noa11y.icon@panel.ui",
	"name": "na11y",
	"description": "Turn off the ally icon in the panel"
}

Now restart the gnome-shell (press ALT+F2, type r and press Enter) and the icon is away. If this extensions stops working adjust the shell-version number in the metadata-file according to your version.

Disable bluetooth icon in panel

First deactivate it as startup-service: GNOME_3#Start_program_automatically_after_login_to_GNOME_3

After that create a folder named nobluetooth.icon@panel.ui in $HOME/.local/share/gnome-shell/extensions. In this folder create two files. The first one is named extension.js and has this content:

const Panel = imports.ui.panel;

function main() {
	Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['bluetooth'] = '';
}

The second one is named metadata.json and has this content:

{
	"shell-version": ["3.0.1"],
	"uuid": "nobluetooth.icon@panel.ui",
	"name": "nbluetooth",
	"description": "Turn off the bluetooth icon in the panel"
}

Now restart the gnome-shell (press ALT+F2, type r and press Enter) and the icon is away. If this extensions stops working adjust the shell-version number in the metadata-file according to your version.

Middle Mouse Button Emulation

By default, GNOME 3 disables middle mouse button emulation regardless of Xorg settings (Emulate3Buttons). To enable middle mouse button emulation use:

gsettings set org.gnome.settings-daemon.peripherals.mouse middle-button-enabled true

Battery icon

To have battery tray icon, install gnome-power-manager package:

# pacman -S gnome-power-manager

Enabling fallback mode

Your session will automatically start in fallback mode if gnome-shell is not present or if your desktop cannot handle graphics acceleration (such as running in a Virtual Machine or on old hardware). If you want to enable it while having gnome-shell installed, open gnome-control-center. Open System Info > Graphics. Change Forced Fallback Mode to ON.

Enabling hidden features

Gnome 3.0 hides a lot of useful options which you can customize with dconf-editor or gconf-editor for settings not yet migrated to dconf.

Changing Hotkeys

In dconf-editor, enable org.gnome.desktop.interface "can-change-accels".

An example of changing the delete hotkey: Open nautilus, select any file/directory, then click "Edit" from the menubar, and hover over the "Move to Trash" menuitem. While hovering, push delete, and default accel will be unset. Now push the key that you want to set as accel. i.e. Pushing again delete, will make the accel change to "del".

Make sure you have selected a file, else the "Move to Trash" menuitem will be greyed out. You should disable "can-change-accels" afterwards, to prevent accidental accel changes.

How to shutdown through the Status menu

For now, the Shutdown option seems to be hidden if the user presses the Status menu on the upper right. If you want to shutdown your system through the Status menu, click on it and then press the Alt button. The "Suspend" option will instantly turn into "Power off...", as long as you are pressing the Alt button, which will allow you to properly shutdown your system.

You can also install the "Alternative Status Menu" extension (see the section on Enabling Extensions, below). This will put a permanent "Power Off" option in the Status menu below the usual suspend option.

Enabling integrated messaging

Empathy, the engine behind the integrated messaging, and all of the system settings based on your messaging accounts will not show up unless the telepathy group of packages or at least one of the backends (telepathy-gabble, or telepathy-haze, for example) is installed. These are not included in the default Arch GNOME installs and the Empathy interface doesn't give a nice error message, it just fails to work silently. You can install them:

# pacman -S telepathy

Enabling extensions

Gnome Shell can be customised to an extent with extensions that have been written by others. These provide functionality like having a dock that is always present, and being able to change the shell theme. More details on the functionality of currently available extensions is given here You can use the gnome-shell-extensions-git package in the AUR to install them. Restart Gnome to enable them.

If installing the extensions causes Gnome to stop working then you must remove the user-theme extension and and the auto-move-windows extension from their installation directory (could be in ~/.local/share/gnome-shell/extensions or /usr/share/gnome-shell/extensions or /usr/local/share/gnome-shell/extensions). Removing or adding extensions to these directories will remove or install them form the system. More details on Gnome Shell extensions are available here.

Troubleshooting

My GTK2+ apps show segfaults and won't start

That usually happens when oxygen-gtk is installed. That theme conflicts somehow with GNOME 3's or/and GTK3 settings and when it has been set as a GTK2 theme, the GTK2 apps segfault with errors like:

 (firefox-bin:14345): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(firefox-bin:14345): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(firefox-bin:14345): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(firefox-bin:14345): Gdk-CRITICAL **: IA__gdk_colormap_get_visual: assertion `GDK_IS_COLORMAP (colormap)' failed

(firefox-bin:14345): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(firefox-bin:14345): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(firefox-bin:14345): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(firefox-bin:14345): Gdk-CRITICAL **: IA__gdk_window_new: assertion `GDK_IS_WINDOW (parent)' failed
Segmentation fault

The current "workaround" is to remove oxygen-gtk from the system completely and set another theme for your apps.

Nautilus segmentation fault in non-GNOME environments

Nautilus 3.x depends on gnome-icon-theme and will seg fault if it's missing. See bug #24099.

I use the ATI Catalyst driver and I encounter glitches and artifacts while using GNOME Shell

For the moment, Catalyst is not proposed to be used while running GNOME Shell. The opensource ATI driver, xf86-video-ati, however, seems to be working properly with the GNOME 3 composited desktop.

I have multiple monitors and the Dock extension appears stuck between them

If you have multiple monitors configured using Nvidia Twinview, the dock extension may get sandwiched in-between the monitors. You can edit the source of this extension to reposition the dock to a position of your choosing.

Edit /usr/share/gnome-shell/extensions/dock@gnome-shell-extensions.gnome.org/extension.js and locate this line in the source:

this.actor.set_position(primary.width-this._item_size-this._spacing-2, (primary.height-height)/2);

The first parameter is the X position of the dock display, by subtracting 15 pixels as opposed to 2 pixels from this it correctly positioned on my primary monitor, you can play around with any X,Y coordinate pair to position it correctly.

this.actor.set_position(primary.width-this._item_size-this._spacing-15, (primary.height-height)/2);

There are no event sounds for Empathy and other programs

The sound-theme-freedesktop package must be installed for the default event sounds:

 # pacman -S sound-theme-freedesktop

Editing hotkeys via can-change-accels fails

It is also possible to manually change the keys via an application's so-called accel map file. Where it is to be found is up to the application: For instance, Thunar's is at ~/.config/Thunar/accels.scm, whereas Nautilus's is located at ~/.gnome2/accels/nautilus. The file should contain a list of possible hotkeys, each unchanged line commented out with a leading ";" that has to be removed for a change to become active.

"Failed to load session 'gnome-fallback'" message

Check if notification-daemon is installed.

 # pacman -S notification-daemon

urxvt的配置

自从archlinux升级后,firefox变成了4.0版本了,scim不能在firefox4.0输入中文了,于是用了scim-bridge,但是scim-bridge,不能在xterm上输入中文,于是改用rxvt-unicode版本的终端,即urxvt,默认的urxvt很丑陋,于是搜了下资料自己配置了一下

配置文件为用户目录下的.Xdefaults

# transparency - true or false (default)
URxvt*transparent:false

# tint with any color; i.e., blue, red, tomato4, olivedrab2, etc.
#   some nice listings are at:
#     http://www.nisrv.com/modules.php?name=Hex_Colors
#     http://www.htmlgoodies.com/tutorials/colors/article.php/3478921
URxvt*tintColor:blue

# shading - 0 to 99 darkens, 101 to 200 lightens.
#   Don't use with tintColor; use a darker or lighter color instead.
#URxvt*shading:40

# scrollback buffer lines - 65535 is max (64 is default)
URxvt*saveLines:12000

# font color (default is black)
URxvt*foreground:Black

# background color (prior to tinting) (default is white)
URxvt*background:white

# xft fonts - anti-aliased xft font setup is nice, but can be choppy
#URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=13
URxvt*font: xft:MS Yahei:pixelsize=18

#我喜欢微软雅黑字体,因此我的系统从winxp下拷贝了微软雅黑字体,并用fc-cache等进行了安装,这里你可以使用其他你系统上有的字体

# traditional fonts - a more traditional font setup in lieu of xft
#URxvt*font:-*-courier-medium-r-normal-*-*-140-*-*-*-*-iso8859-1
#URxvt*boldFont:-*-courier-bold-r-normal-*-*-140-*-*-*-*-iso8859-1

# Replace blue folder colors with a lighter shade for clarity. To
# set colored folders and files within urxvt, xterm, and aterm, add
# the following line to your ~/.bashrc ($HOME/.bashrc) file under
# the heading "# User specific aliases and functions":
#   alias ls="ls -h --color=auto"
URxvt*color4:RoyalRed
URxvt*color12:RoyalBlue

# scrollbar - true (default) or false
URxvt*scrollBar:true

# scrollbar position - left=false (default) or right=true
URxvt*scrollBar_right:false

# scrollbar style - rxvt (default), plain, next, or xterm
URxvt*scrollstyle:rxvt

ArchLinux下mysql安装、启动

安装很简单:

pacman -S mysql

启动mysql server:/usr/share/mysql/mysql.server start

(我的版本是2.6.37-ARCH)

禁止WordPress自动将半角标点符号替换为全角

打开 wp-includes/formatting.php 文件,找到代码:

// static strings
$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

将以上两行注释掉就可以了

Linux下mencoder转换视频格式的简单命令

仅介绍mencoder的基本转换方法,格式参数采用的是默认设置

mencoder进行操作基本方法:

mencoder inputfile -o outputfile -ovc 目标视频格式 -oac 目标音频格式 -of 目标文件格式

例如:

转换为flv格式

mencoder input.avi -o outfile.flv -of lavf -oac mp3lame -ovc lavc

转换为avi

mencoder infile.avi -o outfile.avi -of avi -oac mp3lame  -ovc xvid

转换为wmv

mencoder infile.avi -o outfile.wmv -of lavf -oac mp3lame -ovc lavc

截图方法

mplayer infile -ss START_TIME -noframedrop -nosound -vo jpeg -frames N

将视频中的音频抽取下来存成mp3的方法

1 先把音频存成wav:mplayer -vo null -vc null -ao pcm:file=/data/outfile.wav -srate 44100 -noframedrop infile

2 用lame压缩为mp3:lame /data/outfile.wav /data/outfile.mp3

Linux下GostScript(gs)打印gs文件的方法

需要转换几个ps文件,在ArchLinux下man了一下gs,简单的总结下gs的用法,备忘。

将a.ps文件打印成b.pdf,dpi为300,命令:

gs -o b.pdf -r300 -sDEVICE=pdfwrite a.ps

打印成b.jpg,命令:

gs -o b.jpg -r300 -sDEVICE=jpeg a.ps

打印成b.png,命令:

gs -o b.png -r300 -sDEVICE=png256 a.ps

分页打印,命令

gs -o b%d.pdf -r300 sDEVICE=pdfwrite a.ps

也可以利用gs把pdf转换成图片,命令:

gs -o b.jpg -r300 -sDEVICE=jpeg a.pdf

文件编码转换方法

转换文件内容编码的方法,例:

iconv -f utf8 -t gb2312 filename.txt >new.txt

转换文件名编码方法,例:

convmv -f utf8 -t gb2312 filename.txt

我学习emacs总结的小技巧

1 开启拼写检查

emacs可以使用aspell进行拼写检查,archlinux下记得安装aspell-en,直接用aspell检查文件可以使用命令:

aspell --mode=ccpp -c test.cpp  检查c程序代码

aspell --mode=tex -c my.tex  检查tex

在emacs下开启aspell用:M-x flyspell-mode

2 单词补全

简单的可以用M-x /就可以补全,可以多按几次M-x / 找到合适的补全

此外,可以用auto-complete补全,可以显示一个列表公选择。从http://cx4a.org/software/auto-complete/下载auto-complete然后,安装它。安装方法:解压后make install DIR=/YourHome/.emacs.d

记得在.emacs文件中加入

(add-to-list 'load-path "/home/z/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "/home/z/.emacs.d/ac-dict")
(ac-config-default)

注意:archlinux若没有.emacs文件需要手动建立改文件,并把他拷贝到用户的根目录下,而非~/.emacd目录

~~待续

linux下pdf文档多页合并为一页的方法

我的系统是Archlinux,合并pdf文档需要用到pdfnup,他是texlive-bin中的一个命令,首先安装texlive-bin:

pacman -S texlive-bin

例:

需要合并a.pdf文件,将4页合并为一页,排列方式为2x2,使用命令

pdfnup --npu 2x2 a.pdf

合并后的文件保存为a-nup.pdf

第 3 页,共 6 页12345...最旧 »