Linux常见问题

yum标准源库

yum install epel-release

Shell正则提取字符串

curl -s 'http://www.baidu.com/s?wd=site%3Azby.ly.com&tn=json'|grep -Po '(?<="all":\ )[\w\W]*?(?=,)' #正则提取zby.ly.com收录数量

安装nginx报错:./configure: error: the HTTP rewrite module requires the PCRE library.

解决办法:

安装pcre-devel,openssl,openssl-devel

$ yum -y install pcre-devel openssl openssl-devel
 

./configure,make,make install作用说明

./configure 用来生成Makefile,为下一步编译做准备,可以通过在configure后加上参数来对安装进行控制,比如代码:./configure –prefix=/usr 意思是将该软件安装在 /usr 下面,执行文件就会安装在 /usr/bin (而不是默认的 /usr/local/bin),资源文件就会安装在 /usr/share(而不是默认的/usr/local/share)。同时一些软件的配置文件你可以通过指定 –sys-config= 参数进行设定。有一些软件还可以加上 –with、–enable、–without、–disable 等等参数对编译加以控制;

make 编译;

make install ,安装(有些软件需要先运行机制make check 或 make test来进行一些测试),这一步需要有root权限(因为需要向系统写入文件);

make clean , 清除上次的make命令所产生的object文件(后缀为“.o”的文件)及可执行文件,再次执行./configure时需要用;

Linux运行IDLE报错: IDLE can't import Tkinter. Your Python may not be configured for Tk.

RHPL下运行IDLE(/usr/local/bin/idle)报错:

IDLE can't import Tkinter.

Your Python may not be configured for Tk.

解决方法

A、安装tcl-devel与tk-devel:

# yum install tcl-devel

# yum install tk-devel

B、重新编译、安装python (make、make install)

重启nginx时提示丢失nginx.pid

解决方法

执行 /alidata/server/nginx/sbin/nginx -c /alidata/server/nginx/conf/nginx.conf

提示:stevezhou 不在 sudoers 文件中。此事将被报告。

其实并非所有用户都能够执行sudo,因为有权限的用户都在/etc/sudoers中。

解决方法:

在文件 /etc/sudoers 中加入: stevezhou   ALL=(ALL:ALL)   ALL
 

文件上传/下载

本地Windows

SecureCRT进行ssh连接后,可以安装 lrzsz ,安装后:

rz :上传文件,形式 #rz

sz : 发送文件到本地,形式:#sz <服务器文件路径>

本地Linux

使用sftp命令

建立连接命令形式:#sftp <用户名>@<服务器IP/主机名>

建立连接后可用 ? 命令查看可用的命令及说明

Centos安装Flashplayer

从http://get.adobe.com/cn/flashplayer/下载 install_flash_player_11_linux.i386.tar.gz;

解压出libflashplayer.so文件;

拷贝到 /usr/lib/mozilla/plugins下 (如果是64位系统,拷贝到:/usr/lib64/mozilla/plugins);

重新安装python后,ibus输入法消失

这也是由于ibus不支持python2.7引起的,修改以下文件

/usr/bin/ibus-setup

/usr/libexec/ibus-ui-gtk

中的 "exec python" 为 "exec python2.6"

重启输入法, 问题解决.

重新安装python (python2.6.6换为python2.7.9)后,运行yum报错: no module name yum

由于yum不兼容python2.7,所以要保留python2.6 (不要安装2.7后就删了2.6哦),修改文件: /usr/bin/yum

将 " #!/usr/bin/python" 改为 "#!usr/bin/python2.6"

ERROR: Cannot find a valid baseurl for repo: base

ERROR提示:

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base

解决方法

 echo "nameserver 8.8.8.8">>/etc/resolv.conf

ERROR:Cannot retrieve repository metadata (repomd.xml) for repository updates-released. Please verify its path and try again

解决方法

 注释掉 /etc/yum.repos.d/rhel-debuginfo.repo里的baserul,换一个centos源:http://centos.ustc.edu.cn/centos/5/os/i386/