Linux操作系统典型问题
来源:互联网 发布:dagre d3.min.js 编辑:程序博客网 时间:2024/05/21 10:24
前两天去装机,在Linux操作系统上安装,在公司怎么联系都没有问题,一到现场就状况百出,还是基本功不扎实啊,特将相关的典型问题列举一下,共享给感兴趣的读者,其实都是些非常基本的问题。
欢迎访问《Linux知识学习- ArcSDE安装必备》:http://blog.csdn.net/linghe301/article/details/6149867
1:关于切换用户的错误
问题一:
正常切换用户
[root@ags ~]# su - arcsde[arcsde@ags ~]$但是我碰到的问题,切换用户提示“-bash: /home/arcsde: is a directory”
[root@ags ~]# su - arcsde-bash: /home/arcsde: is a directory[arcsde@ags ~]$最后费了好大的劲,发现环境变量多了个~
从上面截图可以看到,我们的环境变量,默认有好多~符号,但是都是虚的,就比如蓝色的~,但是如果不小心自己输入了~,其实跟虚的没有什么区别,这个不容易查看到,就会出现我上面碰到错误。
问题二:
切换用户还会碰到这种情况
[root@ags ~]# su - arcsde-bash-3.2$这种情况,就是你的用户下的环境变量等文件丢失。我们可以查看root用户下的信息,将相关的环境变量复制过去,然后在配置好该用户自己的环境变量即可
[root@ags ~]# su - arcsde-bash-3.2$-bash-3.2$ su -口令:[root@ags ~]# ls -al总计 292drwxr-x--- 18 root root 4096 03-21 09:24 .drwxr-xr-x 24 root root 4096 03-20 09:40 ..-rw------- 1 root root 1267 2011-04-11 anaconda-ks.cfgdrwxrwxr-x 3 root root 4096 03-20 10:12 .arcgis10.0-rw-rw-r-- 1 root root 1189 03-20 10:14 ArcGIS_MWSysReq.log-rw-rw-r-- 1 root root 6522 03-20 10:28 ArcGISServer_InstallLog.log-rw------- 1 root root 170 2011-04-13 .bash_history-----------------------------------注意-rw-r--r-- 1 root root 24 2006-07-13 .bash_logout-------------------------------------注意-rw-r--r-- 1 root root 191 2006-07-13 .bash_profile------------------------------------注意-rw-r--r-- 1 root root 176 2006-07-13 .bashrc-------------------------------------------注意drwx------ 2 root root 4096 2011-04-11 .chewing-rw-r--r-- 1 root root 100 2006-07-13 .cshrcdrwxr-xr-x 2 root root 4096 2011-04-11 Desktop-rw------- 1 root root 26 2011-04-11 .dmrcdrwxr-x--- 2 root root 4096 2011-04-11 .eggcups-rw------- 1 root root 16 2011-04-11 .esd_authdrwx------ 4 root root 4096 03-20 09:42 .gconfdrwx------ 2 root root 4096 03-21 09:44 .gconfddrwxr-xr-x 3 root root 4096 2011-04-11 .gnomedrwx------ 7 root root 4096 03-21 08:53 .gnome2drwx------ 2 root root 4096 2011-04-11 .gnome2_privatedrwxr-xr-x 2 root root 4096 2011-04-11 .gstreamer-0.10-rw-r--r-- 1 root root 81 2011-04-11 .gtkrc-1.2-gnome2-rw------- 1 root root 378 03-20 09:42 .ICEauthority-rw-r--r-- 1 root root 27540 2011-04-11 install.log-rw-r--r-- 1 root root 3671 2011-04-11 install.log.syslogdrwx------ 3 root root 4096 2011-04-11 .metacitydrwx------ 4 root root 4096 2011-04-13 .mozilladrwxr-xr-x 3 root root 4096 2011-04-12 .nautilus-rw-r--r-- 1 root root 1433 03-20 10:06 .recently-used.xbeldrwxr-xr-x 3 root root 4096 2011-04-11 .redhatdrwx------ 4 root root 4096 2011-04-11 .scim-rw-r--r-- 1 root root 129 2006-07-13 .tcshrcdrwx------ 2 root root 4096 2011-04-11 .Trash-rw------- 1 root root 66 2011-04-18 .xauth1TiR6Y-rw-r--r-- 1 root root 3570 03-21 09:43 .xsession-errors[root@ags ~]# cp .bash_profile /home/arcsde[root@ags ~]# cp .bashrc /home/arcsdecp:是否覆盖“/home/arcsde/.bashrc”? yes[root@ags ~]# su - arcsde[arcsde@ags ~]$我上面只缺少.bash_profile文件,直接复制过去即可解决。
2:怎么在RH环境下安装依赖包
首先我们将光驱的RH安装光盘Mount到一个路径
基本语法:mount 光驱路径 自己设定路径
[root@localhost ~]# mount /dev/cdrom /home/softmount: block device /dev/cdrom is write-protected, mounting read-onlymount: /dev/cdrom already mounted or /home/soft busymount: according to mtab, /dev/hdc is already mounted on /home/soft[root@localhost ~]# cd /home/soft[root@localhost soft]# lsCluster README-te.html RELEASE-NOTES-U5-enClusterStorage README-zh_CN.html RELEASE-NOTES-U5-en.htmlEULA README-zh_TW.html RELEASE-NOTES-U5-es.htmleula.en_US RELEASE-NOTES-as.html RELEASE-NOTES-U5-fr.htmlGPL RELEASE-NOTES-bn.html RELEASE-NOTES-U5-gu.htmlimages RELEASE-NOTES-de.html RELEASE-NOTES-U5-hi.htmlisolinux RELEASE-NOTES-en RELEASE-NOTES-U5-it.htmlREADME-as.html RELEASE-NOTES-en.html RELEASE-NOTES-U5-ja.htmlREADME-bn.html RELEASE-NOTES-es.html RELEASE-NOTES-U5-kn.htmlREADME-de.html RELEASE-NOTES-fr.html RELEASE-NOTES-U5-ko.htmlREADME-en RELEASE-NOTES-gu.html RELEASE-NOTES-U5-ml.htmlREADME-en.html RELEASE-NOTES-hi.html RELEASE-NOTES-U5-mr.htmlREADME-es.html RELEASE-NOTES-it.html RELEASE-NOTES-U5-or.htmlREADME-fr.html RELEASE-NOTES-ja.html RELEASE-NOTES-U5-pa.htmlREADME-gu.html RELEASE-NOTES-kn.html RELEASE-NOTES-U5-pt_BR.htmlREADME-hi.html RELEASE-NOTES-ko.html RELEASE-NOTES-U5-ru.htmlREADME-it.html RELEASE-NOTES-ml.html RELEASE-NOTES-U5-si.htmlREADME-ja.html RELEASE-NOTES-mr.html RELEASE-NOTES-U5-ta.htmlREADME-kn.html RELEASE-NOTES-or.html RELEASE-NOTES-U5-te.htmlREADME-ko.html RELEASE-NOTES-pa.html RELEASE-NOTES-U5-zh_CN.htmlREADME-ml.html RELEASE-NOTES-pt_BR.html RELEASE-NOTES-U5-zh_TW.htmlREADME-mr.html RELEASE-NOTES-ru.html RELEASE-NOTES-zh_CN.htmlREADME-or.html RELEASE-NOTES-si.html RELEASE-NOTES-zh_TW.htmlREADME-pa.html RELEASE-NOTES-ta.html RPM-GPG-KEY-redhat-betaREADME-pt_BR.html RELEASE-NOTES-te.html RPM-GPG-KEY-redhat-releaseREADME-ru.html RELEASE-NOTES-U5-as.html ServerREADME-si.html RELEASE-NOTES-U5-bn.html TRANS.TBLREADME-ta.html RELEASE-NOTES-U5-de.html VT配置YUM
[root@localhost ~]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# vi rhel-debuginfo.repo将修改[Server]项,如果没有添加即可
[Server] name=Red Hat Enterprise Linux $releasever - $basearch - Debug baseurl=file:///home/soft/Server ---------------注意:/home/soft是你mount的路径,相关的包都在Server文件夹里面enabled=1 gpgcheck=0gpgkey=file:///home/soft/RPM-GPG-KEY-redhat-release我们测试一下是否配置成功
[root@localhost ~]# yum install openmotifLoaded plugins: rhnplugin, securityThis system is not registered with RHN.RHN support will be disabled.Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package openmotif.i386 0:2.3.1-2.el5_4.1 set to be updated--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: openmotif i386 2.3.1-2.el5_4.1 Server 1.5 MTransaction Summary================================================================================Install 1 Package(s)Upgrade 0 Package(s)Total download size: 1.5 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing : openmotif 1/1Installed: openmotif.i386 0:2.3.1-2.el5_4.1Complete!
这说明安装成功了。但是我在安装现场,不知道为什么,YUM老是没有安装成功!我们可以使用另外一种方式RPM方式
[root@localhost ~]# cd /home/soft/Server/[root@localhost Server]# ls -l openmotif*-r--r--r-- 455 root root 1377121 2007-01-18 openmotif22-2.2.3-18.i386.rpm-r--r--r-- 187 root root 1392893 2007-01-18 openmotif22-2.2.3-18.x86_64.rpm-r--r--r-- 179 root root 1591633 2010-03-03 openmotif-2.3.1-2.el5_4.1.i386.rpm-r--r--r-- 81 root root 1600928 2010-03-03 openmotif-2.3.1-2.el5_4.1.x86_64.rpm-r--r--r-- 179 root root 3076726 2010-03-03 openmotif-devel-2.3.1-2.el5_4.1.i386.rpm-r--r--r-- 81 root root 3204880 2010-03-03 openmotif-devel-2.3.1-2.el5_4.1.x86_64.rpm[root@localhost Server]# rpm -ivh libX11-1.0.3-11.el5.i386.rpmwarning: libX11-1.0.3-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] package libX11-1.0.3-11.el5.i386 is already installed安装时候特别注意你安装的位数,光盘上32Bit和64Bit的都有,如果YUM没有安装上,使用这种方式也是可以的
如果不需要mount那个文件,使用umount命令取消
[root@localhost ~]# umount /home/soft[root@localhost ~]# cd /home/soft[root@localhost soft]# lsapplypatch gsrvr jdk-6u20-linux-i586.bin sde931-sp2-ora10g-lx64.tar sdeimport sderastergiomgr jdk1.6.0_20 linux64.ora10g sdeexport sdelayer sdexinfo我们看到,该路径下已经没有RH操作系统光盘的信息了
如果安装时候出现如下现象
[root@localhost Server]#rpm -ivh openmotif22-2.2.3-18.x86_64.rpm提示 warning openmotif22-2.2.3-18.x86_64.rpm Header V2 DSA signature:NOKEY ,key ID 37017186 Error :Failed dependencies: libXp.so.6()(64Bit ) is needed by openmotif 22-2.2.3-18.x86_64说明你需要安装的这个openmotif22-2.2.3-18.x86_64.rpm需要依赖libXp.so.6(),所以你需要首先安装libXp.so.6(),然后再安装openmotif22-2.2.3-18.x86_64.rpm
3:编辑Linux文件的问题:/bin/sh^M:bad interpreter:没有哪个文件或目录
因为要安装ArcGIS Server,我使用的静默安装,我将两个文件通过SSH导出到Windows上,然后修改完毕后,在导入Linux,然后执行报如下问题
-bash: ./InstallServerSilently.sh: /bin/sh^M:bad interpreter:没有哪个文件或目录这是因为,在Linux上的文件,导出到Windows编辑,有些看不到的字符或者换行符什么的,Linux并不解析这些信息,所以,如果这种情况,建议在Linux的文件编辑器进行相关编辑,避免不必要的麻烦。如果想在Windows编辑后再导入,可以查看一下相关帮助。
4:指定用户的默认目录
使用usermod为创建的用户指定相关的目录
[root@localhost ~]# useradd mytest[root@localhost ~]# su - mytest[mytest@localhost ~]$ pwd/home/mytest[root@localhost home]# mkdir test[root@localhost home]# cd[root@localhost ~]# usermod -d /home/test mytest[root@localhost ~]# su - mytest-bash-3.2$ pwd/home/test[ags@localhost ~]$ su -口令:[root@localhost ~]# cp .bash_profile /home/test[root@localhost ~]# cp .bashrc /home/test[root@localhost ~]# su - mytest[mytest@localhost ~]$ pwd/home/test5:查看Linux版本
[root@localhost ~]# uname -aLinux localhost.localdomain 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i 686 i686 i386 GNU/Linux[root@localhost ~]# lsb_release -aLSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-no archDistributor ID: RedHatEnterpriseServerDescription: Red Hat Enterprise Linux Server release 5.5 (Tikanga)Release: 5.5Codename: Tikanga[root@localhost ~]# cat /proc/versionLinux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc versi on 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010
6:设置Linux的IP
一般我们查看Linux的IP,是咋Root用户下
[root@localhost ~]# ifconfigeth0 Link encap:Ethernet HWaddr 00:0C:29:AF:01:C7 inet addr:192.168.200.201 Bcast:192.168.200.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:feaf:1c7/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:165288 errors:0 dropped:0 overruns:0 frame:0 TX packets:1812 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:19567799 (18.6 MiB) TX bytes:240279 (234.6 KiB) Interrupt:67 Base address:0x2024 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2855 errors:0 dropped:0 overruns:0 frame:0 TX packets:2855 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4247810 (4.0 MiB) TX bytes:4247810 (4.0 MiB)但是我们如果需要修改IP,一般是在两个地方,一个是HOSTS文件
[root@localhost ~]# more /etc/hosts# Do not remove the following line, or various programs# that require network functionality will fail.#127.0.0.1 ags ags.localdomain #::1 localhost6.localdomain6 localhost6192.168.200.201 ags ags.localdomain另外一个是这个ifcfg-etho文件
[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]DEVICE=eth0BOOTPROTO=static-----------------------------重要ONBOOT=YESHWADDR=00:0c:29:af:01:c7IPADDR=192.168.200.201----------------------重要NETMASK=255.255.255.0GATEWAY=192.168.200.254
7:修改Linux主机名
修改/etc/sysconfig/network 修改这个文件,系统才有效
/etc/hosts hostname命令读这个配置文件
[root@RedHat ~]# more /etc/hosts# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1 RedHat(主机名) localhost.localdomain localhost::1 localhost6.localdomain6 localhost6[root@RedHat ~]# more /etc/sysconfig/networkNETWORKING=yesNETWORKING_IPV6=noHOSTNAME=RedHat(主机名)GATEWAY=192.168.100.254
8:关闭Linux的防火墙和SELINUX服务
关于启动和关闭防火墙的命令:
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
关闭SELINUX服务需要修改相关文件/etc/selinux
[root@rhtest sysconfig]# vi config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - SELinux is fully disabled.SELINUX=enforcing---------------------------------------------------------这个# SELINUXTYPE= type of policy in use. Possible values are:# targeted - Only targeted network daemons are protected.# strict - Full SELinux protection.SELINUXTYPE=targeted将SELINUX=disabled即可
9:Linux 6.1安装图形界面
1:配置YUM包
2:安装软件包
yum install xorg*yum groupinstall "X Window System"yum groupinstall Desktopyum groupinstall "Desktop Platform"3:修改启动模式为5
vi /etc/inittab
文件内容改为 id:5:initdefault:
4:重启 reboot
10:Linux启动SSH服务
判断SSH是否可用
[root@redhat6 ~]# sshusage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-e escape_char] [-F configfile] [-i identity_file] [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-R [bind_address:]port:host:hostport] [-S ctl_path] [-w local_tun[:remote_tun]] [user@]hostname [command]
开启或者关闭SSH服务
[root@redhat6 init.d]# service sshd statusopenssh-daemon (pid 1476) is running...[root@redhat6 init.d]# service sshd stopStopping sshd: [ OK ][root@redhat6 init.d]# service sshd startStarting sshd: [ OK ][root@redhat6 init.d]# pwd/etc/init.d
11:Linux查看端口
[root@localhost ~]# netstat -anp | grep 5433tcp 0 0 0.0.0.0:5433 0.0.0.0:* LISTEN 4764/postgrestcp 0 0 :::5433 :::* LISTEN 4764/postgresunix 2 [ ACC ] STREAM LISTENING 16915 4764/postgres /tmp/.s.PGSQL.5433
12:Linux查看服务
[root@localhost ~]# chkconfig --list postgresql-9.0postgresql-9.0 0:off 1:off 2:on 3:on 4:on 5:on 6:off
13:Linux操作系统切换语言
[root@rhsde ~]# more /etc/sysconfig/i18nLANG="en_US.UTF-8"将相关的LANG="zh_CN.UTF-8"
14:Linux挂载ISO文件
[root@RHEL6 ~]# mount -o loop -t iso9660 /opt/\[ºìñÆóÒµLinux.6.1\].rhel-server-6.1-x86_64-dvd.iso /home/soft[root@RHEL6 ~]# cd /home/soft[root@RHEL6 soft]# lsEFI RELEASE-NOTES-es-ES.html RELEASE-NOTES-si-LK.htmlEULA RELEASE-NOTES-fr-FR.html RELEASE-NOTES-ta-IN.htmlGPL RELEASE-NOTES-gu-IN.html RELEASE-NOTES-te-IN.htmlHighAvailability RELEASE-NOTES-hi-IN.html RELEASE-NOTES-zh-CN.htmlimages RELEASE-NOTES-it-IT.html RELEASE-NOTES-zh-TW.htmlisolinux RELEASE-NOTES-ja-JP.html repodataLoadBalancer RELEASE-NOTES-kn-IN.html ResilientStoragemedia.repo RELEASE-NOTES-ko-KR.html RPM-GPG-KEY-redhat-betaPackages RELEASE-NOTES-ml-IN.html RPM-GPG-KEY-redhat-releaseREADME RELEASE-NOTES-mr-IN.html ScalableFileSystemRELEASE-NOTES-as-IN.html RELEASE-NOTES-or-IN.html ServerRELEASE-NOTES-bn-IN.html RELEASE-NOTES-pa-IN.html TRANS.TBLRELEASE-NOTES-de-DE.html RELEASE-NOTES-pt-BR.htmlRELEASE-NOTES-en-US.html RELEASE-NOTES-ru-RU.html
其实跟Linux5类似,只是Linux5配置的文件,在Linux6已经没有了
[root@RHEL6 ~]# vi /etc/yum.repos.d/rhel-source.repo直接修改以上文件,然后添加如下内容(具体路径依照自己环境)
[Packages]name=Red Hat Enterprise Linux $releasever Beta - $basearch - Sourcebaseurl=file:///home/soft/Serverenabled=1gpgcheck=0gpgkey=file:///home/soft/RPM-GPG-KEY-redhat-release
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Blog: http://blog.csdn.net/linghe301
Weibo: http://www.weibo.com/linghe301
-------------------------------------------------------------------------------------------------------
- Linux操作系统典型问题
- 操作系统PV操作典型问题
- Linux 操作系统在NAS中的典型应用
- Linux安装ArcSDE典型问题
- 操作系统典型调度算法
- 操作系统典型调度算法
- 操作系统典型调度算法
- 操作系统典型调度算法
- 操作系统典型调度算法简介
- 操作系统之典型调度算法
- ArcGIS Server 10.1 for Linux典型问题总结
- 典型问题代码
- ios典型问题
- 典型销售面试问题
- VC编译典型问题
- 典型递归问题1
- 典型递归问题2
- 典型递归问题3
- conversation:in Good common
- Objective-C学习文档
- 常见的MySQL性能测试工具
- 给老板汇报技术规划的一些要点
- monkey命令参数
- Linux操作系统典型问题
- Linux平台上的软件包管理
- Oracle 11g R2(11.2.0.3.0) RAC环境搭建(一)
- ubuntu下安装source insight
- div+css 网页布局基础
- Android monkey 资料
- Delphi 文件读写的基本方法
- 百度统计中的索引量和site:命令的百度收录量不一致的原因
- 地图平移上平滑显示