通哥運維筆記之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(必須重啓電腦)


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