1.在server主机中配置yum仓库,并安装gcc编辑器
[root@server yum.repos.d]# yum install gcc Loaded plugins: langpacks Server | 4.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package gcc.x86_64 0:4.8.2-16.el7 will be installed --> Processing Dependency: cpp = 4.8.2-16.el7 for package: gcc-4.8.2-16.el7.x86_64 --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.2-16.el7.x86_64 --> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.2-16.el7.x86_64 --> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.2-16.el7.x86_64 --> Running transaction check ---> Package cpp.x86_64 0:4.8.2-16.el7 will be installed ---> Package glibc-devel.x86_64 0:2.17-55.el7 will be installed --> Processing Dependency: glibc-headers = 2.17-55.el7 for package: glibc-devel-2.17-55.el7.x86_64 --> Processing Dependency: glibc-headers for package: glibc-devel-2.17-55.el7.x86_64 ---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed ---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed --> Running transaction check ---> Package glibc-headers.x86_64 0:2.17-55.el7 will be installed --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-55.el7.x86_64 --> Processing Dependency: kernel-headers for package: glibc-headers-2.17-55.el7.x86_64 --> Running transaction check ---> Package kernel-headers.x86_64 0:3.10.0-123.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: gcc x86_64 4.8.2-16.el7 Server 16 M Installing for dependencies: cpp x86_64 4.8.2-16.el7 Server 5.9 M glibc-devel x86_64 2.17-55.el7 Server 1.0 M glibc-headers x86_64 2.17-55.el7 Server 650 k kernel-headers x86_64 3.10.0-123.el7 Server 1.4 M libmpc x86_64 1.0.1-3.el7 Server 51 k mpfr x86_64 3.1.1-4.el7 Server 203 k Transaction Summary ================================================================================ Install 1 Package (+6 Dependent packages) Total download size: 25 M Installed size: 59 M Is this ok [y/d/N]: y Downloading packages: -------------------------------------------------------------------------------- Total 23 MB/s | 25 MB 00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mpfr-3.1.1-4.el7.x86_64 1/7 Installing : libmpc-1.0.1-3.el7.x86_64 2/7 Installing : cpp-4.8.2-16.el7.x86_64 3/7 Installing : kernel-headers-3.10.0-123.el7.x86_64 4/7 Installing : glibc-headers-2.17-55.el7.x86_64 5/7 Installing : glibc-devel-2.17-55.el7.x86_64 6/7 Installing : gcc-4.8.2-16.el7.x86_64 7/7 Verifying : mpfr-3.1.1-4.el7.x86_64 1/7 Verifying : glibc-headers-2.17-55.el7.x86_64 2/7 Verifying : glibc-devel-2.17-55.el7.x86_64 3/7 Verifying : libmpc-1.0.1-3.el7.x86_64 4/7 Verifying : kernel-headers-3.10.0-123.el7.x86_64 5/7 Verifying : gcc-4.8.2-16.el7.x86_64 6/7 Verifying : cpp-4.8.2-16.el7.x86_64 7/7 Installed: gcc.x86_64 0:4.8.2-16.el7 Dependency Installed: cpp.x86_64 0:4.8.2-16.el7 glibc-devel.x86_64 0:2.17-55.el7 glibc-headers.x86_64 0:2.17-55.el7 kernel-headers.x86_64 0:3.10.0-123.el7 libmpc.x86_64 0:1.0.1-3.el7 mpfr.x86_64 0:3.1.1-4.el7 Complete!2.在server主机中把/etc目录打包压缩到/mnt中,名字为etc.tar.gz
[root@server ~]# tar cf /mnt/etc.tar.gz /etc tar: Removing leading `/' from member names [root@server ~]# cd /mnt [root@server mnt]# ll total 30632 -rw-r--r--. 1 root root 31365120 Oct 25 07:18 etc.tar.gz3.复制server主机中的etc.tar.gz到desktop主机的/mnt中
[root@server mnt]# scp etc.tar.gz root@172.25.70.22:/mnt root@172.25.70.22's password: etc.tar.gz 100% 30MB 29.9MB/s 00:004.同步server主机中的/etc中的所有文件到desktop主机中的/mnt中,包含链接文件
[root@server ~]# rsync -rpogl /etc/ root@172.25.70.22:/mnt root@172.25.70.22's password: [root@client ~]# cd /mnt [root@client mnt]# ll total 32092 drwxr-xr-x. 3 root root 97 Oct 25 07:44 abrt -rw-r--r--. 1 root root 16 Oct 25 07:44 adjtime -rw-r--r--. 1 root root 1518 Oct 25 07:44 aliases -rw-r--r--. 1 root root 12288 Oct 25 07:44 aliases.db drwxr-xr-x. 2 root root 49 Oct 25 07:44 alsa drwxr-xr-x. 2 root root 4096 Oct 25 07:44 alternatives -rw-------. 1 root root 541 Oct 25 07:44 anacrontab -rw-r--r--. 1 root root 55 Oct 25 07:44 asound.conf -rw-r--r--. 1 root root 1 Oct 25 07:44 at.deny drwxr-xr-x. 2 root root 31 Oct 25 07:44 at-spi2 drwxr-x---. 3 root root 41 Oct 25 07:44 audisp drwxr-x---. 3 root root 79 Oct 25 07:44 audit drwxr-xr-x. 4 root root 94 Oct 25 07:44 avahi drwxr-xr-x. 2 root root 4096 Oct 25 07:44 bash_completion.d -rw-r--r--. 1 root root 2835 Oct 25 07:44 bashrc drwxr-xr-x. 2 root root 6 Oct 25 07:44 binfmt.d drwxr-xr-x. 2 root root 39 Oct 25 07:44 bluetooth drwxr-xr-x. 2 root root 41 Oct 25 07:44 bonobo-activation drwxr-xr-x. 2 root root 12288 Oct 25 07:44 brltty -rw-r--r--. 1 root root 21929 Oct 25 07:44 brltty.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 chkconfig.d -rw-r--r--. 1 root root 1157 Oct 25 07:44 chrony.conf -rw-r-----. 1 root chrony 62 Oct 25 07:44 chrony.keys drwxr-xr-x. 4 root root 56 Oct 25 07:44 cloud -rw-r--r--. 1 root root 1330 Oct 25 07:44 colord.conf drwxr-xr-x. 2 root root 72 Oct 25 07:44 cron.d drwxr-xr-x. 2 root root 88 Oct 25 07:44 cron.daily -rw-------. 1 root root 0 Oct 25 07:44 cron.deny drwxr-xr-x. 2 root root 44 Oct 25 07:44 cron.hourly drwxr-xr-x. 2 root root 6 Oct 25 07:44 cron.monthly -rw-r--r--. 1 root root 451 Oct 25 07:44 crontab drwxr-xr-x. 2 root root 6 Oct 25 07:44 cron.weekly -rw-------. 1 root root 0 Oct 25 07:44 crypttab -rw-r--r--. 1 root root 1602 Oct 25 07:44 csh.cshrc -rw-r--r--. 1 root root 841 Oct 25 07:44 csh.login drwxr-xr-x. 5 root lp 4096 Oct 25 07:44 cups drwxr-xr-x. 2 root root 33 Oct 25 07:44 cupshelpers drwxr-xr-x. 4 root root 74 Oct 25 07:44 dbus-1 drwxr-xr-x. 4 root root 29 Oct 25 07:44 dconf drwxr-xr-x. 2 root root 41 Oct 25 07:44 default drwxr-xr-x. 2 root root 22 Oct 25 07:44 depmod.d drwxr-x---. 3 root root 23 Oct 25 07:44 dhcp -rw-r--r--. 1 root root 5090 Oct 25 07:44 DIR_COLORS -rw-r--r--. 1 root root 5725 Oct 25 07:44 DIR_COLORS.256color -rw-r--r--. 1 root root 4669 Oct 25 07:44 DIR_COLORS.lightbgcolor -rw-r--r--. 1 root root 25213 Oct 25 07:44 dnsmasq.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 dnsmasq.d -rw-r--r--. 1 root root 1285 Oct 25 07:44 dracut.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 dracut.conf.d -rw-r--r--. 1 root root 3095 Oct 25 07:44 drirc -rw-r--r--. 1 root root 112 Oct 25 07:44 e2fsck.conf -rw-r--r--. 1 root root 4760 Oct 25 07:44 enscript.cfg -rw-r--r--. 1 root root 0 Oct 25 07:44 environment -rw-r--r--. 1 root root 31365120 Oct 25 07:22 etc.tar.gz -rw-r--r--. 1 root root 1317 Oct 25 07:44 ethertypes -rw-r--r--. 1 root root 0 Oct 25 07:44 exports drwxr-xr-x. 2 root root 6 Oct 25 07:44 exports.d lrwxrwxrwx. 1 root root 56 Oct 25 07:44 favicon.png -> /usr/share/icons/hicolor/16x16/apps/fedora-logo-icon.png drwxr-xr-x. 2 root root 21 Oct 25 07:44 fcoe drwxr-xr-x. 2 root root 44 Oct 25 07:44 festival -rw-r--r--. 1 root root 64 Oct 25 07:44 filesystems drwxr-x---. 5 root root 99 Oct 25 07:44 firewalld drwxr-xr-x. 3 root root 36 Oct 25 07:44 fonts -rw-r--r--. 1 root root 20 Oct 25 07:44 fprintd.conf -rw-r--r--. 1 root root 313 Oct 25 07:44 fstab -rw-r--r--. 1 root root 38 Oct 25 07:44 fuse.conf drwxr-xr-x. 7 root root 102 Oct 25 07:44 gconf drwxr-xr-x. 2 root root 6 Oct 25 07:44 gcrypt -rw-r--r--. 1 root root 265 Oct 25 07:44 gdbinit drwxr-xr-x. 2 root root 6 Oct 25 07:44 gdbinit.d drwxr-xr-x. 6 root root 101 Oct 25 07:44 gdm drwxr-xr-x. 3 root root 17 Oct 25 07:44 ghostscript drwxr-xr-x. 3 root root 19 Oct 25 07:44 gnome-settings-daemon drwxr-xr-x. 3 root root 20 Oct 25 07:44 gnome-vfs-2.0 drwxr-xr-x. 2 root root 6 Oct 25 07:44 gnupg -rw-r--r--. 1 root root 94 Oct 25 07:44 GREP_COLORS drwxr-xr-x. 4 root root 38 Oct 25 07:44 groff -rw-r--r--. 1 root root 863 Oct 25 07:44 group -rw-r--r--. 1 root root 850 Oct 25 07:44 group- lrwxrwxrwx. 1 root root 22 Oct 25 07:44 grub2.cfg -> ../boot/grub2/grub.cfg lrwxrwxrwx. 1 root root 20 Oct 25 07:44 grub.conf -> /boot/grub/grub.conf drwx------. 2 root root 4096 Oct 25 07:44 grub.d ----------. 1 root root 695 Oct 25 07:44 gshadow ----------. 1 root root 684 Oct 25 07:44 gshadow- drwxr-xr-x. 2 root root 6 Oct 25 07:44 gss drwxr-xr-x. 2 root root 18 Oct 25 07:44 gtk-2.0 drwxr-xr-x. 2 root root 25 Oct 25 07:44 gtk-3.0 -rw-r--r--. 1 root root 871 Oct 25 07:44 hba.conf -rw-r--r--. 1 root root 9 Oct 25 07:44 host.conf -rw-r--r--. 1 root root 19 Oct 25 07:44 hostname -rw-r--r--. 1 root root 231 Oct 25 07:44 hosts -rw-r--r--. 1 root root 370 Oct 25 07:44 hosts.allow -rw-r--r--. 1 root root 460 Oct 25 07:44 hosts.deny drwxr-xr-x. 2 root root 23 Oct 25 07:44 hp drwxr-xr-x. 5 root root 86 Oct 25 07:44 httpd -rw-r--r--. 1 root root 3580 Oct 25 07:44 idmapd.conf lrwxrwxrwx. 1 root root 11 Oct 25 07:44 init.d -> rc.d/init.d -rw-r--r--. 1 root root 491 Oct 25 07:44 inittab -rw-r--r--. 1 root root 942 Oct 25 07:44 inputrc drwxr-xr-x. 2 root root 4096 Oct 25 07:44 iproute2 -rw-r--r--. 1 root root 2552 Oct 25 07:44 ipsec.conf drwx------. 5 root root 91 Oct 25 07:44 ipsec.d -rw-------. 1 root root 31 Oct 25 07:44 ipsec.secrets drwxr-xr-x. 2 root root 50 Oct 25 07:44 iscsi -rw-r--r--. 1 root root 23 Oct 25 07:44 issue -rw-r--r--. 1 root root 22 Oct 25 07:44 issue.net drwxr-xr-x. 3 root root 59 Oct 25 07:44 java drwxr-xr-x. 2 root root 6 Oct 25 07:44 jvm drwxr-xr-x. 2 root root 6 Oct 25 07:44 jvm-commmon -rw-r--r--. 1 root root 6088 Oct 25 07:44 kdump.conf drwxr-xr-x. 3 root root 23 Oct 25 07:44 kernel -rw-r--r--. 1 root root 495 Oct 25 07:44 krb5.conf -rw-r--r--. 1 root root 478 Oct 25 07:44 ksmtuned.conf -rw-r--r--. 1 root root 67754 Oct 25 07:44 ld.so.cache -rw-r--r--. 1 root root 28 Oct 25 07:44 ld.so.conf drwxr-xr-x. 2 root root 4096 Oct 25 07:44 ld.so.conf.d -rw-r-----. 1 root root 191 Oct 25 07:44 libaudit.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 libibverbs.d drwxr-xr-x. 2 root root 33 Oct 25 07:44 libnl drwxr-xr-x. 6 root root 4096 Oct 25 07:44 libreport -rw-r--r--. 1 root root 2391 Oct 25 07:44 libuser.conf drwx------. 4 root root 4096 Oct 25 07:44 libvirt -rw-r--r--. 1 root root 17 Oct 25 07:44 locale.conf lrwxrwxrwx. 1 root root 38 Oct 25 07:44 localtime -> ../usr/share/zoneinfo/America/New_York -rw-r--r--. 1 root root 2028 Oct 25 07:44 login.defs -rw-r--r--. 1 root root 662 Oct 25 07:44 logrotate.conf drwxr-xr-x. 2 root root 4096 Oct 25 07:44 logrotate.d drwxr-xr-x. 6 root root 74 Oct 25 07:44 lvm -r--r--r--. 1 root root 33 Oct 25 07:44 machine-id -rw-r--r--. 1 root root 111 Oct 25 07:44 magic -rw-r--r--. 1 root root 272 Oct 25 07:44 mailcap -rw-r--r--. 1 root root 1968 Oct 25 07:44 mail.rc -rw-r--r--. 1 root root 5122 Oct 25 07:44 makedumpfile.conf.sample -rw-r--r--. 1 root root 5171 Oct 25 07:44 man_db.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 maven -rw-r--r--. 1 root root 51787 Oct 25 07:44 mime.types -rw-r--r--. 1 root root 936 Oct 25 07:44 mke2fs.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 modprobe.d drwxr-xr-x. 2 root root 6 Oct 25 07:44 modules-load.d -rw-r--r--. 1 root root 0 Oct 25 07:44 motd lrwxrwxrwx. 1 root root 17 Oct 25 07:44 mtab -> /proc/self/mounts -rw-r--r--. 1 root root 2620 Oct 25 07:44 mtools.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 multipath -rw-r--r--. 1 root root 570 Oct 25 07:44 my.cnf drwxr-xr-x. 2 root root 30 Oct 25 07:44 my.cnf.d -rw-r--r--. 1 root root 8892 Oct 25 07:44 nanorc -rw-r--r--. 1 root root 767 Oct 25 07:44 netconfig drwxr-xr-x. 7 root root 4096 Oct 25 07:44 NetworkManager -rw-r--r--. 1 root root 58 Oct 25 07:44 networks -rw-r--r--. 1 root root 3390 Oct 25 07:44 nfsmount.conf -rw-r--r--. 1 root root 1717 Oct 25 07:44 nsswitch.conf -rw-r--r--. 1 root root 1726 Oct 25 07:44 nsswitch.conf.bak drwxr-xr-x. 2 root root 36 Oct 25 07:44 ntp -rw-r--r--. 1 root root 91 Oct 25 07:44 numad.conf drwxr-xr-x. 2 root root 6 Oct 25 07:44 oddjob -rw-r--r--. 1 root root 4922 Oct 25 07:44 oddjobd.conf drwxr-xr-x. 2 root root 68 Oct 25 07:44 oddjobd.conf.d drwxr-xr-x. 3 root root 34 Oct 25 07:44 openldap drwxr-xr-x. 2 root root 6 Oct 25 07:44 opt -rw-r--r--. 1 root root 493 Oct 25 07:44 os-release -rw-r--r--. 1 root root 1442 Oct 25 07:44 ovirt-guest-agent.conf drwxr-xr-x. 3 root root 101 Oct 25 07:44 PackageKit drwxr-xr-x. 2 root root 4096 Oct 25 07:44 pam.d -rw-r--r--. 1 root root 2058 Oct 25 07:44 passwd -rw-r--r--. 1 root root 2005 Oct 25 07:44 passwd- -rw-r--r--. 1 root root 1362 Oct 25 07:44 pbm2ppa.conf -rw-r--r--. 1 root root 2872 Oct 25 07:44 pinforc drwxr-xr-x. 3 root root 20 Oct 25 07:44 pkcs11 drwxr-xr-x. 12 root root 4096 Oct 25 07:44 pki drwxr-xr-x. 2 root root 27 Oct 25 07:44 plymouth drwxr-xr-x. 5 root root 49 Oct 25 07:44 pm -rw-r--r--. 1 root root 6300 Oct 25 07:44 pnm2ppa.conf drwxr-xr-x. 5 root root 69 Oct 25 07:44 polkit-1 drwxr-xr-x. 2 root root 6 Oct 25 07:44 popt.d drwxr-xr-x. 2 root root 4096 Oct 25 07:44 postfix drwxr-xr-x. 3 root root 4096 Oct 25 07:44 ppp drwxr-xr-x. 2 root root 70 Oct 25 07:44 prelink.conf.d -rw-r--r--. 1 root root 233 Oct 25 07:44 printcap -rw-r--r--. 1 root root 1750 Oct 25 07:44 profile drwxr-xr-x. 2 root root 4096 Oct 25 07:44 profile.d -rw-r--r--. 1 root root 6545 Oct 25 07:44 protocols drwxr-xr-x. 2 root root 75 Oct 25 07:44 pulse drwxr-xr-x. 2 root root 22 Oct 25 07:44 purple drwxr-xr-x. 3 root root 48 Oct 25 07:44 qemu-ga drwxr-xr-x. 2 root root 49 Oct 25 07:44 qemu-kvm -rw-r--r--. 1 root root 433 Oct 25 07:44 radvd.conf lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc0.d -> rc.d/rc0.d lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc1.d -> rc.d/rc1.d lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc2.d -> rc.d/rc2.d lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc3.d -> rc.d/rc3.d lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc4.d -> rc.d/rc4.d lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc5.d -> rc.d/rc5.d lrwxrwxrwx. 1 root root 10 Oct 25 07:44 rc6.d -> rc.d/rc6.d drwxr-xr-x. 10 root root 4096 Oct 25 07:44 rc.d lrwxrwxrwx. 1 root root 13 Oct 25 07:44 rc.local -> rc.d/rc.local -rw-r--r--. 1 root root 52 Oct 25 07:44 redhat-release -rw-r--r--. 1 root root 1787 Oct 25 07:44 request-key.conf drwxr-xr-x. 2 root root 29 Oct 25 07:44 request-key.d -rw-r--r--. 1 root root 247 Oct 25 07:44 resolv.conf drwxr-xr-x. 5 root root 62 Oct 25 07:44 rhsm -rw-r--r--. 1 root root 96 Oct 25 07:44 rht -rw-r--r--. 1 root root 1634 Oct 25 07:44 rpc drwxr-xr-x. 2 root root 4096 Oct 25 07:44 rpm -rw-r--r--. 1 root root 458 Oct 25 07:44 rsyncd.conf -rw-r--r--. 1 root root 3232 Oct 25 07:44 rsyslog.conf drwxr-xr-x. 2 root root 101 Oct 25 07:44 rsyslog.d -rw-r--r--. 1 root root 927 Oct 25 07:44 rwtab drwxr-xr-x. 2 root root 6 Oct 25 07:44 rwtab.d drwxr-xr-x. 2 root root 35 Oct 25 07:44 samba drwxr-xr-x. 3 root root 4096 Oct 25 07:44 sane.d drwxr-xr-x. 2 root root 62 Oct 25 07:44 sasl2 drwxr-xr-x. 3 root root 32 Oct 25 07:44 scl -rw-------. 1 root root 221 Oct 25 07:44 securetty drwxr-xr-x. 6 root root 4096 Oct 25 07:44 security drwxr-xr-x. 3 root root 54 Oct 25 07:44 selinux -rw-r--r--. 1 root root 670293 Oct 25 07:44 services -rw-r--r--. 1 root root 216 Oct 25 07:44 sestatus.conf drwxr-xr-x. 2 root root 32 Oct 25 07:44 setroubleshoot drwxr-xr-x. 2 root root 4096 Oct 25 07:44 setuptool.d drwxr-xr-x. 3 root root 20 Oct 25 07:44 sgml ----------. 1 root root 1170 Oct 25 07:44 shadow ----------. 1 root root 1148 Oct 25 07:44 shadow- -rw-r--r--. 1 root root 95 Oct 25 07:44 shells drwxr-xr-x. 4 root root 88 Oct 25 07:44 skel drwxr-xr-x. 3 root root 71 Oct 25 07:44 smartmontools -rw-r--r--. 1 root root 256 Oct 25 07:44 sos.conf drwxr-xr-x. 3 root root 19 Oct 25 07:44 sound drwxr-xr-x. 4 root root 53 Oct 25 07:44 speech-dispatcher drwxr-xr-x. 2 root root 4096 Oct 25 07:44 ssh drwxr-xr-x. 2 root root 18 Oct 25 07:44 ssl -rw-r--r--. 1 root root 212 Oct 25 07:44 statetab drwxr-xr-x. 2 root root 6 Oct 25 07:44 statetab.d -rw-r-----. 1 root root 1786 Oct 25 07:44 sudo.conf -r--r-----. 1 root root 4066 Oct 25 07:44 sudoers drwxr-x---. 2 root root 6 Oct 25 07:44 sudoers.d -rw-r-----. 1 root root 3181 Oct 25 07:44 sudo-ldap.conf drwxr-xr-x. 7 root root 4096 Oct 25 07:44 sysconfig -rw-r--r--. 1 root root 225 Oct 25 07:44 sysctl.conf drwxr-xr-x. 2 root root 27 Oct 25 07:44 sysctl.d drwxr-xr-x. 4 root root 4096 Oct 25 07:44 systemd lrwxrwxrwx. 1 root root 14 Oct 25 07:44 system-release -> redhat-release -rw-r--r--. 1 root root 45 Oct 25 07:44 system-release-cpe drwxr-xr-x. 2 root root 6 Oct 25 07:44 terminfo drwxr-xr-x. 2 root root 66 Oct 25 07:44 tmpfiles.d -rw-r--r--. 1 root root 375 Oct 25 07:44 trusted-key.key drwxr-xr-x. 2 root root 49 Oct 25 07:44 tuned drwxr-xr-x. 3 root root 51 Oct 25 07:44 udev drwxr-xr-x. 2 root root 6 Oct 25 07:44 udisks2 drwxr-xr-x. 2 root root 65 Oct 25 07:44 unbound -rw-r--r--. 1 root root 508 Oct 25 07:44 updatedb.conf drwxr-xr-x. 2 root root 24 Oct 25 07:44 UPower -rw-r--r--. 1 root root 889 Oct 25 07:44 usb_modeswitch.conf drwxr-xr-x. 2 root root 12288 Oct 25 07:44 usb_modeswitch.d -rw-r--r--. 1 root root 37 Oct 25 07:44 vconsole.conf -rw-r--r--. 1 root root 1982 Oct 25 07:44 vimrc -rw-r--r--. 1 root root 1982 Oct 25 07:44 virc drwxr-xr-x. 3 root root 4096 Oct 25 07:44 vmware-tools -rw-r--r--. 1 root root 4479 Oct 25 07:44 wgetrc drwxr-xr-x. 2 root root 32 Oct 25 07:44 wpa_supplicant -rw-r--r--. 1 root root 0 Oct 25 07:44 wvdial.conf drwxr-xr-x. 6 root root 97 Oct 25 07:44 X11 drwxr-xr-x. 5 root root 94 Oct 25 07:44 xdg drwxr-xr-x. 2 root root 6 Oct 25 07:44 xinetd.d drwxr-xr-x. 2 root root 20 Oct 25 07:44 xml drwxr-xr-x. 6 root root 4096 Oct 25 07:44 yum -rw-r--r--. 1 root root 813 Oct 25 07:44 yum.conf drwxr-xr-x. 2 root root 21 Oct 25 07:44 yum.repos.d5.配置desktop主机和server主机的日志服务要求如下: 1)desktop主机中的日志全部定向到/var/log/westos文件中
[root@client ~]# vim /etc/rsyslog.conf [root@client ~]# systemctl restart rsyslog.service [root@client ~]# cd /var/log/ [root@client log]# ll total 2924 drwxr-xr-x. 2 root root 4096 May 6 2014 anaconda drwxr-x---. 2 root root 22 Jul 10 2014 audit -rw-r--r--. 1 root root 4966 Oct 27 10:44 boot.log -rw-------. 1 root utmp 0 May 6 2014 btmp drwxr-xr-x. 2 chrony chrony 6 Feb 5 2014 chrony -rw-r--r--. 1 root root 567991 Jul 10 2014 cloud-init.log -rw-r--r--. 1 root root 12202 Oct 27 10:50 cron drwxr-xr-x. 2 lp sys 54 Oct 18 07:48 cups -rw-r--r--. 1 root root 33263 Oct 27 10:44 dmesg -rw-r--r--. 1 root root 33263 Oct 25 05:00 dmesg.old -rw-r--r--. 1 root root 17132 Oct 27 10:54 ewstos drwx--x--x. 2 root gdm 64 Oct 27 10:44 gdm drwx------. 2 root root 6 Mar 20 2014 httpd -rw-r--r--. 1 root root 292292 Oct 27 10:52 lastlog drwx------. 5 root root 37 Jul 10 2014 libvirt -rw-------. 1 root root 968 Oct 27 10:44 maillog -rw-------. 1 root root 640433 Oct 27 10:54 messages drwxr-xr-x. 2 ovirtagent ovirtagent 34 Jul 10 2014 ovirt-guest-agent drwxr-xr-x. 3 root root 17 Jul 10 2014 pluto -rw-r--r--. 1 root root 0 Oct 27 10:44 pm-powersave.log drwx------. 2 root root 6 Jan 26 2014 ppp drwxr-xr-x. 2 root root 6 Apr 2 2014 qemu-ga drwxr-xr-x. 2 root root 21 May 6 2014 rhsm drwxr-xr-x. 2 root root 50 Oct 27 10:44 sa drwx------. 3 root root 16 Jul 10 2014 samba -rw-------. 1 root root 21555 Oct 27 10:52 secure drwx------. 2 root root 6 Jan 27 2014 speech-dispatcher -rw-------. 1 root root 0 May 6 2014 spooler -rw-------. 1 root root 0 May 6 2014 tallylog drwxr-xr-x. 2 root root 22 Jul 10 2014 tuned -rw-r--r--. 1 root root 1369255 Oct 25 08:02 westos -rw-rw-r--. 1 root utmp 18816 Oct 27 10:52 wtmp -rw-r--r--. 1 root root 17422 Oct 27 10:45 Xorg.0.log -rw-r--r--. 1 root root 17421 Oct 25 05:00 Xorg.0.log.old -rw-------. 1 root root 54137 Oct 25 07:12 yum.log 55 *.info;mail.none;authpriv.none;cron.none /var/log/messages 56 57 *.* /var/log/ewstos 58 # The authpriv file has restricted access.2)实时同步desktop主机中的所有日志到server中
[root@client ~]# vim /etc/rsyslog.conf [root@client ~]# systemctl restart rsyslog.service [root@client ~]# > /var/log/messages [root@client ~]# logger hello [root@client ~]# cat /var/log/messages [root@server ~]# vim /etc/rsyslog.conf [root@server ~]# systemctl restart rsyslog.service [root@server ~]# > /var/log/messages [root@server ~]# cat /var/log/messages6.在server主机中用timedatectl命令设定系统时区为上海,时间为11:11:11
[root@server ~]# timedatectl set-timezone Asia/Shanghai [root@server ~]# timedatectl set-time "11:11:11" [root@server ~]# date Thu Oct 25 11:11:35 CST 20187.配置server主机的chronyd服务,使server主机中的时间可以被desktop主机同步
[root@server ~]# vim /etc/chrony.conf [root@server ~]# systemctl restart chronyd.service 22 allow 192.25.70.0/24 23 24 # Listen for commands only on localhost. 25 bindcmdaddress 127.0.0.1 26 bindcmdaddress ::1 27 28 # Serve time even if not synchronized to any NTP server. 29 local stratum 108.同步server主机的时间到desktop主机中
[root@client ~]# vim /etc/chrony.conf [root@client ~]# systemctl restart chronyd.service # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 172.25.70.11 iburst # Ignore stratum in source selection. [root@client ~]# chronyc sources -v 210 Number of sources = 1 .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || / xxxx = adjusted offset, || Log2(Polling interval) -. | yyyy = measured offset, || \ | zzzz = estimated error. || | | MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 172.25.70.250 10 6 7 31 -1120ns[ +72ms] +/- 81us9.配置系统中的systemd-journal程序,使journal命令可以查看到关机前的日志
[root@server ~]# mkdir /var/log/journal [root@server ~]# chgrp systemd-journal /var/log/journal [root@server ~]# chmod g+s /var/log/journal [root@server ~]# ps aux|grep systemd-journal root 361 0.0 0.3 42992 7284 ? Ss 07:35 0:01 /usr/lib/systemd/systemd-journald root 4424 0.0 0.0 112644 940 pts/0 R+ 11:22 0:00 grep --color=auto systemd-journal [root@server ~]# killall -1 systemd-journald [root@server ~]# ls /var/log/journal/ 946cb0e817ea4adb916183df8c4fc817