[关闭]
@torresdyl 2018-04-26T15:12:12.000000Z 字数 4957 阅读 1151

RHCSA Red Hat enterprise Linux 7 (RHEL 7) preperation (March 2015) (EX200)

rhel redhat test


Chapter 1. Installation with local DVD

Note: not required in exam

1. History

Richard Stallman: GNU(GNU's Not Unix project), 1991
Linus Torvalds: kernel, 1991

RHL: since 1994
RHEL 7: based on kernel 3.10 at first, 2014
100% rebuilds: CentOS and Scientific Linux

2. Installation

Anaconda: the installer. 3 modes: GUI, text, kickstart(for network installation, no user intervention)
KVM(kernel-based virtualization machine) is integrated into RHEL 7, to install virtual machines of Linux or Windows on RHEL 7.
RHEL 7 can be installed in network.

??? two key hardware requirements for a computer to use KVM
64 bit and support hardware virtualization.

6 virtual console screens, Ctrl+Alt+F1-F6
F1: main screen to choose language, and then changes to F6
F2: bash shell with root
F3: installation log info (/tmp/anaconda.log)
F4: storage info (/tmp/storage.log)
F5: program info (/tmp/lprogram.log)
F6: default GUI installation console

log files: first created in /tmp, then moved to `/var/log' after installation.

file names what to do
/root/anaconda-ks.cfg records of config
/root/install.log packages installed
/root/install.log.syslog general messages
/var/log/anaconda*.log other things

3. partition

/boot must be created as a standard partition outside LVM. (xfs file system, the LVM volume group is "standard partition"). /, /home if xfs, LVM volume group is vg00(customed name), and swap is of file system swap, vg00.

If we choose automatic partition, it will use LVM, and standard partition is not used.

4. IP

the address can be changed during installation.

Chapter 2 Basic Linux tools

Objectives:
- shell, commands
- archive, compress, unpack, uncompress with tar,star, gzip and bzip2.
- text files
- man, info, and /user/share/doc.

1. remote login in linux

  1. # login
  2. ssh -l user1 192.168.0.100
  3. ssh user1@192.168.0.100
  4. # GUI app
  5. ssh -X 192.168.0.100

2. basic commands

  1. ls -la
  2. cd ~user2 # if user1 have execetion bit on the path
  3. tty # show terminal name
  4. who # check /var/run/utmp to see who is logged in now
  5. who am i # check current user login info
  6. w # or `what`, is like `who am i`, with more details
  7. uptime # check uptime, system time, and how many users are logged in
  8. whoami # show the current username
  9. logname # show real username, even when `su`, it shows real name
  10. which cat # show what `cat` will be run if we don't specify an absolute path

2.1 id

id shows UID, username, GID, group name, secondary groups and SELinux context.

  1. > id
  2. uid=0(root) gid=0(root) groups=0(root),1004(admin),1005(rvm)
  3. > id westerngun
  4. uid=1000(westerngun) gid=1004(admin) groups=1004(admin),10(wheel),48(apache),1005(rvm)

2.2 groups

Shows in which group the user is in. The first group: primary group. The rest: secondary group(s).

  1. > groups $(logname)
  2. root : root admin rvm
  3. > groups $(whoami)
  4. westerngun : admin wheel apache rvm

2.3 last and lastb

last check /var/log/wtmp to list all successful login attempts, system reboots.

  1. last # list all users activities(login, logout)
  2. last reboot # list reboots

lastb checkss /var/log/btmp and list all failed login attempts.

  1. lastb # list all failed login

lastlog list recent login users, and users never logined.

2.4 Sysinfo

  1. uname # system name only
  2. uname -a # all details of system, like if it is 64 bit.
  3. Linux local_ding 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

hostnamectl show hostname.

  1. hostnamectl
  2. Static hostname: local_host
  3. Icon name: computer-vm
  4. Chassis: vm
  5. Machine ID: 5bb21648846848068840eee34f80c819
  6. Boot ID: 5a54d43a2efe44c28ab7c3ce9bfef00e
  7. Virtualization: vmware
  8. Operating System: CentOS Linux 7 (Core)
  9. CPE OS Name: cpe:/o:centos:centos:7
  10. Kernel: Linux 3.10.0-693.2.2.el7.x86_64
  11. Architecture: x86-64

hostnamectl set-hostname xxx change hostname
hostname shows current name.

2.5 Check/set date/time

  1. timedatectl # show details
  2. timedatectl set-time 2015-08-21 # change date. CAUTION: NOT `set-date`!
  3. timedatectl set-time 11:00
  4. date --set "2018-08-21 10:00" # set date and time
  5. timedatectl list-timezones # list available timezones
  6. timedatectl set-timezone Europe/Madrid # change timezone. No "" needed

2.6 wc: check file info

  1. wc /etc/profile
  2. 76 252 1795 /etc/profile
  3. | | | |
  4. | | | file name
  5. | | bytes/characters counts(-c)
  6. | word counts (-w)
  7. line counts (-l)

2.6 List PCI, USB and CPU

  1. lspci -v/-vv/-vvv/-m # list PCI buses and devices attached; with details
  2. lsusb -v/-vv/-vvv # list USB buses
  3. lscpu # list cpu info

2.7 compression(***)

tar, gzip, bzip2 are used to compress/uncompress files. tar is for archiving, gzip,bzip2 are to compress/uncompress.

  1. gzip file1 file2 # will compress the two files in separate files

NOTE: this way will replace original files!! with .gz extension! And compress!
To uncompress, run gunzip xxx.gz or gzip -d xxx.gz.

  1. bzip2 xxx # will comrress the file and replace original file
  2. bzip2 -d xxx.bz2
  3. bunzip2 xxx.bz2 # will uncompress file and delete .bz2 file

tar can archive files, preserving the attributes of files.

switch meaning
-c create a tarball
-f specify name
-j compress with bzip2
-z compress with gzip
-x extract files
-r append file to a tarball. Not working with compressed tarball
-t list content
-u same as -r but only if the file to append is newer
-v verbose
--selinux/--no-selinux include/exclude SELinux file contexts
--xattrs/--no-xattrs include/exclude extended file attributes

for example:

  1. tar cfv /tmp/new.tar /home # archive files and save to /tmp/new.tar, without compressing
  2. tar cfv /tmp/new.tar file1 file2
  3. tar rvf /tmp/new.tar /etc/yum.repos.d # append the file to the tar
  4. tar xvf /tmp/new.tar # extract the files in the tar in here (.)
  5. tar cvfz /tmp/new.tar.gz /home # archive and compress with gzip
  6. tar cvfj /tmp/new.tar.bz2 /home # archive and compress with bzip2

Remember: first the tar file name, then the files to package!

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注