http://10.1.1.35/ule_basic/ule04.txt

--

在线用户的管理命令

w 显示在线用户的详细情况

[root@li ~]# w
09:47:36 up 26 min, 19 users, load average: 0.27, 0.14, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 - 09:35 51.00s 0.05s 0.05s -bash
abc tty2 - 09:35 1:04 0.03s 0.03s -bash
user1 tty3 - 09:46 47.00s 0.01s 0.01s -bash
root :0 - 09:25 ?xdm? 26.65s 0.14s /usr/bin/
root pts/1 :0.0 09:39 0.00s 0.05s 0.00s w
root pts/2 :0.0 09:39 41.00s 0.05s 0.03s -bash
root pts/3 :0.0 09:39 7:42 0.02s 0.02s bash
root pts/4 station59.cluste 09:44 2:20 0.04s 0.04s -bash
root pts/5 station142.clust 09:44 1:18 0.04s 0.04s -bash
root pts/6 station198.clust 09:44 54.00s 0.04s 0.04s -bash
root pts/7 station60.cluste 09:44 45.00s 0.04s 0.04s -bash
user1 pts/8 aaa.bb.com 09:47 15.00s 0.03s 0.03s -bash
root pts/9 station191.clust 09:45 1:43 0.03s 0.03s -bash
root pts/10 station53.cluste 09:45 1:41 0.03s 0.03s -bash
root pts/11 station237.clust 09:45 2:14 0.03s 0.03s -bash
root pts/12 :0.0 09:47 3.00s 0.01s 0.01s bash
root pts/13 :0.0 09:47 3.00s 0.01s 0.01s bash
root pts/14 :0.0 09:47 2.00s 0.01s 0.01s bash
root pts/15 station63.cluste 09:47 1.00s 0.03s 0.03s -bash



用户 登录终端 从哪里登录过来 登录时间


users 只显示登录过来的用户名


who 显示用户名,登录终端 ,from 哪里 登录时间

--------------------------
踢掉一个远程登录过来的用户

[root@li ~]# ps -ef |grep pts/14
root 4071 3452 0 09:47 pts/14 00:00:00 bash
root 4315 3456 0 09:55 pts/1 00:00:00 grep pts/14


kill -9 4315 ----杀掉它的PID(进程号)

----------

last 显示登录成功的日志,读取的是/var/log/wtmp

[root@li ~]# last |head
root pts/16 station63.cluste Sun Apr 11 09:49 - 09:52 (00:02)
root pts/15 station120.clust Sun Apr 11 09:49 - 09:52 (00:03)
root pts/8 station231.clust Sun Apr 11 09:48 - 09:51 (00:03)
root pts/15 station63.cluste Sun Apr 11 09:47 - 09:47 (00:00)
root pts/14 :0.0 Sun Apr 11 09:47 still logged in
root pts/13 :0.0 Sun Apr 11 09:47 still logged in
root pts/12 :0.0 Sun Apr 11 09:47 still logged in
user1 pts/8 aaa.bb.com Sun Apr 11 09:47 - 09:48 (00:01)
user1 tty3 Sun Apr 11 09:46 still logged in
root pts/13 station89.cluste Sun Apr 11 09:46 - 09:47 (00:00)


lastb 显示登录失败的日志,读取的是/var/log/btmp

[root@li ~]# lastb |head
root ssh:notty station179.clust Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station192.clust Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station191.clust Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station98.cluste Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station142.clust Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station98.cluste Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station142.clust Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty aaa.bb.com Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty station191.clust Sun Apr 11 09:58 - 09:58 (00:00)
root ssh:notty aaa.bb.com Sun Apr 11 09:58 - 09:58 (00:00)


lastlog 显示是最后一次登录的信息


[root@li ~]# lastlog |head
Username Port From Latest
root pts/16 station63.cluste Sun Apr 11 09:49:26 +0800 2010
bin **Never logged in**
daemon **Never logged in**
adm **Never logged in**
lp **Never logged in**
sync **Never logged in**
shutdown **Never logged in**
halt **Never logged in**
mail **Never logged in**


消息命令

wall 给每个在线用户和终端发送信息,用于对所有用户进行通知等情况


write 单独对一个用户写信息
write user [ttyname]


在文本模式下做如下操作 :
ctrl+alt+F1 登录root(tty1) ctrl+alt+F2登录abc(tty2)

在第一个终端tty1
write abc tty2
hello abc
ctrl+d --ctrl+d结束

--在文本模式下如果显示翻上去的页面 shift+pageup 向下shift+pagedown
--在bash下查找以前使用的很长的命令 ctrl+shift+R



-----------------------------------------------------------



磁盘管理


fdisk - Partition table manipulator for Linux



[root@li ~]# fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes --磁盘名,大小
255 heads, 63 sectors/track, 38913 cylinders --多少柱面
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux -- *代表引导
/dev/sda2 14 523 4096575 82 Linux swap / Solaris
/dev/sda3 12762 17860 40957717+ 83 Linux
/dev/sda4 17861 38913 169108222+ 5 Extended--扩展分区的end值最好要等于前面的柱面值,才表示磁盘利用完
/dev/sda5 17861 20410 20482843+ 83 Linux--逻辑扩展分区的范围在扩展分区内
/dev/sda6 20411 21685 10241406 83 Linux
/dev/sda7 22196 31922 78132096 83 Linux
/dev/sda8 31923 38913 56155176 83 Linux


fdisk /dev/sda
Command (m for help): m
Command action
a toggle a bootable flag --表示一个分区作为引导分区
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition --删除一个分区
l list known partition types --列出已知的分区类型
m print this menu
n add a new partition --增加一个分区
o create a new empty DOS partition table
p print the partition table --打印当前的分区表
q quit without saving changes --不保存退出
s create a new empty Sun disklabel
t change a partition's system id --改变分区类型ID值
u change display/entry units
v verify the partition table
w write table to disk and exit --保存退出
x extra functionality (experts only)


Command (m for help): l

0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris
1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 82 Linux swap / So c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c7 Syrinx
5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data
6 FAT16 42 SFS 86 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT



83 ext3
82 swap 交换分区
8e Linux LVM
fd Linux raid auto

Command (m for help): n
First cylinder (21699-38913, default 21699): --直接回车就是默认从21699柱面开始分
Using default value 21699
Last cylinder or +size or +sizeM or +sizeK (21699-22195, default 22195): +200M --这里M大小写无所谓





分完后要用[root@li etc]# partprobe 刷新到磁盘分区表


mkfs -t ext3 /dev/sda9 格式化
mkfs.ext3 /dev/sda9
mkfs /dev/sda9


mkdir /fdisk 建立一个用于挂载的目录

mount /dev/sda9 /fdisk 把新分的分区挂载到新建的目录



[root@li etc]# mount
/dev/sda8 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda6 on /notes type ext3 (rw)
/dev/sda7 on /share type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
/dev/sda9 on /fdisk type ext3 (rw)




[root@li fdisk]# umount /fdisk/ --umount 时报busy的错误,一般是因为有程序占用,最常见的就是bash占用,要先cd出来,再umount
umount: /fdisk: device is busy
umount: /fdisk: device is busy

--如果cd出来了,umount时还是报busy错误,尝试一下下面两条命令
[root@li /]# lsof /fdisk/
[root@li /]# fuser -k /fdisk/

--同一个目录,可以mount多个分区,但是只显示最后一次mount的分区的内容,umount的话,就要一级一级的umount


mount的用法

挂载远程的NFS共享目录
mount 10.1.1.35:/share/soft/ /fdisk/


挂载光盘 要加-o loop
mount /share/iso/rhel-5.4-server-i386-dvd.iso /mnt/ -o loop
mount -o loop /share/iso/rhel-5.4-server-i386-dvd.iso /mnt/

针对分区类型挂载
mount -t vfat /dev/sda10 /mnt
mount -t cifs /dev/sda10 /mnt

--cifs common internet file system windows网络邻居共享使用的就是此协议


mount 的特殊用法:
--当你装了两个linux系统在同一台机器上,进入其中一个系统,看不到另一个系统的文件信息,但是可以看到它的分区 ,可以在当前系统建立一个目录,把另一个系统的分区mount过来,就可以使用另一个系统的文件了

--直接把windows的共享目录给mount过来
mount -t cifs -o username=administrator //10.1.1.161/knk /mnt

这样使用的要注意的是 用户名别打错了 共享名尽量简单 windows防火墙要关闭


-------------------------------

建立一个swap分区

[root@li ~]# free -m
total used free shared buffers cached
Mem: 2017 964 1052 0 123 529
-/+ buffers/cache: 312 1705
Swap: 4000 0 4000 --这里


用fdisk 新建出一个分区 我这里是一G大小 (注意分区ID值为82)

[root@li ~]# mkswap /dev/sda12 --格式为swap分区类型
Setting up swapspace version 1, size = 1011671 kB

[root@li ~]# swapon /dev/sda12 --使之生效

[root@li ~]# free
total used free shared buffers cached
Mem: 2065980 989096 1076884 0 126236 542432
-/+ buffers/cache: 320428 1745552
Swap: 5084520 0 5084520


[root@li /]# swapoff /dev/sda12 --使之失效
[root@li /]# free
total used free shared buffers cached
Mem: 2065980 2010728 55252 0 9596 1710824
-/+ buffers/cache: 290308 1775672
Swap: 4096564 136 4096428


[root@li /]# dd if=/dev/zero of=/swapfile bs=1M count=1000 --用dd命令创建出一个1000M大小的文件,此文件为二进制文件,不能cat或者vi去看
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 4.40506 seconds, 238 MB/s


[root@li /]# mkswap /swapfile
Setting up swapspace version 1, size = 1048571 kB

[root@li /]# free
total used free shared buffers cached
Mem: 2065980 1998744 67236 0 9940 1683508
-/+ buffers/cache: 305296 1760684
Swap: 5120556 136 5120420

--使用dd命令备份mbr
dd if=/dev/sda of=/mbrbackup bs=1 count=512


---------------------------------------------------------------------

注意mount挂载的目录不是/bin,/boot/,/etc/,/lib,/dev 等等重要的系统目录


设置开机后自动挂载目录

[root@li ~]# cat /etc/fstab
LABEL=/1 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0--在内存上挂载
devpts /dev/pts devpts gid=5,mode=620 0 0--虚拟终端
sysfs /sys sysfs defaults 0 0--内存信息的反应
proc /proc proc defaults 0 0--虚拟目录,都是系统正在运行的信息
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sda6 /notes ext3 defaults 0 0
/dev/sda7 /share ext3 defaults 0 0

分区号或者标签号 挂载点 挂载类型 挂载参数 是否扫描 扫描级别


加上下面一句让/dev/sda9开机后自动挂载到/fdisk
/dev/sda9 /fdisk ext3 defaults 0 0


e2label /dev/sda9 dev9 --给/dev/sda9 做一个标签

挂载参数
defaults rw,suid,dev,exec,auto,nouser,async

rw 读写 ro 只读
suid 挂载之后属于谁
async 异步
sync 同步


autofs 自动挂载服务


如何把
mount 10.1.1.35:/share/iso/ /mnt 写到fstab里

vim /etc/fstab
10.1.1.35:/share/iso/ /mnt nfs defaults 0 0




mount -a 把fstab里写的的重挂载一次,可以测试一下fstab是否写错,以防开机开不了



-----------------------------------------------------------------------




软件包的安装与管理

包名-发布版本-支持平台.包类型后缀

yum-3.2.22-20.el5.noarch.rpm

xsane-0.991-5.el5.i386.rpm

nginx-0.8.4.tar.gz

cacti-0.8.7b-1.fc8.src.rpm


i386 支持386平台,386都是支持后在的586,686的平台,但是反过来686不一定支持386,因为686rpm包它有对平台做优化,那386就不一定支持
noarch 支持任意平台


.rpm 红帽包管理 red hat packages management



rpm -ivh yum-3.2.22-20.el5.noarch.rpm
-i 安装
-v 看它的安装过程
-h hash校验



[root@li /]# rpm -ivh /mnt/Server/yum-3.2.22-20.el5.noarch.rpm
warning: /mnt/Server/yum-3.2.22-20.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package yum-3.2.22-20.el5.noarch is already installed
--这表示已经安装过此包


[root@li /]# rpm -ivh /mnt/Server/bind-9.3.6-4.P1.el5.i386.rpm
warning: /mnt/Server/bind-9.3.6-4.P1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:bind ########################################### [100%]
--成功安装一个包


[root@li rac5.3]# rpm -ivh ocfs2-2.6.18-128.el5-1.2.9-1.el5.i686.rpm
warning: ocfs2-2.6.18-128.el5-1.2.9-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: Failed dependencies:
ocfs2-tools >= 1.2.6 is needed by ocfs2-2.6.18-128.el5-1.2.9-1.el5.i686
--rpm包是有依赖性的,要先装提示需要的包,如果上级包还有依赖性,还得再往上层装


[root@li rac5.3]# rpm -ivh ocfs2*
warning: ocfs2-2.6.18-128.el5-1.2.9-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: Failed dependencies:
kernel-debug = 2.6.18-128.el5 is needed by ocfs2-2.6.18-128.el5debug-1.2.9-1.el5.i686
kernel-PAE = 2.6.18-128.el5 is needed by ocfs2-2.6.18-128.el5PAE-1.2.9-1.el5.i686
kernel-xen = 2.6.18-128.el5 is needed by ocfs2-2.6.18-128.el5xen-1.2.9-1.el5.i686
--支持通配符,一次装多个


------
出现冲突的情况下
报错里有conflict关键字的时候,就是冲突了,要先干掉冲突的包,再安装新包



如何知道我现在安装了哪些rpm包
linux系统是有一个rpm数据库专门存放安装过的rpm包的信息
保存在 /var/lib/rpm




[root@li rac5.3]# rpm -qa --列出rpm数据库的信息,也就是说列出你现在安装过了哪些rpm包,注意:这里只能查找rpm包,不能查找安装的源码包


干掉一个包的过程:
[root@li rac5.3]# rpm -qa |grep bind
bind-utils-9.3.6-4.P1.el5
bind-9.3.6-4.P1.el5
bind-libs-9.3.6-4.P1.el5
ypbind-1.19-12.el5
[root@li rac5.3]# rpm -e bind-9.3.6-4.P1.el5 --注意删除一个包时不能用包的全名
[root@li rac5.3]# rpm -qa |grep bind
bind-utils-9.3.6-4.P1.el5
bind-libs-9.3.6-4.P1.el5
ypbind-1.19-12.el5


[root@li rac5.3]# rpm -ql ypbind-1.19-12.el5 --查看一个包安装了哪些文件
/etc/rc.d/init.d/ypbind
/etc/yp.conf
/sbin/ypbind
/usr/share/doc/ypbind-1.19
/usr/share/doc/ypbind-1.19/NEWS
/usr/share/doc/ypbind-1.19/README
/usr/share/locale/de/LC_MESSAGES/ypbind.mo
/usr/share/man/man5/yp.conf.5.gz
/usr/share/man/man8/ypbind.8.gz
/var/yp
/var/yp/binding



[root@li rac5.3]# which mount
/bin/mount
[root@li rac5.3]# rpm -qf /bin/mount --查找一个文件是属于哪个包
util-linux-2.13-0.52.el5




[root@li rac5.3]# rpm -ql bind-9.3.6-4.P1.el5.i386.rpm --查找一个未安装的包安装后有哪些文件,用-ql是不行的
package bind-9.3.6-4.P1.el5.i386.rpm is not installed

[root@li Server]# rpm -qpl bind-9.3.6-4.P1.el5.i386.rpm --要多加一个-p的参数
warning: bind-9.3.6-4.P1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
/etc/dbus-1/system.d/named.conf
/etc/logrotate.d/named
/etc/named.conf
/etc/rc.d/init.d/named
/etc/rndc.conf
/etc/rndc.key
.................


[root@li Server]#rpm -qpi yum-versionlock-1.1.16-13.el5.noarch.rpm --查看一个未安装的包的信息(干嘛用的)

warning: yum-versionlock-1.1.16-13.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Name : yum-versionlock Relocations: (not relocatable)
Version : 1.1.16 Vendor: Red Hat, Inc.
Release : 13.el5 Build Date: Wed 26 Nov 2008 07:08:46 AM CST
Install Date: (not installed) Build Host: natasha.build.redhat.com
Group : System Environment/Base Source RPM: yum-utils-1.1.16-13.el5.src.rpm
Size : 9899 License: GPLv2+
Signature : DSA/SHA1, Fri 12 Dec 2008 09:21:18 PM CST, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://linux.duke.edu/yum/download/yum-utils/
Summary : Yum plugin to lock specified packages from being updated
Description :
This plugin takes a set of name/versions for packages and excludes all other
versions of those packages (including optionally following obsoletes). This
allows you to protect packages from being updated by newer versions,
for example.


[root@li Server]# rpm -qi db4-4.3.29-10.el5 --查看一个已安装的包的信息

Name : db4 Relocations: (not relocatable)
Version : 4.3.29 Vendor: Red Hat, Inc.
Release : 10.el5 Build Date: Thu 19 Feb 2009 11:08:18 PM CST
Install Date: Sat 27 Mar 2010 03:04:29 AM CST Build Host: hs20-bc2-5.build.redhat.com
Group : System Environment/Libraries Source RPM: db4-4.3.29-10.el5.src.rpm
Size : 2124994 License: GPL
Signature : DSA/SHA1, Thu 19 Mar 2009 11:39:24 PM CST, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://www.sleepycat.com/
Summary : The Berkeley DB database library (version 4) for C.
Description :
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. The Berkeley DB includes B+tree, Extended
Linear Hashing, Fixed and Variable-length record access methods,
transactions, locking, logging, shared memory caching, and database
recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
used by many applications, including Python and Perl, so this should
be installed on all systems.


--------------------------------------------
另外一些不太常用的参数介绍


[root@li Server]# rpm -qpc samba-3.0.33-3.14.el5.i386.rpm
warning: samba-3.0.33-3.14.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
/etc/logrotate.d/samba
/etc/pam.d/samba
/etc/rc.d/init.d/smb
/etc/samba/smbusers
/etc/sysconfig/samba


rpm -qd 找帮助文件
rpm -qpd samba-3.0.33-3.14.el5.i386.rpm


-----------------------------------------------------------

rpm -ivh 安装

rpm -ivh --nodeps 脱离依赖性 但是包不一定能用
rpm -ivh --nomd5 不检验md5值
rpm -ivh --noscripts 不想启用或者自动执行某些命令
rpm -ivh --replacefiles 某个文件已经安装在系统上,或者冲突,可以用此参数覆盖 注意:此操作无法复原
rpm -ivh --replacepkgs 重新安装某个已经安装过的包,比如说一个包你修改过,但不知道改在哪里,可以这样重新安装
rpm -ivh --force 相当是强制安装,是--replacefiles和--replacepkgs
rpm -ivh --test 测试是否能安装到此linux系统中



-------------------------------------------------------------------------------


cacti-0.8.7b-1.fc8.src.rpm
这种包是需要重编译
rpm 源码包,根据你的硬件情况编译成适合你的系统的rpm安装包


[root@li cacti]# rpmbuild --rebuild cacti-0.8.7b-1.fc8.src.rpm


Wrote: /usr/src/redhat/RPMS/noarch/cacti-0.8.7b-1.noarch.rpm --提示时

[root@li noarch]# rpm -ivh cacti-0.8.7b-1.noarch.rpm




[root@li noarch]# rpmbuild --rebuild /share/soft/iscsi/iscsitarget-0.4.13-2fc5.src.rpm


Wrote: /usr/src/redhat/RPMS/i386/iscsitarget-0.4.13-2.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/dkms-iscsi_trgt-0.4.13-2.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/iscsitarget-debuginfo-0.4.13-2.i386.rpm



---------------------------------------------------------------------------

源码包的安装

[root@li noarch]# tar xvf /share/soft/soft/arp-scan/arp-scan-1.6.tar.gz -C /usr/src/
--解压到/usr/src下

[root@li arp-scan-1.6]# ls --确认有configure文件的才能进行编译
acinclude.m4 config.guess getopt1.c INSTALL mt19937ar.c
aclocal.m4 config.h.in getopt.c install-sh NEWS
arp-fingerprint config.sub getopt.h link-bpf.c obstack.c
arp-fingerprint.1 configure(--确认有此文件) get-oui link-dlpi.c obstack.h
arp-scan.1 configure.ac get-oui.1 link-packet-socket.c README
arp-scan.c COPYING hash.c mac-vendor.5 strlcat.c
arp-scan.h depcomp hash.h mac-vendor.txt strlcpy.c
AUTHORS error.c ieee-iab.txt Makefile.am TODO
ChangeLog get-iab ieee-oui.txt Makefile.in utils.c
check-run1 get-iab.1 inet_aton.c missing wrappers.c


用rpm -ivh 装libpcap-devel包 --因为安装arp-scan这个包的./configure检测时需要,不安装会报错


[root@li arp-scan-1.6]# rpm -ivh /mnt/Server/libpcap-devel-0.9.4-14.el5.i386.rpm
warning: /mnt/Server/libpcap-devel-0.9.4-14.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:libpcap-devel ########################################### [100%]


[root@li arp-scan-1.6]# ./configure
[root@li arp-scan-1.6]# make
[root@li arp-scan-1.6]# make install


[root@li arp-scan-1.6]# arp-scan -l --使用这个扫描内网所有主机信息


-----------------------------------------------------------
支持ntfs安装 (要安装两个包 一个fuse包,一个ntfs-3g的包)



[root@li arp-scan-1.6]# tar xvf /share/soft/ntfs/fuse-2.7.4.tar.gz -C /usr/src/
[root@li arp-scan-1.6]# tar xvf /share/soft/ntfs/ntfs-3g-2009.4.4.tgz -C /usr/src/

安装一个源码包的过程:
1,解压到一个目录
2,cd到这个目录,并查看readme,install,FAQ等文件了解安装方法
3,make clean --清除一些编译信息,使之成为干净的源码
4,./configure --根据你指定的参数,对编译进行行为控制,产生符合要求的程序,相当是一个检查程序,检查通过会产生makefile文件
./configure --help 查找编译参数
./configure --help > /fusehelp.txt
5.make --根据产生的makefile进行源码编译
6.make install --把产生的文件安装到需要的地方

增加fuse这个模块
[root@li fuse-2.7.4]# lsmod |grep fuse
[root@li fuse-2.7.4]# modprobe fuse
[root@li fuse-2.7.4]# lsmod |grep fuse
fuse 49237 0




再安装ntfs-3g的包
[root@li fuse-2.7.4]# cd ../ntfs-3g-2009.4.4/ --cd到ntfs-3g包的目录里


[root@li ntfs-3g-2009.4.4]# ./configure; make; make install --三条命令一起写执行编译过程


[root@li ntfs-3g-2009.4.4]# mount --编译安装成功后会看到mount.ntfs-3g命令
mount mount.fuse mount.nfs4 mountpoint
mount.cifs mount.nfs mount.ntfs-3g



[root@li ntfs-3g-2009.4.4]# mount.ntfs-3g /dev/sdb2 /media/ --使用方法挂载ntfs格式分区


--------------------------------------------------------

特殊的包的安装:

二进制包
RealPlayer11GOLD.bin
安装方法为:./RealPlayer11GOLD.bin 直接安装
装完后直接用realplay命令启用图形安装 一直点下一步就OK


还有一种特殊的包就是没有安装文件
解压后会看到有一个install.sh 直接运行安装脚本就可以安装了




-------------------------------------------


编译的过程

[root@li html]# vim hello.c --编写一个简单的c语言程序
#include <stdio.h>
int main (void)
{
printf("hello world/n");
}

[root@li html]# gcc hello.c --gcc编译出一个默认的叫a.out的二进制文件

[root@li html]# ./a.out --运行a.out会产生hello world的结果
hello world


[root@li html]# gcc hello.c -o hello.o --用gcc编译器指定产生一个hello.o的目标文件


[root@li html]# ./hello.o --运行它会产生hello world的结果
hello world



函数库

静态函数库与动态函数库



静态函数库 libxxxxx.a
编译时直接编译到执行文件中,生成的文件会相对大一点,编译成功后可以直接执行


动态函数库 libxxxxx.so
编译时没有编译到执行文件中,只是加了一个路径或者指向,去动态的调用它,生成的文件相对会小一点,如果动态函数不存在或者路径发生变化,执行不了



ldconfig 对应 /etc/ld.so.conf

使用ldconfig命令会将其配置的目录读入cache,就能使用配置目录的函数库

[root@li html]# ldconfig -p |head
650 libs found in cache `/etc/ld.so.cache'
libz.so.1 (libc6) => /usr/lib/libz.so.1
libz.so (libc6) => /usr/lib/libz.so
libxslt.so.1 (libc6) => /usr/lib/libxslt.so.1
libxslt.so (libc6) => /usr/lib/libxslt.so
libxml2.so.2 (libc6) => /usr/lib/libxml2.so.2
libxml2.so (libc6) => /usr/lib/libxml2.so
libxmlsec1.so.1 (libc6) => /usr/lib/libxmlsec1.so.1
libxmlsec1.so (libc6) => /usr/lib/libxmlsec1.so
libxklavier.so.11 (libc6) => /usr/lib/libxklavier.so.11


作业题:
1,新建两个分区,一个20G用来装笔记和资料,一个50G用来放虚拟机,分别挂载到目录,并设定/etc/fstab文件让其开机后能自动挂载
2,确认安装好arp-scan和支持ntfs的软件,并尝试安装xlockmore和mplayer这两个软件





















  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值