RSS
 

CentOS 5.3 修改 hostname

08 Aug

1.修改/etc/hosts

sudo vi /etc/hosts

修改为

127.0.0.1 myhostname localhost.localdomain localhost

2.修改/etc/sysconfig/network

sudo vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=myhostname
GATEWAY=61.67.71.126

3.使用hostname命令

hostname myhostname

4.重新登录

 

Firefox 3.5.2 中文语言包

07 Aug

http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.5.2/linux-i686/xpi/zh-CN.xpi

或者下载安装下面文件

readconf.creadconf.c (已下载226次)
 
1 Comment

Posted in firefox

 

通过SSH连接XDMCP

05 Aug

在CentOS5.3下配置了XDMCP,但是从外网始终没法连上,本机可以连接,google了2天,未果。

SSH的方式可以连接上远端的服务器,于是想到了可以使用SSH X11 转发的方式,连接

1.首先开始服务器上XDMCP服务和远程连接

$ sudo /etc/gdm/custom.conf

修改内容如下

[security]
DisallowTCP=false
[xdmcp]
Enable=true

2.使用-X参数开始SSH X11 Forwarding

$ ssh -X -l LOGINUSER REMOTEHOST

3.使用Xnest打开X桌面

$ Xnest :1 -ac -once -query localhost

第二步和第三步可以合并为

$ ssh -X -C -l LOGINUSER REMOTEHOST -n Xnest :1 -ac -once -query localhost
 

Ubuntu中的XDMCP客户端

03 Aug

远程登录到linux可以使用VNC或者XDMCP的方式,windows下有一个很有名的XDMCP客户端Xmanager,其实UBuntu下默认也安装了该客户端,一次打开[应用程序]-[internet]-[终端服务客户端(Terminal Server Client)]或者在命令行输入tsclient,在常规标签中的协议选项可以看到XDMCP,只不过是灰色的无法选择,需要先安装协议支持。

$ sudo apt-get install xnest

装完后就可以使用了。

 
No Comments

Posted in linux, ubuntu

 

CentOS 5.3 配置SVN

31 Jul

1.安装subversion

$ yum --disablerepo=\* --enablerepo=c5-media install mod_dav_svn subversion

2.创建svn库

$ cd /var/www/svn
$ svnadmin create repos
$ sudo chown apache.apache repos

3.配置subversion.conf

$ vi /etc/httpd/conf.d/subversion.conf

修改内容如下

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, “/var/www/svn”.  Each repository
# must be readable and writable by the ‘apache’ user.  Note that if
# SELinux is enabled, the repositories must be labelled with a context
# which httpd can write to; this will happen by default for
# directories created in /var/www.  Use “restorecon -R /var/www/svn”
# to label the repositories if upgrading from a previous release.
#

#
# To create a new repository “http://localhost/repos/stuff” using
# this configuration, run as root:
#
#   # cd /var/www/svn
#   # svnadmin create stuff
#   # chown -R apache.apache stuff
#

<Location /svn>
DAV svn
SVNParentPath /var/www/svn
#  SVNPath /var/www/svn/repos
#
#   # Limit write permission to list of valid users.
<LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
AuthType Basic
AuthName “Authorization Realm”
AuthUserFile /etc/svn-auth-conf
Require valid-user
</LimitExcept>
</Location>

4.创建svn用户和密码

$ htpasswd -cm /etc/svn-auth-conf yourusername

5.重启apache服务

$ sudo /sbin/service httpd restart

6.浏览器访问地址

http://localhost/svn/repos

 

CentOS 5.3 配置VNC

30 Jul

服务端配置

1.安装VNC Server

$ sudo yum --disablerepo=\* --enablerepo=c5-media vnc-server

2.为用户vangie设置vnc password

$ su - vangie
$ vncpasswd

3.编辑VNC Server配置文件

$ vi /etc/sysconfig/vncservers

修改内容如下:

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my ‘myusername’ (adjust this to your own).  You will also
# need to set a VNC password; run ‘man vncpasswd’ to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use “-nolisten tcp” to prevent X connections to your VNC server via TCP.

# Use “-nohttpd” to prevent web-based VNC clients connecting.

# Use “-localhost” to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the “-via” option in the
# `man vncviewer’ manual page.

# VNCSERVERS=”2:myusername”
# VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -nohttpd -localhost”

VNCSERVERS=”1:vangie”
VNCSERVERARGS[2]=”-geometry 800×600″

4.创建并编辑xstartup脚本

xstartup脚本会在vncserver第一次启动时创建。

$ sudo /sbin/service vncserver start
$ sudo /sbin/service vncserver stop

编辑xstartup

$ vi .vnc/xstartup

#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#twm &
exec gnome-session &

5.启动VNC Server

$ sudo /sbin/service vncserver start

Ubuntu客户端连接

1.安装VNC客户端

$ sudo apt-get install vncviewer

2.连接服务端

$ vncviewer -bgr233 192.168.18.211:1
 

CentOS 5.3 安装中文字体

30 Jul

$sudo yum –disablerepo=\* –enablerepo=c5-media install fonts-chinese
$sudo yum –disablerepo=\* –enablerepo=c5-media install fonts-ISO8859-2

对应的rpm包为

fonts-chinese-3.02-12.el5.noarch.rpm
fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm

 
 

CentOS 5.3 安装好以后,普通用户无法登录

30 Jul

CentOS5.3 安装完毕后只有root用户可以登录,普通用户无论是在本地还是在远程都无法登录。

在本地GDM中输入用户名密码后,提示

authentication failed

用户root几次重置密码以后仍然提示认证失败,可以确定不是密码错误。

尝试SSH远程登录,root用户没用问题,而普通用户会提示

Connection closed by 192.168.18.211

如果有意输入错误的密码,则会提示

Permission denied, please try again.

再一次验证不是密码问题。

采用更极端的方法,先用root用户登录,然后在终端

$ su - vangie

长时间没有响应。

开始怀疑是不是ldap的问题,使用authconfig关闭ldap验证

$ authconfig --disableldapauth --update

在winbind 服务重启后,GDM和SSH仍然没法登陆,使用su命令已经可以切换进普通用户了。

更加开始欢迎是网络验证服务的问题,于是

$ authconfig --disablewinbind --update

关停整个winbind服务。

终于GDM和SSH都可以登陆了。

回想起来,安装的时候,好像在新建用户的时候多勾了几个自己也不知道的选项,盲目配置带来了很多的麻烦。

 
 

period-Linux Command

29 Jul

. (source or dot operator)

SYNTAX
      . filename [arguments]

      source filename [arguments]

Read and execute commands from the filename argument in the current shell context.

If filename does not contain a slash, the PATH variable is used to find filename. The current directory is searched if filename is not found in $PATH.

If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged.

The return status is the exit status of the last command executed, or zero if no commands are executed. If filename is not found, or cannot be read, the return status is non-zero.

A period `.’ is a synonym for `source’

source is a bourne shell builtin and a POSIX `special’ builtin

一直没有弄明白为什么”.”命令可以导入其他bash的变量,ubuntu下的man没有该项,原来“.”是source的同义词,并且都是bash的内部命令。

 
No Comments

Posted in bash, linux

 

烦人的easy-share

27 Jul

国内的IP登录easy-share总是要等待500秒,漫长的等待后如果不及时下载又要重新等待,崩溃。

于是在ubuntu下写了一个脚本来提醒自己

首先安装send-notify

sudo apt-get install libnotify-bin

将下面脚本保存为”notifyme”,

#!/bin/bash
sec=$1
msg=$2
if [ -z "$sec" ]
then
sec="500s";
fi

if [ -z "$msg" ]
then
msg="时间到了,赶紧下载吧!";
fi
(sleep $sec && notify-send $msg >/dev/null 2>&1 &)

然后赋予执行权限

chmod 755 notifyme

该命令的执行格式为

notifyme [等时间]  [提醒消息]

 
No Comments

Posted in bash, ubuntu