linux系统常见问题整理

本文总结一些在Linux 系统下常见的一些问题以及解决方案.

install redhat6.5

close firewall: service iptables stop
start firewall: service iptables start

1
2
3
4
5
6
$ service iptables stop /* 关闭防火墙 */
$ service iptables start /* 开启防火墙 */
$ chkconfig iptables off /* 默认关闭防火墙 */
%start network: service network restart
$ start vncserver: service vncserver on
$ chkconfig vncserver on

mount disk

1
2
3
4
5
$ mount /dev/sdb /home
$ vim /etc/fstab
/dev/sdb /home ext4 defaults 0 0
$ sudo mount //210.28.132.63/data3/USERS/gaobb /home/gaobb/mywork/SV3 -o username=xxxxxx,password=xxxxxx,rw,dir_mode=0777,file_mode=0777,uid=gaobb,gid=gaobb /*挂载网络硬盘*/
$ sudo umount /home/gaobb/mywork/SV3 /*卸载挂载*/

VNC Server Installation on CentOS 6.5

https://www.howtoforge.com/vnc-server-installation-centos-6.5
I am logged in my system with root, & now I will be installing the VNC-server.

1
2
3
4
5
$ yum groupinstall Desktop
$ yum install gnome-core
$ yum install tigervnc-server
%Now make the service on after every reboot
$ chkconfig vncserver on

Adding VNC user

In my case I am using user=srijan it will differ in your case. You can use any username for the same.

1
$ useradd xxxx

Now I will assign the vncpassword for the user with the user I just created before as:

1
2
$ su - srijan
$ vncpasswd

Now I will restart the VNC server service as root user:

1
$ service vncserver restart

VNC更改分辨率

在linux中的VNC会话更改分辨率
http://qa.helplib.com/407397
Ubuntu 15.10安装VNC灰屏的问题
http://www.linuxdiyf.com/linux/18535.html

libcudart.so.6.5: can not open shared object file: No such file or directory…

1
2
3
4
5
sudo vim /etc/ld.so.conf.d/mysql-x86-64.conf
/usr/local/cuda/lib64
/usr/......
ldconfig /etc/ld.so.cache

vim /etc/init id:3:initdefault: Full multiuser mode

1
2
3
4
5
reboot
sh cuda-....
vim /etc/init id:5:initdefault: X11
reboot
$ cuda example make -j8

anacoda

https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.2.0-Linux-x86_64.sh

1
bash Anaconda-2.2.0-Linux-x86_64.sh

opencv

1
$ sudo ./opencv_latest.sh

torch: http://torch.ch/docs/getting-started.html#_

MKL https://software.intel.com/en-us/intel-education-offerings

1
2
3
4
5
$ tar -zxvf parallel_studio_xe_2015
$ chmod a+x parallel_studio_xe_2015 -R
$ cd ~/parallel_studio_xe_2015
$ sudo ./install_GUI.sh
$ SKCG-37XWFDHH

清理缓存

1
2
$ su
$ echo 3 > /proc/sys/vm/drop_caches

查看,杀死僵尸进程

1
2
3
$ ps -ef | grep defunct | grep -v grep
$ ps -A -o stat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}' | xargs kill -9
ps -A -o stat,ppid,pid,cmd |grep -e "^[Zz]"

升级到Ubuntu 16.04的方法

1
2
$ sudo apt-get update %先刷新源:
$ sudo update-manager -c -d %执行更新:

linux下测试磁盘的读写IO速度

有时候我们在做维护的时候,总会遇到类似于IO特别高,但不能判定是IO瓶颈还是软件参数设置不当导致热盘的问题.这时候通常希望能知道磁盘的读写速度,来进行下一步的决策.

下面是两种测试方法:
(1)使用hdparm命令
这是一个是用来获取ATA/IDE硬盘的参数的命令,是由早期Linux IDE驱动的开发和维护人员 Mark Lord开发编写的( hdparm has been written by Mark Lord mlord@pobox.com, the primary developer and maintainer of the (E)IDE driver for Linux, with suggestions from many netfolk).该命令应该也是仅用于Linux系统,对于UNIX系统,ATA/IDE硬盘用的可能比较少,一般大型的系统都是使用磁盘阵列的.

使用方法很简单

hdparm -Tt /dev/sda

/dev/sda:
Timing cached reads: 6676 MB in 2.00 seconds = 3340.18 MB/sec
Timing buffered disk reads: 218 MB in 3.11 seconds = 70.11 MB/sec

可以看到,2秒钟读取了6676MB的缓存,约合3340.18 MB/sec;
在3.11秒中读取了218MB磁盘(物理读),读取速度约合70.11 MB/sec

Ubuntu install teamviewer

sudo dpkg -i teamviewer_11.0.53191_amd64.deb
Selecting previously unselected package teamviewer.
(Reading database … 253184 files and directories currently installed.)
Preparing to unpack teamviewer_11.0.53191_amd64.deb …
Unpacking teamviewer (11.0.53191) …
dpkg: dependency problems prevent configuration of teamviewer:
teamviewer depends on libc6-i386 (>= 2.4); however:
Package libc6-i386 is not installed.
teamviewer depends on lib32asound2; however:
Package lib32asound2 is not installed.
teamviewer depends on lib32z1; however:
Package lib32z1 is not installed.
teamviewer depends on ia32-libs; however:
Package ia32-libs is not installed.

dpkg: error processing package teamviewer (–install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
teamviewer

dpkg --add-architecture i386
apt-get update
sudo dpkg -i teamviewer_11.0.53191_i386.deb 
sudo apt-get install -f 

redhat replace centos source

1.删除redhat原有的yum
rpm -aq|grep yum|xargs rpm -e –nodeps

2.下载yum安装文件

1
2
3
4
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

3.进行安装yum

1
2
3
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

注意最后两个包必需同时安装,否则会相互依赖

1
down vote
I had similar problem, what I did is to manually download the old version python and reinstall it with rpm:

1
2
3
rpm -qa | grep python- | grep 2.6
sudo rpm -ivh --force ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/fastbugs/python-2.6.6-52.el6.x86_64.rpm
sudo rpm -ivh --force python-2.6.6-64.el6.x86_64.rpm

linux平台下要编译安装除gcc和gcc-c++之外,还需要两个开发库:bzip2-devel 和python-devel,因此在安装前应该先保证这两个库已经安装:

1
#yum install gcc gcc-c++ bzip2 bzip2-devel bzip2-libs python-devel -y

然后是去官网下载源码包,地址
下载,解压,按照如下步骤:

1
#tar xvzf boost_1_50_0.tar.gz

进入boost_1_50_0目录:

1
#cd boost_1_50_0

然后是编译安装,boost源码包中有配置脚本,直接用就可以:

1
#sh ./bootstrap.sh

Building Boost.Build engine with toolset gcc… tools/build/v2/engine/bin.linuxx86_64/b2
Detecting Python version… 2.6
Detecting Python root… /usr
Unicode/ICU support for Boost.Regex?… not found.
Generating Boost.Build configuration in project-config.jam…

Bootstrapping is done. To build, run:

1
./b2

To adjust configuration, edit ‘project-config.jam’.
Further information:

1
2
3
4
5
6
7
8
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/boost-build2/doc/html/index.html

接下来就是编译,重点关注是否编译成功:

#./b2

然后就是漫长的等待,如果最后出现:
The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

/home/gang/BAK/boost_1_50_0

The following directory should be added to linker library paths:

/home/gang/BAK/boost_1_50_0/stage/lib

最后,sudo ./b2 install –prefix=/usr/local
1、 boost中大部分库是不用编译成动态或者静态链接库。

2、 只有regex,thread等几个库比较麻烦一点.要编译。

3、 如果用gcc编译器-l指定动态链接库的路径,还要指定头文件的路径。

4、 或者链接的boost库放到.c或.cpp之后,否则链接不能通过,编译可以通过。

如下所示:g++ -lz -lpthread hh.c -lboost_filesystem -lboost_thread

安装rar步骤如下:

1 下载rar安装包: 下载地址:http://www.rarsoft.com/download.htm
2 安装rar

1
2
3
tar -zxvf rarlinux-x64-4.2.0.tar.gz #解压rar
cd rar #进入目录安装
make

git clone –recursive https://github.com/rbgirshick/fast-rcnn.git

error: Failed connect to github fatal: HTTP request failed

Solution

1
2
$ git config --global url."https://".insteadOf git://
$ git config --global http.proxy 114.212.~~.~~:~~~~~

安装 convert

sudo apt-get install imagemagick

W: GPG 错误

W: GPG 错误:http://archive.ubuntukylin.com:10006 xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY 8D5A09DC9B929006

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 8D5A09DC9B929006

Ubuntu 修改代理

1
2
3
sudo vim /etc/apt/apt.conf
Acquire::http::Proxy "http://114.212.××.××:××××/";
Acquire::https::Proxy "https://114.212.××.××:××××/";
1
2
3
4
5
sudo vim /etc/profile or sudo vim ~/.bashrc
export http_proxy=http://114.212.××.××:××××
export https_proxy=https://114.212.××.××:××××
source /etc/profile or ~/.bashrc

安装 epstopdf

1
sudo apt-get install texlive-font-utils

图像添加水印

在 Ubuntu 下安装:

1
$ sudo apt-get install imagemagick

假设把名为’Email: csgaobb@gmail.com’的水印文字添加在原始图片(8s.png)右下角,且水印的下边缘距原始图片5像素、右边缘距原始图片5像素。使用如下命令即可:

1
$ convert 8s.png -gravity southeast -fill orange -pointsize 50 -draw "text 5,5 'Email: csgaobb@gmail.com'" 8s-c.jpg

Can’t Mount NTFS drive “The disk contains an unclean file system

sudo ntfsfix /dev/sdXY


本作品采用知识共享署名 2.5 中国大陆许可协议进行许可,欢迎转载,但转载请注明来自 Sunshine 并保持转载后文章内容的完整。本人保留所有版权相关权利。

本文链接:http://gaobb.github.io/2015/06/07/linux系统常见问题整理/

坚持原创技术分享,您的支持将鼓励我继续创作!

热评文章