Linux training class
===============================================================================================
RPM 资源库
[julia@oc2365548284 Desktop]$ cd /var/lib/rpm
[julia@oc2365548284 rpm]$ ls -rtl
total 119360
-rw-r--r--. 1 root root 12288 Jul 11 2012 Pubkeys
-rw-r--r--. 1 root root 12288 Jun 15 10:07 Triggername
-rw-r--r--. 1 root root 40960 Jun 15 10:08 Obsoletename
-rw-r--r--. 1 root root 12288 Jun 15 10:08 Conflictname
-rw-r--r--. 1 root root 97349632 Jun 15 10:10 Packages
-rw-r--r--. 1 root root 86016 Jun 15 10:10 Name
-rw-r--r--. 1 root root 10915840 Jun 15 10:10 Basenames
-rw-r--r--. 1 root root 40960 Jun 15 10:10 Group
-rw-r--r--. 1 root root 884736 Jun 15 10:10 Requirename
-rw-r--r--. 1 root root 1359872 Jun 15 10:10 Providename
-rw-r--r--. 1 root root 5079040 Jun 15 10:10 Dirnames
-rw-r--r--. 1 root root 438272 Jun 15 10:10 Requireversion
-rw-r--r--. 1 root root 905216 Jun 15 10:10 Provideversion
-rw-r--r--. 1 root root 32768 Jun 15 10:10 Installtid
-rw-r--r--. 1 root root 159744 Jun 15 10:10 Sigmd5
-rw-r--r--. 1 root root 172032 Jun 15 10:10 Sha1header
-rw-r--r--. 1 root root 10563584 Jun 15 10:10 Filedigests
[julia@oc2365548284 rpm]$ pwd
/var/lib/rpm
==================
rpm install
freshen:只升级已经安装了的包
upgrade:
===========remove 包
千万不要强制卸载包, 因为很多依赖关系
==========rpm 包查询
rpm -q package name
rpm -i package name :获取包的详细信息, 包的安装时间等
rpm -f package name :查这个包是哪里软件提供的, 来确定包的用处。
=========校验
rpm -V package name :来确定这个包是否被修改过。例如 恶意代码,凡是有改变的都会列出来。
====确定包的签名,保证包来源的合法性
[root@oc2365548284 ~]# rpm -qa |grep gpg
gpg-pubkey-1cddbca9-3f9da14c
gpg-pubkey-30c9ecf8-3f9da3f7
libgpg-error-1.7-4.el6.i686
gpg-pubkey-e418e3aa-3f439953
libgpg-error-devel-1.7-4.el6.x86_64
gpg-pubkey-0b86274e-48b5dd6f
gpg-pubkey-897da07a-3c979a7f
gpg-pubkey-d22e77f2-49ee1409
gpg-pubkey-c776ad20-3fb10b6d
gpg-pubkey-37017186-45761324
gpg-pubkey-f613cbe8-483c6049
gpg-pubkey-2fa658e0-45700c69
gpgme-1.1.8-3.el6.x86_64
gpg-pubkey-0608b895-4bd22942
gpg-pubkey-df9b0ae9-48b5da95
gpg-pubkey-db42a60e-37ea5438
gpg-pubkey-57bbccba-4a6f97af
gpg-pubkey-7076f75f-3fde7f43
gpg-pubkey-42193e6b-4624eff2
ibm-gpg-keys-6-6.el6.noarch
gpg-pubkey-f21541eb-4a5233e7
pygpgme-0.1-18.20090824bzr68.el6.x86_64
gpg-pubkey-4ebfc273-48b5dbf3
gpg-pubkey-fd431d51-4ae0493b
libgpg-error-1.7-4.el6.x86_64
gpg-pubkey-6df2196f-48b5d596
[root@oc2365548284 ~]#
rpm --import 把key加进系统,才能安装以上包。才能认为他们是合法的。
拿到包以后,可以校验一下,系统中是否有这样的public key
rpm --import /mnt/cdrom/RPM-key-name
rpm --checksig passwd-064------ ,如果没有安装key会提示这个没有---
必须把key导进系统。
===========没有支持平台的pack,
可以利用源代码,来自己编译再进行安装
application.src.rpm--源码rpm包 红帽的源码rpm包,有了这个就可以编译出各种平台的rpm 二进制安装包,必须在你要编译的系统上进行编译。
rpmbuild -bb on i386
====rpm包产生过程
rpm -qR pack name :显示包的依赖关系
=====rpm -qa |grep 查不了了
如果rpm -qa |grep 查不了了, 说明rpm库有问题。 都删掉,
恢复:man rpm 查看一下找到那个恢复的选项。
[root@oc2365548284 rpm]# ls -rtl
total 121476
-rw-r--r--. 1 root root 12288 Jul 11 2012 Pubkeys
-rw-r--r--. 1 root root 12288 Jun 15 10:07 Triggername
-rw-r--r--. 1 root root 40960 Jun 15 10:08 Obsoletename
-rw-r--r--. 1 root root 12288 Jun 15 10:08 Conflictname
-rw-r--r--. 1 root root 97349632 Jun 15 10:10 Packages
-rw-r--r--. 1 root root 86016 Jun 15 10:10 Name
-rw-r--r--. 1 root root 10915840 Jun 15 10:10 Basenames
-rw-r--r--. 1 root root 40960 Jun 15 10:10 Group
-rw-r--r--. 1 root root 884736 Jun 15 10:10 Requirename
-rw-r--r--. 1 root root 1359872 Jun 15 10:10 Providename
-rw-r--r--. 1 root root 5079040 Jun 15 10:10 Dirnames
-rw-r--r--. 1 root root 438272 Jun 15 10:10 Requireversion
-rw-r--r--. 1 root root 905216 Jun 15 10:10 Provideversion
-rw-r--r--. 1 root root 32768 Jun 15 10:10 Installtid
-rw-r--r--. 1 root root 159744 Jun 15 10:10 Sigmd5
-rw-r--r--. 1 root root 172032 Jun 15 10:10 Sha1header
-rw-r--r--. 1 root root 10563584 Jun 15 10:10 Filedigests
-rw-r--r--. 1 root root 24576 Jun 18 12:15 __db.001
-rw-r--r--. 1 root root 753664 Jun 18 12:15 __db.004
-rw-r--r--. 1 root root 1318912 Jun 18 12:15 __db.003
-rw-r--r--. 1 root root 237568 Jun 18 12:15 __db.002
[root@oc2365548284 rpm]# pwd
/var/lib/rpm
[root@oc2365548284 rpm]#
rpm --rebuilddb
======图形工作站
两个机器之间的信任问题
图像显示的地方,
export DISPLAY=localhost:0.0
ssh -X 172.16.28.218 :就可以把远程的图形界面显示在本地。把图形窗口显示在其他有图形的工作站上。
===log
klogd --for kernel
syslogd ---for system and user
======
/etc/syslog.conf
[root@oc2365548284 ~]# /etc/init.d/rsyslog status
rsyslogd (pid 2155) is running...
[root@oc2365548284 ~]# ps -ef |grep syslog
root 2155 1 0 14:55 ? 00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
julia 3773 1 0 14:56 ? 00:00:00 /usr/bin/pulseaudio --start --log-target=syslog
root 11596 11166 0 15:22 pts/0 00:00:00 grep syslog
[root@oc2365548284 ~]#
有的系统用的是syslog
logger -p daemon.info this is a test
==log rotate
[root@oc2365548284 ~]# cd /etc/logrotate.d
[root@oc2365548284 logrotate.d]# ls
cups dracut firewall httpd iscsiuiolog libvirtd libvirtd.lxc libvirtd.qemu ppp psacct samba sav syslog wpa_supplicant yum
[root@oc2365548284 logrotate.d]# ls -rtl
total 60
-rw-r--r--. 1 root root 136 Mar 5 2010 ppp
-rw-r--r--. 1 root root 329 Jul 10 2012 psacct
-rw-r--r--. 1 root root 49 Sep 17 2012 firewall
-rw-r--r--. 1 root root 173 Oct 23 2012 iscsiuiolog
-rw-r--r--. 1 root root 100 Oct 25 2012 wpa_supplicant
-rw-r--r--. 1 root root 115 Dec 17 2012 samba
-rw-r--r--. 1 root root 100 Jan 9 01:02 yum
-rw-r--r--. 1 root root 103 Jan 9 21:34 dracut
-rw-r--r--. 1 root root 210 Jan 10 00:43 syslog
-rw-r--r--. 1 root root 71 Feb 26 18:12 cups
-rwxr-xr-x. 1 root root 72 Mar 8 22:45 sav
-rw-r--r--. 1 root root 185 Apr 29 16:09 httpd
-rw-r--r--. 1 root root 163 May 3 17:59 libvirtd.qemu
-rw-r--r--. 1 root root 162 May 3 17:59 libvirtd.lxc
-rw-r--r--. 1 root root 165 May 3 17:59 libvirtd
man logrotate
CONFIGURATION FILE
logrotate reads everything about the log files it should be handling from the series of configuration files specified on the com-
mand line. Each configuration file can set global options (local definitions override global ones, and later definitions override
earlier ones) and specify logfiles to rotate. A simple configuration file looks like this:
# sample logrotate configuration file
compress
/var/log/messages {
rotate 5
weekly
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
===文件被压缩了后, 怎么查看。
zgrep 和 grep 一样,但是搜索的是压缩的log文件,
===网卡设备
[root@oc2365548284 ~]# cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 2336 32 0 0 0 0 0 0 2336 32 0 0 0 0 0 0
eth0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
wlan0:41394184 112355 0 0 0 0 0 0 3558426 26590 0 0 0 0 0 0
pan0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
virbr0: 0 0 0 0 0 0 0 0 3906 27 0 0 0 0 0 0
virbr0-nic: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
tunsk: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
=============
dd if=/dev/zero of =/tmp/swapfile bs=1M count=32
mkswap /tmp/swapfile
swapon -s
==========usb 设备
[root@oc2365548284 ~]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 001 Device 004: ID 04f2:b221 Chicony Electronics Co., Ltd integrated camera
Bus 002 Device 003: ID 046d:c05b Logitech, Inc. M-U0004 810-001317 [B110 Optical USB Mouse]
Bus 002 Device 004: ID 17ef:1003 Lenovo Integrated Smart Card Reader
lsudb -v :可以查看详细信息
===========总线设备
[root@oc2365548284 ~]# lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GF119 [Quadro NVS 4200M] (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)
0d:00.0 System peripheral: Ricoh Co Ltd MMC/SD Host Controller (rev 08)
[root@oc2365548284 ~]#
=========块设备
传输的大小就是以512字节为单位进行传输。一个block就是512字节。
动态的设备命名方式
udev 实时命名,硬盘移除后, 设备名自然消失
ram disk
[root@oc2365548284 dev]# ls -rtl |grep ram
brw-rw----. 1 root disk 1, 15 Jun 19 09:37 ram15
brw-rw----. 1 root disk 1, 7 Jun 19 09:37 ram7
brw-rw----. 1 root disk 1, 13 Jun 19 09:37 ram13
brw-rw----. 1 root disk 1, 1 Jun 19 09:37 ram1
brw-rw----. 1 root disk 1, 0 Jun 19 09:37 ram0
brw-rw----. 1 root disk 1, 6 Jun 19 09:37 ram6
brw-rw----. 1 root disk 1, 10 Jun 19 09:37 ram10
brw-rw----. 1 root disk 1, 4 Jun 19 09:37 ram4
brw-rw----. 1 root disk 1, 12 Jun 19 09:37 ram12
brw-rw----. 1 root disk 1, 14 Jun 19 09:37 ram14
brw-rw----. 1 root disk 1, 11 Jun 19 09:37 ram11
brw-rw----. 1 root disk 1, 5 Jun 19 09:37 ram5
brw-rw----. 1 root disk 1, 3 Jun 19 09:37 ram3
brw-rw----. 1 root disk 1, 2 Jun 19 09:37 ram2
brw-rw----. 1 root disk 1, 8 Jun 19 09:37 ram8
brw-rw----. 1 root disk 1, 9 Jun 19 09:37 ram9
crw-r-----. 1 root kmem 10, 144 Jun 19 2013 nvram
[root@oc2365548284 dev]#
=============loop 设备
光驱镜像
mount -o loop,ro xxxxxxxxxxx.iso /media/cdrom
losetup -a :列出系统中的loop设备
==========LVM
只要是块设备的东西都可以加到vg中 ,
磁盘分区partition 是分512字节(一个扇区),vg是重新在这个基础上再分区(4M一个单位或者16M,只要是4M的倍数)
系统硬盘必须分出一个boot分区出来
=======
pvcreate /dev/sda3 的过程其实是什么都不干,只是把这个分区标记成lvm的磁盘
vgcreate vg00 /dev/sdba /dev/sdb , 格式化成4M
lvcreate -L 500M -n lv00 vg00
pvdisplay
pvs
pvmove /
pvremove :pv 标志去掉
vgcreate
vgremove
vgdisplay
vgextend
vgreduce
===vg的备份信息==在vg不能激活的时候, 要查看是不是需要恢复vg data信息
用于恢复vg,如果因为vgda损坏的话
[root@oc2365548284 backup]# pwd
/etc/lvm/backup
[root@oc2365548284 backup]# ls -rtl
total 4
-rw-------. 1 root root 1859 Jul 15 2012 vg_oc0801412785
[root@oc2365548284 backup]#
vgcfbackup ====在更改vg前。把vg的配置信息配置起来
vgcfrestore -n vg_name pv
=============device mapper
====memory
32位最大支持4G内存
64位
====系统真正挂在的文件系统
[root@oc2365548284 ~]# more /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0
/dev/mapper/vg_oc0801412785-lv_root / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /selinux selinuxfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
cgroup /cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cgroup /cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /cgroup/memory cgroup rw,relatime,memory 0 0
cgroup /cgroup/devices cgroup rw,relatime,devices 0 0
cgroup /cgroup/freezer cgroup rw,relatime,freezer 0 0
cgroup /cgroup/net_cls cgroup rw,relatime,net_cls 0 0
cgroup /cgroup/blkio cgroup rw,relatime,blkio 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
[root@oc2365548284 ~]#
===
[root@oc2365548284 ~]# more /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0
/dev/mapper/vg_oc0801412785-lv_root / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /selinux selinuxfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
cgroup /cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cgroup /cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /cgroup/memory cgroup rw,relatime,memory 0 0
cgroup /cgroup/devices cgroup rw,relatime,devices 0 0
cgroup /cgroup/freezer cgroup rw,relatime,freezer 0 0
cgroup /cgroup/net_cls cgroup rw,relatime,net_cls 0 0
cgroup /cgroup/blkio cgroup rw,relatime,blkio 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
[root@oc2365548284 ~]#
====================
ps axu |sort -nr -k4 安装第四列排序
===================PAM
[root@pn1cfe03 pam.d]# pwd
/etc/pam.d
[root@pn1cfe03 pam.d]#
====粘贴位权限
t 针对目录而言 :只有这个文件的owner对这个文件有更改的权限。
[root@pn1cfe03 security]# ls -ld /tmp
drwxrwxrwt 5 root root 4096 Jun 21 14:42 /tmp
4755 加suid 加粘帖位。ower的权限
2755 sgid 粘帖位 。group的权限
1755 soid other的权限
====sudo
最好用visudo去该 ;因为用visudo的时候保存时,如果有错误的语法会显示出来
===============================================================================================
RPM 资源库
[julia@oc2365548284 Desktop]$ cd /var/lib/rpm
[julia@oc2365548284 rpm]$ ls -rtl
total 119360
-rw-r--r--. 1 root root 12288 Jul 11 2012 Pubkeys
-rw-r--r--. 1 root root 12288 Jun 15 10:07 Triggername
-rw-r--r--. 1 root root 40960 Jun 15 10:08 Obsoletename
-rw-r--r--. 1 root root 12288 Jun 15 10:08 Conflictname
-rw-r--r--. 1 root root 97349632 Jun 15 10:10 Packages
-rw-r--r--. 1 root root 86016 Jun 15 10:10 Name
-rw-r--r--. 1 root root 10915840 Jun 15 10:10 Basenames
-rw-r--r--. 1 root root 40960 Jun 15 10:10 Group
-rw-r--r--. 1 root root 884736 Jun 15 10:10 Requirename
-rw-r--r--. 1 root root 1359872 Jun 15 10:10 Providename
-rw-r--r--. 1 root root 5079040 Jun 15 10:10 Dirnames
-rw-r--r--. 1 root root 438272 Jun 15 10:10 Requireversion
-rw-r--r--. 1 root root 905216 Jun 15 10:10 Provideversion
-rw-r--r--. 1 root root 32768 Jun 15 10:10 Installtid
-rw-r--r--. 1 root root 159744 Jun 15 10:10 Sigmd5
-rw-r--r--. 1 root root 172032 Jun 15 10:10 Sha1header
-rw-r--r--. 1 root root 10563584 Jun 15 10:10 Filedigests
[julia@oc2365548284 rpm]$ pwd
/var/lib/rpm
==================
rpm install
freshen:只升级已经安装了的包
upgrade:
===========remove 包
千万不要强制卸载包, 因为很多依赖关系
==========rpm 包查询
rpm -q package name
rpm -i package name :获取包的详细信息, 包的安装时间等
rpm -f package name :查这个包是哪里软件提供的, 来确定包的用处。
=========校验
rpm -V package name :来确定这个包是否被修改过。例如 恶意代码,凡是有改变的都会列出来。
====确定包的签名,保证包来源的合法性
[root@oc2365548284 ~]# rpm -qa |grep gpg
gpg-pubkey-1cddbca9-3f9da14c
gpg-pubkey-30c9ecf8-3f9da3f7
libgpg-error-1.7-4.el6.i686
gpg-pubkey-e418e3aa-3f439953
libgpg-error-devel-1.7-4.el6.x86_64
gpg-pubkey-0b86274e-48b5dd6f
gpg-pubkey-897da07a-3c979a7f
gpg-pubkey-d22e77f2-49ee1409
gpg-pubkey-c776ad20-3fb10b6d
gpg-pubkey-37017186-45761324
gpg-pubkey-f613cbe8-483c6049
gpg-pubkey-2fa658e0-45700c69
gpgme-1.1.8-3.el6.x86_64
gpg-pubkey-0608b895-4bd22942
gpg-pubkey-df9b0ae9-48b5da95
gpg-pubkey-db42a60e-37ea5438
gpg-pubkey-57bbccba-4a6f97af
gpg-pubkey-7076f75f-3fde7f43
gpg-pubkey-42193e6b-4624eff2
ibm-gpg-keys-6-6.el6.noarch
gpg-pubkey-f21541eb-4a5233e7
pygpgme-0.1-18.20090824bzr68.el6.x86_64
gpg-pubkey-4ebfc273-48b5dbf3
gpg-pubkey-fd431d51-4ae0493b
libgpg-error-1.7-4.el6.x86_64
gpg-pubkey-6df2196f-48b5d596
[root@oc2365548284 ~]#
rpm --import 把key加进系统,才能安装以上包。才能认为他们是合法的。
拿到包以后,可以校验一下,系统中是否有这样的public key
rpm --import /mnt/cdrom/RPM-key-name
rpm --checksig passwd-064------ ,如果没有安装key会提示这个没有---
必须把key导进系统。
===========没有支持平台的pack,
可以利用源代码,来自己编译再进行安装
application.src.rpm--源码rpm包 红帽的源码rpm包,有了这个就可以编译出各种平台的rpm 二进制安装包,必须在你要编译的系统上进行编译。
rpmbuild -bb on i386
====rpm包产生过程
rpm -qR pack name :显示包的依赖关系
=====rpm -qa |grep 查不了了
如果rpm -qa |grep 查不了了, 说明rpm库有问题。 都删掉,
恢复:man rpm 查看一下找到那个恢复的选项。
[root@oc2365548284 rpm]# ls -rtl
total 121476
-rw-r--r--. 1 root root 12288 Jul 11 2012 Pubkeys
-rw-r--r--. 1 root root 12288 Jun 15 10:07 Triggername
-rw-r--r--. 1 root root 40960 Jun 15 10:08 Obsoletename
-rw-r--r--. 1 root root 12288 Jun 15 10:08 Conflictname
-rw-r--r--. 1 root root 97349632 Jun 15 10:10 Packages
-rw-r--r--. 1 root root 86016 Jun 15 10:10 Name
-rw-r--r--. 1 root root 10915840 Jun 15 10:10 Basenames
-rw-r--r--. 1 root root 40960 Jun 15 10:10 Group
-rw-r--r--. 1 root root 884736 Jun 15 10:10 Requirename
-rw-r--r--. 1 root root 1359872 Jun 15 10:10 Providename
-rw-r--r--. 1 root root 5079040 Jun 15 10:10 Dirnames
-rw-r--r--. 1 root root 438272 Jun 15 10:10 Requireversion
-rw-r--r--. 1 root root 905216 Jun 15 10:10 Provideversion
-rw-r--r--. 1 root root 32768 Jun 15 10:10 Installtid
-rw-r--r--. 1 root root 159744 Jun 15 10:10 Sigmd5
-rw-r--r--. 1 root root 172032 Jun 15 10:10 Sha1header
-rw-r--r--. 1 root root 10563584 Jun 15 10:10 Filedigests
-rw-r--r--. 1 root root 24576 Jun 18 12:15 __db.001
-rw-r--r--. 1 root root 753664 Jun 18 12:15 __db.004
-rw-r--r--. 1 root root 1318912 Jun 18 12:15 __db.003
-rw-r--r--. 1 root root 237568 Jun 18 12:15 __db.002
[root@oc2365548284 rpm]# pwd
/var/lib/rpm
[root@oc2365548284 rpm]#
rpm --rebuilddb
======图形工作站
两个机器之间的信任问题
图像显示的地方,
export DISPLAY=localhost:0.0
ssh -X 172.16.28.218 :就可以把远程的图形界面显示在本地。把图形窗口显示在其他有图形的工作站上。
===log
klogd --for kernel
syslogd ---for system and user
======
/etc/syslog.conf
[root@oc2365548284 ~]# /etc/init.d/rsyslog status
rsyslogd (pid 2155) is running...
[root@oc2365548284 ~]# ps -ef |grep syslog
root 2155 1 0 14:55 ? 00:00:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
julia 3773 1 0 14:56 ? 00:00:00 /usr/bin/pulseaudio --start --log-target=syslog
root 11596 11166 0 15:22 pts/0 00:00:00 grep syslog
[root@oc2365548284 ~]#
有的系统用的是syslog
logger -p daemon.info this is a test
==log rotate
[root@oc2365548284 ~]# cd /etc/logrotate.d
[root@oc2365548284 logrotate.d]# ls
cups dracut firewall httpd iscsiuiolog libvirtd libvirtd.lxc libvirtd.qemu ppp psacct samba sav syslog wpa_supplicant yum
[root@oc2365548284 logrotate.d]# ls -rtl
total 60
-rw-r--r--. 1 root root 136 Mar 5 2010 ppp
-rw-r--r--. 1 root root 329 Jul 10 2012 psacct
-rw-r--r--. 1 root root 49 Sep 17 2012 firewall
-rw-r--r--. 1 root root 173 Oct 23 2012 iscsiuiolog
-rw-r--r--. 1 root root 100 Oct 25 2012 wpa_supplicant
-rw-r--r--. 1 root root 115 Dec 17 2012 samba
-rw-r--r--. 1 root root 100 Jan 9 01:02 yum
-rw-r--r--. 1 root root 103 Jan 9 21:34 dracut
-rw-r--r--. 1 root root 210 Jan 10 00:43 syslog
-rw-r--r--. 1 root root 71 Feb 26 18:12 cups
-rwxr-xr-x. 1 root root 72 Mar 8 22:45 sav
-rw-r--r--. 1 root root 185 Apr 29 16:09 httpd
-rw-r--r--. 1 root root 163 May 3 17:59 libvirtd.qemu
-rw-r--r--. 1 root root 162 May 3 17:59 libvirtd.lxc
-rw-r--r--. 1 root root 165 May 3 17:59 libvirtd
man logrotate
CONFIGURATION FILE
logrotate reads everything about the log files it should be handling from the series of configuration files specified on the com-
mand line. Each configuration file can set global options (local definitions override global ones, and later definitions override
earlier ones) and specify logfiles to rotate. A simple configuration file looks like this:
# sample logrotate configuration file
compress
/var/log/messages {
rotate 5
weekly
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
===文件被压缩了后, 怎么查看。
zgrep 和 grep 一样,但是搜索的是压缩的log文件,
===网卡设备
[root@oc2365548284 ~]# cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 2336 32 0 0 0 0 0 0 2336 32 0 0 0 0 0 0
eth0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
wlan0:41394184 112355 0 0 0 0 0 0 3558426 26590 0 0 0 0 0 0
pan0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
virbr0: 0 0 0 0 0 0 0 0 3906 27 0 0 0 0 0 0
virbr0-nic: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
tunsk: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
=============
dd if=/dev/zero of =/tmp/swapfile bs=1M count=32
mkswap /tmp/swapfile
swapon -s
==========usb 设备
[root@oc2365548284 ~]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 001 Device 004: ID 04f2:b221 Chicony Electronics Co., Ltd integrated camera
Bus 002 Device 003: ID 046d:c05b Logitech, Inc. M-U0004 810-001317 [B110 Optical USB Mouse]
Bus 002 Device 004: ID 17ef:1003 Lenovo Integrated Smart Card Reader
lsudb -v :可以查看详细信息
===========总线设备
[root@oc2365548284 ~]# lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GF119 [Quadro NVS 4200M] (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)
0d:00.0 System peripheral: Ricoh Co Ltd MMC/SD Host Controller (rev 08)
[root@oc2365548284 ~]#
=========块设备
传输的大小就是以512字节为单位进行传输。一个block就是512字节。
动态的设备命名方式
udev 实时命名,硬盘移除后, 设备名自然消失
ram disk
[root@oc2365548284 dev]# ls -rtl |grep ram
brw-rw----. 1 root disk 1, 15 Jun 19 09:37 ram15
brw-rw----. 1 root disk 1, 7 Jun 19 09:37 ram7
brw-rw----. 1 root disk 1, 13 Jun 19 09:37 ram13
brw-rw----. 1 root disk 1, 1 Jun 19 09:37 ram1
brw-rw----. 1 root disk 1, 0 Jun 19 09:37 ram0
brw-rw----. 1 root disk 1, 6 Jun 19 09:37 ram6
brw-rw----. 1 root disk 1, 10 Jun 19 09:37 ram10
brw-rw----. 1 root disk 1, 4 Jun 19 09:37 ram4
brw-rw----. 1 root disk 1, 12 Jun 19 09:37 ram12
brw-rw----. 1 root disk 1, 14 Jun 19 09:37 ram14
brw-rw----. 1 root disk 1, 11 Jun 19 09:37 ram11
brw-rw----. 1 root disk 1, 5 Jun 19 09:37 ram5
brw-rw----. 1 root disk 1, 3 Jun 19 09:37 ram3
brw-rw----. 1 root disk 1, 2 Jun 19 09:37 ram2
brw-rw----. 1 root disk 1, 8 Jun 19 09:37 ram8
brw-rw----. 1 root disk 1, 9 Jun 19 09:37 ram9
crw-r-----. 1 root kmem 10, 144 Jun 19 2013 nvram
[root@oc2365548284 dev]#
=============loop 设备
光驱镜像
mount -o loop,ro xxxxxxxxxxx.iso /media/cdrom
losetup -a :列出系统中的loop设备
==========LVM
只要是块设备的东西都可以加到vg中 ,
磁盘分区partition 是分512字节(一个扇区),vg是重新在这个基础上再分区(4M一个单位或者16M,只要是4M的倍数)
系统硬盘必须分出一个boot分区出来
=======
pvcreate /dev/sda3 的过程其实是什么都不干,只是把这个分区标记成lvm的磁盘
vgcreate vg00 /dev/sdba /dev/sdb , 格式化成4M
lvcreate -L 500M -n lv00 vg00
pvdisplay
pvs
pvmove /
pvremove :pv 标志去掉
vgcreate
vgremove
vgdisplay
vgextend
vgreduce
===vg的备份信息==在vg不能激活的时候, 要查看是不是需要恢复vg data信息
用于恢复vg,如果因为vgda损坏的话
[root@oc2365548284 backup]# pwd
/etc/lvm/backup
[root@oc2365548284 backup]# ls -rtl
total 4
-rw-------. 1 root root 1859 Jul 15 2012 vg_oc0801412785
[root@oc2365548284 backup]#
vgcfbackup ====在更改vg前。把vg的配置信息配置起来
vgcfrestore -n vg_name pv
=============device mapper
====memory
32位最大支持4G内存
64位
====系统真正挂在的文件系统
[root@oc2365548284 ~]# more /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0
/dev/mapper/vg_oc0801412785-lv_root / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /selinux selinuxfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
cgroup /cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cgroup /cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /cgroup/memory cgroup rw,relatime,memory 0 0
cgroup /cgroup/devices cgroup rw,relatime,devices 0 0
cgroup /cgroup/freezer cgroup rw,relatime,freezer 0 0
cgroup /cgroup/net_cls cgroup rw,relatime,net_cls 0 0
cgroup /cgroup/blkio cgroup rw,relatime,blkio 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
[root@oc2365548284 ~]#
===
[root@oc2365548284 ~]# more /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0
/dev/mapper/vg_oc0801412785-lv_root / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /selinux selinuxfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=3959048k,nr_inodes=989762,mode=755 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
cgroup /cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cgroup /cgroup/cpu cgroup rw,relatime,cpu 0 0
cgroup /cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
cgroup /cgroup/memory cgroup rw,relatime,memory 0 0
cgroup /cgroup/devices cgroup rw,relatime,devices 0 0
cgroup /cgroup/freezer cgroup rw,relatime,freezer 0 0
cgroup /cgroup/net_cls cgroup rw,relatime,net_cls 0 0
cgroup /cgroup/blkio cgroup rw,relatime,blkio 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2573,timeout=300,minproto=5,maxproto=5,indirect 0 0
[root@oc2365548284 ~]#
====================
ps axu |sort -nr -k4 安装第四列排序
===================PAM
[root@pn1cfe03 pam.d]# pwd
/etc/pam.d
[root@pn1cfe03 pam.d]#
====粘贴位权限
t 针对目录而言 :只有这个文件的owner对这个文件有更改的权限。
[root@pn1cfe03 security]# ls -ld /tmp
drwxrwxrwt 5 root root 4096 Jun 21 14:42 /tmp
4755 加suid 加粘帖位。ower的权限
2755 sgid 粘帖位 。group的权限
1755 soid other的权限
====sudo
最好用visudo去该 ;因为用visudo的时候保存时,如果有错误的语法会显示出来