通哥运维笔记之Linux系统管理问题总结(一)

问题一,

创建新用户xuetong,用该用户登陆报错如下:

[root@R715 ~]# su - xuetong

id: cannot find name for user ID 504

id: cannot find name for group ID 504

id: cannot find name for user ID 504

[I have no name!@R715 ~]$

并且显示I have no name! 

解决:由于/etc/passwd 和/etc/group两个文件的权限(600)不对造成的,

将passwd和group文件的权限改为644就可以了

chmod 644 /etc/passwd

chmod 644 /etc/group


问题二,

linux下命令行安装KVM虚拟机

#virt-install --name mem1 --hvm --ram 2048 --vcpus 2 --disk path=/opt/vms/os_11.img,size=10 --network network:default --accelerate  --vnc --vncport=5911 --vnclisten=0.0.0.0 --os-variant rhel6 --cdrom /root/CentOS-6.3-x86_64-minimal-EFI.iso -d

报错:qemu-kvm: -drive file=/root/CentOS-6.3-x86_64-minimal-EFI.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw: could not open disk image /root/CentOS-6.3-x86_64-minimal-EFI.iso: Permission denied

解决:解决:vim /etc/libvirt/qemu.conf

# Some examples of valid values are:

#

# user = "qemu" # A user named "qemu"

# user = "+0" # Super user (uid=0)

# user = "100" # A user named "100" or a user with uid=100

user = "root" (将user前#去掉)

 

# The group for QEMU processes run by the system instance. It can be

# specified in a similar way to user.

group = "root"(将group前#去掉)

 

# Whether libvirt should dynamically change file ownership

# to match the configured user/group above. Defaults to 1.

# Set to 0 to disable file ownership changes.

dynamic_ownership = 0(将dynamic_ownership前#去掉)


问题三,通过xshell远程连接linux宿主机安装kvm虚拟机

报错:Cannot open display: 

Run 'virt-viewer --help' to see a full list of available command line options

Fri, 05 Sep 2014 18:24:50 DEBUG    Domain state after install: 1

Domain installation still in progress. You can reconnect to 

the console to complete the installation process.

解决:通过vnc连接linux宿主机,IP地址+VNC端口号(虚拟机开通的vnc端口号),登录虚拟机安装linux操作系统即可。


问题四,安装apache

报错:configure: error: Cannot use an external APR with the bundled APR-util

报错:checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.

解决:需要安装APR及APR-UTIL


安装APR 

# cd srclib/apr

# ./configure --prefix=/usr/local/apr

报错:onfigure: error: in `/usr/local/httpd-2.2.27/srclib/apr':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

解决:安装gcc依赖包  yum -y install gcc

make && make install 时,报错:

-bash: make: command not found

解决:安装make软件包 yum -y install make


安装apr-util

# cd ../apr-util/

# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

# make

# make install


安装apache

./configure --prefix=/usr/local/apache --enable-deflate --enable-headers --enable-mime-magic --enable-proxy --enable-ssl=static --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-mpm=prefork --with-ssl=/usr/local/ssl/include --enable-mods-shared=all

报错:

checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures


解决:安装zlib-devel 

 yum install zlib-devel


报错:no SSL-C headers found

configure: error: ...No recognized SSL/TLS toolkit detected

解决:安装openssl-devel yum install openssl-devel



启动apache /usr/local/apache/bin/apachectl start

报错:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

解决:更改/usr/local/apache/bin/http.conf中ServerName及/etc/hosts文件中的主机名


安装apr

# cd srclib/apr

# ./configure --prefix=/usr/local/apr

# make

# make install

安装apr-util

# cd ../apr-util/

# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

# make

# make install

# cd ../../

加载全局变量:

echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib " >>/etc/profile

source /etc/profile

安装APACHE

#cd httpd-2.2.21

yum install zlib-devel

./configure --prefix=/usr/local/apache --enable-deflate --enable-headers --enable-mime-magic --enable-proxy --enable-ssl=static --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-mpm=prefork --with-ssl=/usr/local/ssl/include --enable-mods-shared=all

#make && make install


#netstat -an | grep :80    //查看linux80端口是否开启


问题五

安装hudson报错:打开http://192.168.1.81:8081/hudson/ 报错ERROR

解决:必须保证java版本和hudson版本对应一致。若Java版本低则会报错。


#ServerName www.example.com:@@Port@@

Listen @@Port@@


问题六

安装Java报错:

[root@vm80 java]# java -version

java version "1.5.0"

gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-4)


Copyright (C) 2007 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


解决:

[root@vm80 bin]# rm -f java

[root@vm80 usr]# ln -s /usr/java/jdk1.6.0_26/bin/java /usr/bin/java


[root@vm80 usr]# java -version

Error occurred during initialization of VM

java/lang/NoClassDefFoundError: java/lang/Object

解决方法:

进入目录:/usr/java/jdk/lib

将tools.pack解压为tools.jar:

unpack200 tools.pack tools.jar

进入目录:/usr/java/jdk/jre/lib

将rt.pack解压为rt.jar:

unpack200 rt.pack rt.jar


问题七

yum的时候报错:

[root@vm87 local]# yum -y install wget

Loaded plugins: fastestmirror, presto

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was

14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

Error: Cannot find a valid baseurl for repo: base错误

解决方法如下(修改dns配置)

vi /etc/resolv.conf

在此文件中最后加入nameserver 8.8.8.8

如果没有vi编辑器可用

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


更改主机名:

vi /etc/sysconfig/network 修改hostname

HOSTNAME=vm85.bc.com

vi /etc/hosts

127.0.0.1  vm85.bc.com

reboot(必须重启电脑)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章